The local
folder contains scripts and docker/drupal configuration to create an instance of the site locally.
- Rename
local/.env.example
tolocal/.env
and edit it to adjust the environement variables. The default should be enough. - Rename
local/shared/settings/settings.site.php.example
tolocal/shared/settings/settings.site.php
and edit it to adjust the settings.
Important: Run the scripts from the root of the repository.
The script ./local/install.sh
is used to create/stop/remove containers etc. Run ./local/install.sh -h
to see the script options.
The script ./local/exec.sh
is a shortcut for docker compose -f local/docker-compose.yml exec
To run additional docker compose commands, use docker compose -f local/docker-compose.yml
+ command
.
- Run
./local/install.sh -m -c -i
to create an instance of the site (empty database) from the existing config. - Run
./local/exec.sh -T -u appuser site drush sqlc < path-to-db-dump.sql
to restore a database dump. - Run
./local/install.sh -d
to install the dev dependencies, import the config and update the database.
- Run
./local/install.sh -s
to stop the containers - Run
./local/install.sh
to start the containers
- Run
./local/install.sh -x
to stop and remove the containers. - Run
./local/install.sh -d
to recreate the containers and install the dev dependencies.
Note: Run ./local/install.sh -x -v
to completely clean up a local instance (remove containers and volumes). Follow the "create instance" above to recreate an instance.
After modifications to the composer files (for example, after the automatic composer update), it is recommended to recreate the local site image:
- Run
./local/install.sh -m -d
to recreate the site image and install the dev dependencies.
When a new image used by a service has been created by the OPS team (ex: new mysql or php image):
- Run
./local/install.sh -u -d
to pull the service and base site images, recreate the local site image and the containers and install the dev dependencies.
When an image with a new tag has been created, then update the local/docker-compose.yml
or the docker/Dockerfile
accordingly before running the update command above.
- Install all the modules (including dev) with
./local/exec.sh -w /srv/www site composer install
. - Update all the modules (including dev) with
./local/exec.sh -w /srv/www site composer update
. - Add a module with
./local/exec.sh -w /srv/www site composer require site/some-module
. - Remove a module with
./local/exec.sh -w /srv/www site composer remove site/some-module
.
Enter the container with ./local/exec.sh -w /srv/www site sh
and edit files with vi
for example.
Alternatively clone the core or contrib module/theme somewhere and mount the relevant folder/files by editing the local/docker-compose.yml
file.
Ex: "../contrib-module-repo/:/srv/www/html/modules/contrib/contrib-module-name:rw"
.
See the similar local stack in the ReliefWeb API repository to set up an instance of the API and its Elasticsearch backend.
Run ./local/exec.sh -u appuser site drush rapi-i --alias all
to re-index the content in the API.
Check the setup-notes for first-time set-up of a local reverse proxy.