spargo/drupal
Drupal 8 hosted by Apache HTTPd with PHP 7.2 on CentOS
100K+
Spargo's implementation of Drupal 8 with PHP 7.2 on Apache.
Pull the image from Docker Hub
docker pull spargo/drupal:latest
This image requires a database. To start an instance of Drupal for manual configuration run
docker run -d -p 80:80 -e SKIP_SITE_INSTALL=true --name spargo_drupal spargo/drupal
You can use the provided docker-compose.yml
to stand up an instance pointing to a spargo/database image.
docker-compose up -d
# Start Containers using 'docker-compose.yml'
dup
# Alternatively, start containers using 'docker-compose.ui.yml'
dup ui
# Stop running containers
ddown
# Alternatively, stop running containers and clean volumes
ddown v
# Restore a site backup
# - This command restores the 'astro_registration.tar.gz' to the 'drupal_drupal_1' container.
drestore drupal_drupal_1 astro_registration.tar.gz
# Backup a site after configuration changes have been made.
# A file will be created in the `./share/backup` folder.
dbackup
Connect to a container:
dconnect
Once connected you can use the Drupal library commands.
# Pull the images
docker pull spargo/drupal:latest
# Alternatively, build the image if local changes have been made. Use `-F` to force a complete build instead of allowing Docker to build from cache.
# Be sure you are in the project directory you want to build, for instance: ./drupal
dbuild -F
# Start the containers using the 'docker-compose.test.yml'
dup -e test
At this point you should be able to login to the site and make configuration changes
# Connect to the container
dconnect
# Generate Profile (command to be completed within container)
generate_profile [profile_name]
# Manually copy composer files
cp composer.* /spargo/share
# exit the container
exit
# Copy the composer files to the right place for the build
cp ./share/composer.* _configuration/spargo/drupal/
To have the changes reflected the next time you start the container you will need to build the image
and update the docker-compose.test.yml
file to specify the new DRUPAL_PROFILE
you create.
Once satisfied with the changes, commit updates to GitHub to have Docker Hub automatically build a new image for others to pull.
ECS CLI documentation: GitHub Readme and Developer Guide
ecs-cli compose --file docker-compose.aws.yml --project-name drupal-QA service up --launch-type FARGATE --cluster drupal-cl
or using script (open drupal/erun.cmd to adjust parameters)
erun
Where drupal-QA is a service name and task name. Changes to the configuration can be done in ecs-params.yml
Bring the service down
ecs-cli compose --file docker-compose.aws.yml --project-name drupal-QA service down --cluster drupal-cl
or using script (open drupal/erun.cmd to adjust parameters)
erun -d
Displays all running containers in cluster
ecs-cli ps --cluster drupal-cluster
You will need to update the composer.json and composer.lock files. Use the following commands to do this properly.
# Run 'spargo/drupal:latest' image only (no database)
# This function includes a bind mount to capture changes in the composer.json and composer.lock
run_drupal_for_drupal_update
# Connect to the running instance
dconnect spargo_drupal
# Install the module on the image
su drupal -c "composer require drupal/[module_name]"
Once this is completed you should test that the build works properly before pushing a new image or committing any code.
# Stop any running docker containers
drm
# Build the image
dbuild
# Run the newly built image for testing
dup clean
Using a browser you should be able to see the new modules listed in the Extend page.
# This should show the changed composer.json and composer.lock files
git status
# This should show the added modules
git diff composer.json
# Stage and commit changes
git commit -am "My commit message"
In addition to using composer to install the modules, you must have the profile install the module in the database.
The spargo_mvp.info.ymlinstall section lists modules to be installed by the profile. New modules must be added here in alphabetical order. Dependencies are listed within the modules themselves.
Lastly, in order to have the module configured upon startup, configuration files must be added to the profile.
Use the export_config
command to generate profile updates. TODO: More work for parameterizing this function is needed.
Default data must be installed by custom module. This data can include Custom Blocks, Users, or any other data within the system. We do not have a standard for which to request or develop these items.
docker pull spargo/drupal