From 59e11898907a2080c2257379ffdfae644bf49007 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Fri, 8 Mar 2019 09:41:18 -0600 Subject: [PATCH 01/59] Fixes #16: Put Home and About page images into theme, and add Drush Launcher. --- .travis.yml | 2 +- Dockerfile | 5 +++++ README.md | 4 ++-- docs/add-custom-theme.md | 2 +- docs/configure-and-reproduce.md | 4 ++-- docs/create-default-content.md | 2 +- docs/deploy-drupal-kubernetes.md | 8 ++++---- docs/starting-new-project.md | 2 +- .../53ce7095-0338-45d6-b559-edc76808b622.json | 8 ++++---- .../6f7c42db-82ff-4c81-9c3d-11e6baffcb98.json | 8 ++++---- .../images/raspberry-pi-dramble-hero-2019.jpg | Bin 0 -> 168751 bytes .../raspberry-pi-dramble-profile-2019.jpg | Bin 0 -> 144620 bytes 12 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 web/themes/custom/pidramble/images/raspberry-pi-dramble-hero-2019.jpg create mode 100644 web/themes/custom/pidramble/images/raspberry-pi-dramble-profile-2019.jpg diff --git a/.travis.yml b/.travis.yml index ec91343..2901770 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ script: # Install Drupal. - > docker-compose exec drupal bash -c - 'vendor/bin/drush site:install minimal + 'drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="Drupal Example Site for Kubernetes" --existing-config diff --git a/Dockerfile b/Dockerfile index a765804..fdf5ab1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,11 @@ COPY load.environment.php /var/www/html/load.environment.php COPY pidramble.settings.php /var/www/html/web/sites/default/settings.php RUN chown -R www-data:www-data /var/www/html/web +# Add Drush Launcher. +RUN curl -OL https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar \ + && chmod +x drush.phar \ + && mv drush.phar /usr/local/bin/drush + # Adjust the Apache docroot. ENV APACHE_DOCUMENT_ROOT=/var/www/html/web diff --git a/README.md b/README.md index 2292837..437df0a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Please read through the [project documentation](docs/README.md) for details abou docker-compose exec drupal composer install # Install Drupal. - docker-compose exec drupal bash -c 'vendor/bin/drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="Drupal Example Site for Kubernetes" --existing-config -y' + docker-compose exec drupal bash -c 'drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="Drupal Example Site for Kubernetes" --existing-config -y' ``` 1. Visit http://localhost/ in your browser, and login as `admin` using the password Drush printed in the 'Installation complete' message. @@ -44,7 +44,7 @@ Please read through the [project documentation](docs/README.md) for details abou 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' + docker-compose exec drupal bash -c '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](docs/README.md). diff --git a/docs/add-custom-theme.md b/docs/add-custom-theme.md index 8d9942f..d657831 100644 --- a/docs/add-custom-theme.md +++ b/docs/add-custom-theme.md @@ -22,7 +22,7 @@ However, you need to remember to _export the site's configuration_ now, so the t 1. Run the command: ``` - docker-compose exec drupal bash -c 'vendor/bin/drush config:export -y' + docker-compose exec drupal bash -c 'drush config:export -y' ``` 1. Commit the changed configuration to Git: diff --git a/docs/configure-and-reproduce.md b/docs/configure-and-reproduce.md index 3fd91fd..b4400ac 100644 --- a/docs/configure-and-reproduce.md +++ b/docs/configure-and-reproduce.md @@ -46,7 +46,7 @@ So let's do something I do for all my Drupal sites: install the [Admin Toolbar]( 1. Now run the following command to tell Drupal to dump its current configuration into your 'config sync' directory (which happens to be configured in `[project root]/config/sync` by default): ``` - docker-compose exec drupal bash -c 'vendor/bin/drush config:export -y' + docker-compose exec drupal bash -c 'drush config:export -y' ``` 1. If you look inside the `config/sync` folder you should now see lots of YAML files (ending with `.yml`), containing all the details of your Drupal site's configuration. @@ -54,7 +54,7 @@ So let's do something I do for all my Drupal sites: install the [Admin Toolbar]( 1. You can now _reinstall_ the site from scratch, but using the configuration you previously exported (so it will have the Admin Toolbar module and everything else, but not this silly slogan you don't like), by adding the flag `--existing-config` to the install command: ``` - docker-compose exec drupal bash -c 'vendor/bin/drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="My Drupal Site" --existing-config -y' + docker-compose exec drupal bash -c 'drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="My Drupal Site" --existing-config -y' ``` 1. A minute or so later, if you log into the site using the `admin` user and the new password Drush prints to the command line, you'll see that the Slogan was reverted to being blank, as it was before you changed it. diff --git a/docs/create-default-content.md b/docs/create-default-content.md index 045b6b0..1889fc4 100644 --- a/docs/create-default-content.md +++ b/docs/create-default-content.md @@ -49,7 +49,7 @@ Anyways, let's get started with Default Content: 1. Once you're satisfied things worked correctly, go ahead and export the site configuration so the Default Content module and your site's default content module are enabled: ``` - docker-compose exec drupal bash -c 'vendor/bin/drush config:export -y' + docker-compose exec drupal bash -c 'drush config:export -y' ``` 1. Reinstall Drupal from scratch, and you _should_ see that not only is the Drupal site back the same way you had configured it, there are also entities that are recreated after an install which should be helpful for local development and theming. diff --git a/docs/deploy-drupal-kubernetes.md b/docs/deploy-drupal-kubernetes.md index f954c43..3c7d067 100644 --- a/docs/deploy-drupal-kubernetes.md +++ b/docs/deploy-drupal-kubernetes.md @@ -46,7 +46,7 @@ Once the new container image has been deployed, you can either install Drupal us export KUBECONFIG=~/.kube/config-dramble-pi DRUPAL_POD=$(kubectl get pods -n drupal -o name --no-headers=true -o custom-columns=":metadata.name" | grep drupal | head -n 1) - kubectl exec -n drupal $DRUPAL_POD -- bash -c 'vendor/bin/drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="Drupal Example Site for Kubernetes" --existing-config -y' + kubectl exec -n drupal $DRUPAL_POD -- bash -c 'drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="Drupal Example Site for Kubernetes" --existing-config -y' Drupal should then be installed, and you have your new site running in Kubernetes at http://cluster.pidramble.test/, yay! @@ -58,8 +58,8 @@ If you need to _update_ Drupal and/or the codebase, perform all the earlier step export KUBECONFIG=~/.kube/config-dramble-pi DRUPAL_POD=$(kubectl get pods -n drupal -o name --no-headers=true -o custom-columns=":metadata.name" | grep drupal | head -n 1) - kubectl exec -n drupal $DRUPAL_POD -- bash -c 'vendor/bin/drush updatedb -y' - kubectl exec -n drupal $DRUPAL_POD -- bash -c 'vendor/bin/drush config:import' - kubectl exec -n drupal $DRUPAL_POD -- bash -c 'vendor/bin/drush cache:rebuild' + kubectl exec -n drupal $DRUPAL_POD -- bash -c 'drush updatedb -y' + kubectl exec -n drupal $DRUPAL_POD -- bash -c 'drush config:import' + kubectl exec -n drupal $DRUPAL_POD -- bash -c 'drush cache:rebuild' Note that Kubernetes does not pull new container images by default unless the container's `tag` has changed. So for ongoing deployments/updates, you should probably do something like tag the image with a release version (e.g. `1.2.3`), or a Git commit hash corresponding to the site codebase's commit at the time of the deployment (e.g. `bbbb8a1`). diff --git a/docs/starting-new-project.md b/docs/starting-new-project.md index c372441..b35ed87 100644 --- a/docs/starting-new-project.md +++ b/docs/starting-new-project.md @@ -36,7 +36,7 @@ Part of the purpose of this project is to outline the exact steps required to bu 1. Once the container is running, you need to 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_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="My Drupal Site" -y' + docker-compose exec drupal bash -c 'drush site:install minimal --db-url="mysql://drupal:$DRUPAL_DATABASE_PASSWORD@$DRUPAL_DATABASE_HOST/drupal" --site-name="My Drupal Site" -y' ``` 1. Visit http://localhost/ in your browser, and login as `admin` using the password Drush printed in the 'Installation complete' message. diff --git a/web/modules/custom/pidramble_default_content/content/node/53ce7095-0338-45d6-b559-edc76808b622.json b/web/modules/custom/pidramble_default_content/content/node/53ce7095-0338-45d6-b559-edc76808b622.json index 6f958d4..304937b 100644 --- a/web/modules/custom/pidramble_default_content/content/node/53ce7095-0338-45d6-b559-edc76808b622.json +++ b/web/modules/custom/pidramble_default_content/content/node/53ce7095-0338-45d6-b559-edc76808b622.json @@ -108,7 +108,7 @@ ], "changed": [ { - "value": "2019-03-02T19:42:05+00:00", + "value": "2019-03-08T15:37:39+00:00", "lang": "en", "format": "Y-m-d\\TH:i:sP" } @@ -140,16 +140,16 @@ "path": [ { "alias": "\/about", - "pid": 20, + "pid": 21, "langcode": "en", "lang": "en" } ], "body": [ { - "value": "

