Single-site Docker environment for Drupal local site development and migrations, for sites which feature a docroot.
-
Inside the
stasis
folder, copy or link your Drupal folder. Rename the folder to berepo
. -
After doing this, run
./deploy init d8
from thestasis
folder to create yoursettings.php
andservices.yml
files. -
Open a terminal window and run the following:
docker-compose up
You can control-C to close this window when you are done using the servers. Meanwhile, you can watch these logs to see if anything weird is happening in your site.
-
Run
./deploy
to get access to the terminal and see the serer's IP address. -
When you are finished, run
docker-compose down
to power down the servers (or pressctrl-C
in the terminal where the logs appear.
In some environments you may not be able to have repo
as a simlink if the folder permissions are not appropriate. Consider testing repo
as a folder if you are getting permission errors involving the current working directory on your local machine.
Make sure that repo/docroot exists in this folder, containing your site's code first!
./deploy init # copies the site's default.settings.php and default.services.yml
# to settings/settings.php and settings/services.yml
# so you can edit these if you need. The DB is set at
# the bottom if you add d7 or d8 as parameters (see
# below). Docker will mount settings as
# docroot/sites/default.
./deploy init d7 # Will inject the DB values as well
./deploy init d8 # Will inject the DB values as well
./deploy si # run the site installer
./deploy db # import the sql/drupal.sql.gz
Create a custom settings.php first if you have not already (see above).
./deploy init d8
Start up a console that will start the process and show the logs.
docker-compose up
Now, in another terminal window, run the following command in this folder.
./deploy
There you go! You should be able to use drush, drupal console, and composer.
When you are finished you can "exit" the deploy window if you wish. You can run the shutdown command from any terminal window:
docker-compose down
A secondary database called drupal_legacy is already configured and works the same as the regular db import command:
./deploy db_legacy # import the sql/drupal_legacy.sql.gz DB
It will destroy the database container, so all DBs will be removed in one go. Server will restart when it is killed, so reloading will cause site installer to begin.
./deploy xx # delete the DB so you can run a fresh db import later