The purpose of this Drupal codebase is to demonstrate a Drupal project and configuration set up for deployment into Kubernetes or an otherwise scalable containerized environment.
The project is used in tandem with the Raspberry Pi Dramble, an open source Kubernetes cluster tailor made for Drupal meant to run on a cluster of Raspberry Pis.
Please read through the project documentation for details about how this project was created, how it's structured for easy development and deployment into production container environments, and how you can create your own Drupal project like it.
-
Build the site's docker image from the Dockerfile:
docker build -t geerlingguy/drupal-for-kubernetes .
-
Run the local development environment:
docker-compose up -d
(Wait for the environment to come up—you can monitor the logs with
docker-compose logs -f
). -
Once the container is running, install Drupal. You can either access http://localhost/ and install using the UI, or install via Drush:
docker-compose exec drupal bash -c 'vendor/bin/drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DB_PASSWORD@$DRUPAL_DB_HOST/drupal" --site-name="Drupal Example Site for Kubernetes" --existing-config -y'
-
Visit http://localhost/ in your browser, and login as
admin
using the password Drush printed in the 'Installation complete' message.
After making any configuration changes on the website, you can export the configuration to disk so it can be preserved in the codebase and deployed to the production site:
docker-compose exec drupal bash -c 'vendor/bin/drush config:export -y'
For more on the way this project's configuration changes are handled, and the general site development process, see the project documentation.
MIT license.
Created in 2019 by Jeff Geerling, author of Ansible for DevOps and Ansible for Kubernetes.