The Raspberry Pi Dramble is a cluster of Raspberry Pi computers that runs Drupal 8 on Kubernetes:<\/p>\r\n\r\n

\"Raspberry<\/p>\r\n\r\n

The cluster is configured and maintained using a set of Ansible playbooks available on GitHub: Raspberry Pi Dramble<\/a>, by Jeff Geerling<\/a> (aka geerlingguy<\/a> on Drupal.org).<\/p>\r\n\r\n

Jeff Geerling is the author of Ansible for DevOps<\/a> and Ansible for Kubernetes<\/a>, and hosts the Raspberry Pi Dramble website (which you're currently viewing) on his Dramble cluster, in the basement of his home in St. Louis, MO.<\/p>\r\n\r\n

This website is a fun experiment to work within the limitations of (relatively) slow hardware, a (very) slow residential uplink, and other constraints, to build a robust and high-performance Drupal 8 website on top of Kubernetes. Or at least as robust and high-performance it can be ;)<\/p>\r\n\r\n

Why 'Dramble'?<\/h2>\r\n\r\n

Raspberries grow in bushes sometimes called 'brambles'. And traditionally, Raspberry Pi clusters have been called brambles. In this case, the bramble is running Drupal... thus it's a Dr<\/em>amble! But going even deeper still, fruits like raspberries, blackberries, and dewberries grow in what are called 'aggregates of drupel<\/em>ets<\/a>'. So even more apropos!<\/p>\r\n", + "value": "

The Raspberry Pi Dramble is a cluster of Raspberry Pi computers that runs Drupal 8 on Kubernetes:<\/p>\r\n\r\n

\"Raspberry<\/p>\r\n\r\n

The cluster is configured and maintained using a set of Ansible playbooks available on GitHub: Raspberry Pi Dramble<\/a>, by Jeff Geerling<\/a> (aka geerlingguy<\/a> on Drupal.org).<\/p>\r\n\r\n

Jeff Geerling is the author of Ansible for DevOps<\/a> and Ansible for Kubernetes<\/a>, and hosts the Raspberry Pi Dramble website (which you're currently viewing) on his Dramble cluster, in the basement of his home in St. Louis, MO.<\/p>\r\n\r\n

This website is a fun experiment to work within the limitations of (relatively) slow hardware, a (very) slow residential uplink, and other constraints, to build a robust and high-performance Drupal 8 website on top of Kubernetes. Or at least as robust and high-performance it can be ;)<\/p>\r\n\r\n

Why 'Dramble'?<\/h2>\r\n\r\n

Raspberries grow in bushes sometimes called 'brambles'. And traditionally, Raspberry Pi clusters have been called brambles. In this case, the bramble is running Drupal... thus it's a Dr<\/em>amble! But going even deeper still, fruits like raspberries, blackberries, and dewberries grow in what are called 'aggregates of drupel<\/em>ets<\/a>'. So even more apropos!<\/p>\r\n", "format": "html", - "processed": "

The Raspberry Pi Dramble is a cluster of Raspberry Pi\u00a0computers that runs Drupal 8 on Kubernetes:<\/p>\n\n

\"Raspberry<\/p>\n\n

The cluster is configured and maintained using a set of Ansible playbooks available on GitHub: Raspberry Pi Dramble<\/a>, by Jeff Geerling<\/a> (aka geerlingguy<\/a>\u00a0on Drupal.org).<\/p>\n\n

Jeff Geerling is the author of Ansible for DevOps<\/a> and Ansible for Kubernetes<\/a>, and hosts the Raspberry Pi Dramble website (which you're currently viewing)\u00a0on his Dramble cluster, in the basement of his home in St. Louis, MO.<\/p>\n\n

This website is a fun experiment to work within the limitations of (relatively) slow hardware, a (very) slow residential uplink, and other constraints, to build a robust and high-performance Drupal 8 website on top of Kubernetes. Or at least as robust and high-performance it can be ;)<\/p>\n\n

Why 'Dramble'?<\/h2>\n\n

Raspberries grow in bushes sometimes called 'brambles'. And traditionally, Raspberry Pi clusters have been called brambles. In this case, the bramble is running Drupal... thus it's a Dr<\/em>amble! But going even deeper still, fruits like raspberries, blackberries, and dewberries grow in what are called 'aggregates of drupel<\/em>ets<\/a>'. So even more apropos!<\/p>\n", + "processed": "

The Raspberry Pi Dramble is a cluster of Raspberry Pi\u00a0computers that runs Drupal 8 on Kubernetes:<\/p>\n\n

\"Raspberry<\/p>\n\n

The cluster is configured and maintained using a set of Ansible playbooks available on GitHub: Raspberry Pi Dramble<\/a>, by Jeff Geerling<\/a> (aka geerlingguy<\/a>\u00a0on Drupal.org).<\/p>\n\n

Jeff Geerling is the author of Ansible for DevOps<\/a> and Ansible for Kubernetes<\/a>, and hosts the Raspberry Pi Dramble website (which you're currently viewing)\u00a0on his Dramble cluster, in the basement of his home in St. Louis, MO.<\/p>\n\n

This website is a fun experiment to work within the limitations of (relatively) slow hardware, a (very) slow residential uplink, and other constraints, to build a robust and high-performance Drupal 8 website on top of Kubernetes. Or at least as robust and high-performance it can be ;)<\/p>\n\n

Why 'Dramble'?<\/h2>\n\n

Raspberries grow in bushes sometimes called 'brambles'. And traditionally, Raspberry Pi clusters have been called brambles. In this case, the bramble is running Drupal... thus it's a Dr<\/em>amble! But going even deeper still, fruits like raspberries, blackberries, and dewberries grow in what are called 'aggregates of drupel<\/em>ets<\/a>'. So even more apropos!<\/p>\n", "summary": "", "lang": "en" } diff --git a/web/modules/custom/pidramble_default_content/content/node/6f7c42db-82ff-4c81-9c3d-11e6baffcb98.json b/web/modules/custom/pidramble_default_content/content/node/6f7c42db-82ff-4c81-9c3d-11e6baffcb98.json index 754bebf..db55124 100644 --- a/web/modules/custom/pidramble_default_content/content/node/6f7c42db-82ff-4c81-9c3d-11e6baffcb98.json +++ b/web/modules/custom/pidramble_default_content/content/node/6f7c42db-82ff-4c81-9c3d-11e6baffcb98.json @@ -108,7 +108,7 @@ ], "changed": [ { - "value": "2019-02-15T06:21:05+00:00", + "value": "2019-03-08T15:37:25+00:00", "lang": "en", "format": "Y-m-d\\TH:i:sP" } @@ -140,16 +140,16 @@ "path": [ { "alias": "\/home", - "pid": 28, + "pid": 23, "langcode": "en", "lang": "en" } ], "body": [ { - "value": "

Everything on this site is being served from a Drupal site, running on a Kubernetes cluster of Raspberry Pi computers, in Jeff Geerling<\/a>'s basement.<\/p>\r\n\r\n

\"Raspberry<\/p>\r\n\r\n

The Raspberry Pi Dramble (pictured above) is a cluster of Raspberry Pis which has been used for many years as an instructional tool for cluster-based web hosting, highlighting aspects like:<\/p>\r\n\r\n