This repository has been archived by the owner on Mar 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update cron to be hourly. * Documentation consolidation and improvement. (#31) * Added removal of dangling volumes on `ahoy down`. (#24) * Fixed `ahoy refresh-db` command not using newly pulled DB image. (#34) * New lagoon.yml for pre/post rollout task split. (#33) * New lagoon.yml for pre/post rollout tasks * Added 'ahoy info' command. (#23) * Fixed 'ahoy run' requiring wrapping all arguments into quotes. (#25) * Fail deployment on failed docker stack in 'ahoy build'. (#22) * Added 'ahoy debug' command. (#21) * Fixed 'ahoy debug' command rebuilds DB container. * Update .version.yml
- Loading branch information
Showing
6 changed files
with
114 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Do not remove. This location may be used by deployment scripts for database and config snapshots. | ||
SNAPSHOTS=/app/web/sites/default/files/private/backups |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,82 @@ | ||
docker-compose-yaml: docker-compose.yml | ||
|
||
tasks: | ||
post-rollout: | ||
- run: | ||
name: Deploy GovCMS | ||
command: govcms-deploy | ||
service: cli | ||
|
||
environments: | ||
master: | ||
types: | ||
mariadb: mariadb-shared | ||
|
||
cronjobs: | ||
- name: drush cron | ||
schedule: "*/15 * * * *" | ||
schedule: "0 * * * *" | ||
command: 'drush cron --root=/app' | ||
service: cli | ||
|
||
# Note regarding tasks in the scaffold. | ||
# Please avoid making scripts more than one or two lines, and avoid if/else logic. | ||
# When PaaS users or the support team modify this file, it should be easy to turn things on and off. | ||
|
||
tasks: | ||
pre-rollout: | ||
- run: | ||
name: Ensure backup folder exists - not all current envs have one | ||
command: mkdir -p /app/web/sites/default/files/private/backups | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Snapshot the database and store | ||
command: if [[ "$LAGOON_ENVIRONMENT_TYPE" = "production" ]]; then drush sql:dump --root=/app --gzip --result-file=/app/web/sites/default/files/private/backups/pre-deploy-dump.sql; fi | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Snapshot the config and store | ||
command: if [[ $(drush cex --root=/app sync -y --quiet --destination "$TMP"/config; echo "$?") = 0 ]]; then tar -czf /app/web/sites/default/files/private/backups/pre-deploy-config.tar.gz "$TMP"/config --remove-files; fi | ||
service: cli | ||
shell: bash | ||
|
||
post-rollout: | ||
- run: | ||
name: Correct legacy drush alias if necessary | ||
command: sed -i "s/%%PROJECT_NAME%%/\${env.LAGOON_PROJECT}/g" /app/drush/sites/govcms.site.yml | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Ensure backup folder exists | ||
command: mkdir -p /app/web/sites/default/files/private/backups | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: If a new environment populate database from master | ||
command: drush status db-status | grep Connected || if [[ "$LAGOON_ENVIRONMENT_TYPE" != "production" ]]; then drush sql:sync @govcms.prod @self -y; fi | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Perform database updates | ||
command: drush -y updatedb | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Perform config import (uncomment to enable) | ||
command: | | ||
# drush cim -y sync && if [[ "$LAGOON_ENVIRONMENT_TYPE" != "production" ]]; then drush cim -y --partial --source=../config/dev; fi | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Perform cache rebuild | ||
command: drush -y cr | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Ensure GovCMS/Lagoon modules are enabled | ||
command: drush en -y govcms_lagoon && drush pmu -y govcms_lagoon | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Enable any non-production modules | ||
command: if [[ "$LAGOON_ENVIRONMENT_TYPE" != "production" ]]; then drush en stage_file_proxy -y; fi | ||
service: cli | ||
shell: bash | ||
- run: | ||
name: Preserve the last successful backup | ||
command: export BACKUP="/app/web/sites/default/files/private/backups/pre-deploy-dump" && mv "$BACKUP.sql.gz" "$BACKUP-last-good.sql.gz" || true | ||
service: cli | ||
shell: bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
version: 8 | ||
type: saas | ||
scaffold: 1.1.2 | ||
scaffold: 1.1.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,22 @@ | ||
# GovCMS8 Project Scaffolding | ||
# GovCMS8 SaaS Project Scaffolding | ||
|
||
## Known Issues | ||
This is a composer project which builds a Drupal 8 GovCMS **SaaS** site ready for | ||
hosting on the GovCMS platform (Lagoon). | ||
|
||
* This repository is still a Work-in-Progress, and may be subject to slight alterations | ||
**Note**: If you are a new GovCMS customer visiting this page on | ||
[Github](https://github.com/govCMS/govcms8-scaffold) | ||
you may prefer to wait for the GovCMS service desk to create your project in Gitlab. | ||
|
||
## Requirements and Preliminary Setup | ||
For testing GovCMS separately to the GovCMS platform, we recommend that you try | ||
our [PaaS scaffold](https://github.com/govCMS/govcms8-scaffold-paas) | ||
which has a more conventional Drupal 8 structure. | ||
|
||
* [Docker](https://docs.docker.com/install/) - Follow documentation at https://docs.amazee.io/local_docker_development/local_docker_development.html to configure local development environment. | ||
## Next steps | ||
|
||
* [Mac/Linux](https://docs.amazee.io/local_docker_development/pygmy.html) - Make sure you don't have anything running on port 80 on the host machine (like a web server): | ||
* [Drupal/GovCMS distribution](https://govcms.gov.au/wiki_distro) | ||
* [GovCMS Platform](https://govcms.gov.au/wiki_platform) | ||
|
||
gem install pygmy | ||
pygmy up | ||
## Customising this README | ||
|
||
* [Windows](https://docs.amazee.io/local_docker_development/windows.html): | ||
|
||
git clone https://github.com/amazeeio/amazeeio-docker-windows amazeeio-docker-windows; cd amazeeio-docker-windows | ||
docker-compose up -d; cd .. | ||
|
||
* [Ahoy (optional)](http://ahoy-cli.readthedocs.io/en/latest/#installation) - The commands are listed in `.ahoy.yml` all include their docker-compose versions for use on Windows, or on systems without Ahoy. | ||
|
||
## Project Setup | ||
|
||
1. Checkout project repo and confirm the path is in Docker's file sharing config (https://docs.docker.com/docker-for-mac/#file-sharing): | ||
|
||
Mac/Linux: git clone https://www.github.com/govcms/govcms8-scaffold.git {INSERT_PROJECT_NAME} && cd $_ | ||
Windows: git clone https://www.github.com/govcms/govcms8-scaffold.git {INSERT_PROJECT_NAME}; cd {INSERT_PROJECT_NAME} | ||
|
||
2. Build and start the containers: | ||
|
||
Mac/Linux: ahoy up | ||
Windows: docker-compose up -d | ||
|
||
3. Install GovCMS (only do this if you are building a new site - otherwise see the Databases section below): | ||
|
||
Mac/Linux: ahoy install | ||
Windows: docker-compose exec -T test drush si -y govcms | ||
|
||
4. Login to Drupal: | ||
|
||
Mac/Linux: ahoy login | ||
Windows: docker-compose exec -T test drush uli | ||
|
||
## Commands | ||
|
||
Additional commands are listed in `.ahoy.yml`, or available from the command line `ahoy -v` | ||
|
||
## Databases | ||
|
||
The GovCMS projects have been designed to be able to import a nightly copy of the latest `master` branch database in two ways: | ||
|
||
1: Using the GitLab container registry nightly backup | ||
* these instructions are for https://projects.govcms.gov.au/{org}/{project}/container_registry | ||
* copy the .env.default file to .env on your local | ||
* remove the # from in front of #MARIADB_DATA_IMAGE=gitlab-registry-production.govcms.amazee.io/{org}/{project}/mariadb-drupal-data | ||
* add a GitLab Personal Access Token with `read_registry` scope (profile/personal_access_tokens) | ||
* `docker login gitlab-registry-production.govcms.amazee.io` (and use the PAT created above as the password) | ||
* `ahoy up` (or the docker-compose equivalent) | ||
* to refresh the db with a newer version, run `ahoy up` again | ||
|
||
2: Use the backups accessible via the UI | ||
* head to https://dashboard.govcms.gov.au/backups?name={project}-master | ||
* click "Prepare download" for the most recent mysql backup you want - note that you will have to refresh the page to see when it is complete. | ||
* download that backup into your project folder. | ||
* `ahoy mysql-import` to import the dump you just saved | ||
|
||
## Development | ||
|
||
* You should create your theme(s) in folders under `/themes` | ||
* Tests specific to your site can be committed to the `/tests` folders | ||
* The files folder is not (currently) committed to GitLab. | ||
* Do not make changes to `docker-compose.yml`, `lagoon.yml`, `.gitlab-ci.yml` or the Dockerfiles under `/.docker` - these will result in your project being unable to deploy to GovCMS SaaS | ||
|
||
## Image inheritance | ||
|
||
This project is designed to provision a Drupal 8 project onto GovCMS SaaS, using the GovCMS8 distribution, and has been prepared thus | ||
|
||
1. The vanilla GovCMS8 Distribution is available at [Github Source](https://github.com/govcms/govcms8) and as [Public DockerHub images](https://hub.docker.com/r/govcms8) | ||
2. Those GovCMS8 images are then customised for Lagoon and GovCMS, and are available at [Github Source](https://github.com/govcms/govcms8lagoon) and as [Public DockerHub images](https://hub.docker.com/r/govcms8lagoon) | ||
3. Those GovCMS8lagoon images are then retrieved in this scaffold repository. | ||
|
||
## Configuration management | ||
|
||
GovCMS8 has default configuration management built in. It assumes all configuration is tracked (in `config/default`). | ||
|
||
1. Export latest configuration to `config/default`: | ||
|
||
Mac/Linux: ahoy cex | ||
Windows: docker-compose exec -T test drush cex sync | ||
|
||
2. Import any configuration changes from `config/default`: | ||
|
||
Mac/Linux: ahoy cim | ||
Windows: docker-compose exec -T test drush cim sync | ||
|
||
3. Import development environment configuration overrides: | ||
|
||
Mac/Linux: ahoy cim dev | ||
Windows: docker-compose exec -T test drush cim dev --partial | ||
|
||
|
||
*Note*: Configuration overrides are snippets of configuration that may be imported over the base configuration. These (optional) files should exist in `config/dev`. | ||
For example a development project may include a file such as `config/dev/shield.settings.yml` which provides Shield authentication configuration that would only apply to a development environment, not production. | ||
If you have cloned this project from GovCMS Gitlab, you may customise this README | ||
with specific information about your site. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters