0

It was easy to get Drupal installed with a single drush command before:

            drush si $profile -y \
            --db-url=mysql://$MYSQL_USER:$PASS@localhost/$DB \
            --site-name=$DOM \
            --site-mail=$EMAIL \
            --account-mail=$EMAIL \
            --account-name=$USER \
            --account-pass=$PASS >> /dev/null 2>&1

and it would completely finish Drupal installation without expecting user to do anything on UI.

Now with Drupal switching to Composer package manager, I am using the following command

composer --quiet create-project drupal-composer/drupal-project:8.x-dev $HOME --stability dev --no-interaction

however, unfortunately this method expects user to finish Drupal 8 installation on UI entering database, username and password manually. I wonder is there any way to make Composer do installation till the very end without any human interaction?

2
  • 3
    You can still install Drupal with Drush, you just use Composer to handle getting the code base and Drush. Maybe Composer has some sort of post-hook, that you could use to automatically call the Drush code.
    – Jaypan
    Mar 29 '18 at 6:26
  • 2
    It does @Jaypan: getcomposer.org/doc/articles/scripts.md. Nick, remember Composer is just a generic dependency manager for PHP libraries, it doesn't know anything about Drupal unless you tell it about it. As Jaypan said, Composer is for getting the files, drush is for working with them in a Drupal context. You can combine the two, either with a Composer post-x script, or a simple bash script, but they're separate things by default
    – Clive
    Mar 29 '18 at 9:40
2

So since nobody provided acceptable answer, based on the above comments I tried the following bash-script and it worked flawlessly:

sudo -u $USER /usr/local/bin/composer --quiet create-project drupal-composer/drupal-project:8.x-dev $HOME/public_html --stability dev --no-interaction
cd $HOME/public_html/web
drush si -y \
  --db-url=mysql://$MYSQL_USER:$PASS@localhost/$DB \
  --site-name=$DOM \
  --site-mail=$EMAIL \
  --account-mail=$EMAIL \
  --account-name=$USER \
  --account-pass=$PASS >> /dev/null 2>&1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.