Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
282f5c0
Updating docs.
gregharvey Jan 24, 2023
0afd940
Consistent drush handling in cron.
gregharvey Jan 24, 2023
566efe9
Linting cruft and removing unimplemented drush.yml handling from D7.
gregharvey Jan 24, 2023
27b178d
Refactor drush role to support new GitHub release format.
gregharvey Jan 24, 2023
1f6fae4
Updating drush README.
gregharvey Jan 24, 2023
064278b
Casting the first part of the drush version string as an integer.
gregharvey Jan 24, 2023
2717f10
Refactoring integer handling.
gregharvey Jan 24, 2023
7d874c2
Major version string will always be a string, assuming below 8 will n…
gregharvey Jan 24, 2023
3a12d1d
Downloaded drush archive is remote, not local.
gregharvey Jan 24, 2023
8bf5096
Refactoring handling of .bin directory.
gregharvey Jan 24, 2023
af3fc46
Supporting drush-launcher.
gregharvey Jan 25, 2023
4a16a5d
Removing drush installation support for Drupal 8 and above.
gregharvey Jan 25, 2023
0a78b6b
Bad variable name in Drupal cron jobs.
gregharvey Jan 25, 2023
d171218
Fixing maintenance mode command linting and consistency.
gregharvey Jan 25, 2023
148152f
Moving chdir to args to see if it helps.
gregharvey Jan 25, 2023
4b1c4d0
Trying an actual 'cd' command inline.
gregharvey Jan 25, 2023
fb0510f
Cannot '&&' in a cmd.
gregharvey Jan 25, 2023
1351508
Trying drush's --root flag to set Drupal path.
gregharvey Jan 25, 2023
d07aaf7
With --root we do not need chdir for drush.
gregharvey Jan 25, 2023
a443581
Revert "With --root we do not need chdir for drush."
gregharvey Jan 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/_Sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Install](/install)
- [Usage](/scripts)
- [Roles](roles)
- [API call](/roles/api_call)
- [Config](/roles/cache_clear)
- [Drupal 7](/roles/cache_clear/cache_clear-drupal7)
- [Drupal 8](/roles/cache_clear/cache_clear-drupal8)
Expand Down Expand Up @@ -37,6 +38,7 @@
- [Drupal 8](/roles/_meta/deploy-drupal8)
- [Matomo](/roles/_meta/deploy-matomo)
- [Mautic](/roles/_meta/deploy-mautic)
- [SimpleSAMLphp](/roles/_meta/deploy-simplesamlphp)
- [NPM](/roles/npm)
- [Sync roles](/roles/sync)
- [Database sync](/roles/sync/database_sync)
Expand Down
6 changes: 4 additions & 2 deletions docs/roles/_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ These variables **must** be set in the `deploy/common.yml` file, at least.
---
# Common defaults. Given the "_init" role is mandatory,
# this will ensure defaults to other roles too.
# If you are using ce-provision to deploy infrastructure this must match the `user_deploy.username` variable
deploy_user: "deploy"
_mysqldump_params: "--max-allowed-packet=128M --single-transaction --skip-opt -e --quick --skip-disable-keys --skip-add-locks -C -a --add-drop-table"
drupal:
sites:
- folder: "default"
public_files: "sites/default/files"
# Drupal 8 variables
config_sync_directory: "config/sync"
config_import_command: "" # i.e. "cim"
config_import_command: "" # i.e. "cim" - set this to "deploy" and cache rebuild and db updates will be skipped
# End Drupal 8 variables
# Drupal 7 variables
revert_features_command: "" # i.e. "fra"
Expand All @@ -32,7 +34,7 @@ drupal:
mautic:
image_path: "media/images"
force_install: false

bin_directory: "/home/{{ deploy_user }}/.bin"
```

<!--ENDROLEVARS-->
9 changes: 9 additions & 0 deletions docs/roles/_meta/deploy-simplesamlphp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SimpleSAMLphp
Role for deploying single SimpleSAMLphp instances. Do not use if you are deploying SimpleSAMLphp with another application like Drupal via composer.

This role currently assumes all config is in the repository alongside composer.json and the special `SIMPLESAMLPHP_CONFIG_DIR` variable is passed in via the web server vhost to tell SimpleSAMLphp where the config is on the server. For vhost configuration in Nginx see ce-provision:

* https://github.com/codeenigma/ce-provision/blob/1.x/roles/nginx

<!--ROLEVARS-->
<!--ENDROLEVARS-->
26 changes: 26 additions & 0 deletions docs/roles/api_call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# API call

Making RESTful API calls to other platforms.

<!--TOC-->
<!--ENDTOC-->

<!--ROLEVARS-->
## Default variables
```yaml
---
api_call:
type: gitlab
base_url: https://gitlab.example.com/api/v4/
path: projects # see documentation - https://docs.gitlab.com/ee/api/
method: GET
token: "" # empty means anonymous action
token_type: trigger # options are 'trigger' or 'personal'
variables: []
status_codes:
- 200
- 201
- 202
```

<!--ENDROLEVARS-->
2 changes: 1 addition & 1 deletion docs/roles/cli/cachetool.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installs the `drush` command-line tool for the deploy user.
```yaml
---
cachetool:
version: 8.2.2
version: latest # # enter three-digit version number, e.g. "7.0.0", to install a specific version
```

<!--ENDROLEVARS-->
10 changes: 6 additions & 4 deletions docs/roles/cli/drush.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Drush
Installs the `drush` command-line tool for the deploy user.
Installs the `drush` command-line tool for the deploy user. **This only works with Drupal 7** and will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23).

For Drupal 8 and above you must install `drush` with `composer` [as described in the `drush` documentation](https://www.drush.org/latest/install/).

<!--ROLEVARS-->
## Default variables
```yaml
---
drush:
# Note: This is the "default" version,
# but projects should define theirs in composer.json.
version: 8.2.2
# Where possible always load drush in your Drupal website with composer.
version: 8.4.11
use_vendor: false
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Ensure regular local backups of MySQL databases.
cron_mysql_backup:
dumps_directory: "/home/{{ deploy_user }}/shared/{{ project_name }}_{{ build_type }}/db_backups/mysql/regular"
keep: 10
mysqldump_params: "{{ _mysqldump_params }}" # set in _init but you can override here

```

Expand Down
6 changes: 5 additions & 1 deletion docs/roles/cron/cron_drupal7.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ drupal:
cron: # These are the relevant parts for cron.
- minute: "*/{{ 10 | random(start=1) }}"
# hour: 2
# day:
# weekday:
# month:
job: cron
# disabled: true
# If the sites are being deployed to an ASG, setting defer to true will create the crontab entry on the deploy server rather than all of the app servers.
defer: false
# If defer is set to true, the Ansible target must be declared with defer_target. If using a group, include the index. For example, _ce_www_dev[0]
defer_target: ""

drush_location: "{{ drush_bin }}" # you might specify another location, e.g. "{{ deploy_path }}/vendor/bin/drush"
```

<!--ENDROLEVARS-->
Expand Down
7 changes: 5 additions & 2 deletions docs/roles/cron/cron_drupal8.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ drupal:
cron: # These are the relevant parts for cron.
- minute: "*/{{ 10 | random(start=1) }}"
# hour: 2
# day:
# weekday:
# month:
job: cron
# disabled: true
# If the sites are being deployed to an ASG, setting defer to true will create the crontab entry on the deploy server rather than all of the app servers.
defer: false
# If defer is set to true, the Ansible target must be declared with defer_target. If using a group, include the index. For example, _ce_www_dev[0]
defer_target: ""
# Drush location when installed with Composer
drush_location: "vendor/drush/drush/drush"
drush_location: "{{ drush_bin }}" # you might specify another location, e.g. "{{ deploy_path }}/vendor/bin/drush"

```

Expand Down
2 changes: 1 addition & 1 deletion docs/roles/database_backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Generate backups for each build.
database_backup:
engines:
- mysql

revert: true
```

<!--ENDROLEVARS-->
Expand Down
1 change: 1 addition & 0 deletions docs/roles/database_backup/database_backup-mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Generate MySQL backups for each build.
mysql_backup:
handling: rolling
dumps_directory: "/home/{{ deploy_user }}/shared/{{ project_name }}_{{ build_type }}/db_backups/mysql/build"
mysqldump_params: "{{ _mysqldump_params }}" # set in _init but you can override here
# Number of dumps/db to keep. Note this is independant from the build codebases.
keep: 10
# This can be one of the following:
Expand Down
37 changes: 35 additions & 2 deletions docs/roles/deploy_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ deploy_code:
# Specify any additional symlink to create, with src (target) and dest (link).
# src: can be either absolute or relative to the dest (eg. '/var/my_data', '/home/deploy/simplesaml', '../../../myconfig')
# dest: can only be relative to the root of your repository (eg. 'www/themes/myassets', 'var/cache')
# create: wether to create the target if it does not exists.
# create: whether to create the target if it does not exists.
# - src: '/home/{{ deploy_user }}//{{ project_name }}_{{ build_type }}/simplesaml'
# dest: 'vendor/simplesamlphp/simplesamlphp/config'
# - src: '/var/simplesaml/etc'
Expand All @@ -23,12 +23,45 @@ deploy_code:
templates: []
# Number of builds to keep. Note this is independant of databases/dump.
keep: 10
# Wether to sync the local deploy base to a shared destination, after successful build.
# Whether to sync the local deploy base to a shared destination, after successful build.
mount_sync: ""
# mount_sync: "/home/{{ deploy_user }}/shared/{{ project_name }}_{{ build_type }}/deploy"
# Type of file to use for sync - 'squashfs' or 'tarball'
# @see the _init role for SquashFS build dir paths
# @see the squashfs role in ce-provision which installs the special conditions required by the deploy user to use this behaviour
mount_type: "tarball"
# Path that you want to make sure has 755 permissions. Make sure to include the webroot WITHOUT the slash.
perms_fix_path: ""
# perms_fix_path: "www/sites/default"
# List of services to manipulate to free the loop device for 'squashfs' builds, post lazy umount.
# @see the squashfs role in ce-provision where special permissions for deploy user to manipulate services get granted.
services: []
# services:
# - php8.0-fpm
# What action to take against the services, 'reload' or 'stop'.
# Busy websites will require a hard stop of services to achieve the umount command.
service_action: reload
# Trigger an API call to rebuild infra after a deploy, e.g. if you need to repack an AMI.
rebuild_infra: false
# Details of API call to trigger. See api_call role.
api_call:
type: gitlab
base_url: https://gitlab.example.com/api/v4/
path: projects/1/ref/main/trigger/pipeline
method: POST
token: asdf-1234
token_type: trigger
variables: []
# example build parameters
# - "[ENV]=dev"
# - "[PLAY]=myserver.yml"
# - "[RESOURCE]=myserver-example-com"
# - "[REGION]=eu-west-1"
# - "[EXTRA_PARAMS]=--force"
status_codes:
- 200
- 201
- 202

```

Expand Down
10 changes: 10 additions & 0 deletions docs/roles/sync/database_sync/database_sync-mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Sync MySQL databases between environments.
```yaml
---
mysql_sync:
mysqldump_params: "{{ _mysqldump_params }}" # set in _init but you can override here
databases:
- source:
# Name of the database to take a dump from.
Expand All @@ -20,6 +21,13 @@ mysql_sync:
type: fixed
# For "rolling builds", so we can compute the database name.
build_id: mybuildprod
# Whether or not use to create a fresh database backup or use a nightly one.
fresh_db: true
# Location where nightly backups are kept. This must match the value set for cron_mysql_backup.dumps_directory. Below is the default.
# This var is only used when fresh_db is set to "false".
dumps_directory: "/home/{{ deploy_user }}/shared/{{ project_name }}_{{ build_type }}/db_backups/mysql/regular"
# If the source is on an ASG, provide the ASG name here. Otherwise, leave empty.
asg: ""
target:
database: "{{ project_name }}_dev"
credentials_file: "/home/{{ deploy_user }}/.mysql.creds"
Expand All @@ -30,6 +38,8 @@ mysql_sync:
type: fixed
# For "rolling builds", so we can compute the database name.
build_id: mybuilddev
# If the target is on an ASG, provide the ASG name here. Otherwise, leave empty.
asg: ""

```

Expand Down
6 changes: 4 additions & 2 deletions roles/_init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ These variables **must** be set in the `deploy/common.yml` file, at least.
---
# Common defaults. Given the "_init" role is mandatory,
# this will ensure defaults to other roles too.
# If you are using ce-provision to deploy infrastructure this must match the `user_deploy.username` variable
deploy_user: "deploy"
_mysqldump_params: "--max-allowed-packet=128M --single-transaction --skip-opt -e --quick --skip-disable-keys --skip-add-locks -C -a --add-drop-table"
drupal:
sites:
- folder: "default"
public_files: "sites/default/files"
# Drupal 8 variables
config_sync_directory: "config/sync"
config_import_command: "" # i.e. "cim"
config_import_command: "" # i.e. "cim" - set this to "deploy" and cache rebuild and db updates will be skipped
# End Drupal 8 variables
# Drupal 7 variables
revert_features_command: "" # i.e. "fra"
Expand All @@ -32,7 +34,7 @@ drupal:
mautic:
image_path: "media/images"
force_install: false

bin_directory: "/home/{{ deploy_user }}/.bin"
```

<!--ENDROLEVARS-->
1 change: 1 addition & 0 deletions roles/_init/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ drupal:
mautic:
image_path: "media/images"
force_install: false
bin_directory: "/home/{{ deploy_user }}/.bin"
2 changes: 1 addition & 1 deletion roles/_init/tasks/drupal7.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Define Drush path.
set_fact:
drush_bin: "{{ drush_bin | default('/home/{{ deploy_user }}/.bin/drush.phar') }}"
drush_bin: "{{ drush_bin | default('{{ bin_directory }}/drush.phar') }}"

- name: Ensure we have Drush binary.
import_role:
Expand Down
6 changes: 1 addition & 5 deletions roles/_init/tasks/drupal8.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
- name: Define Drush path.
set_fact:
drush_bin: "{{ drush_bin | default('/home/{{ deploy_user }}/.bin/drush.phar') }}"

- name: Ensure we have Drush binary.
import_role:
name: cli/drush
drush_bin: "{{ drush_bin | default('{{ deploy_path }}/vendor/bin/drush') }}"
17 changes: 17 additions & 0 deletions roles/api_call/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,21 @@ Making RESTful API calls to other platforms.
<!--ENDTOC-->

<!--ROLEVARS-->
## Default variables
```yaml
---
api_call:
type: gitlab
base_url: https://gitlab.example.com/api/v4/
path: projects # see documentation - https://docs.gitlab.com/ee/api/
method: GET
token: "" # empty means anonymous action
token_type: trigger # options are 'trigger' or 'personal'
variables: []
status_codes:
- 200
- 201
- 202
```

<!--ENDROLEVARS-->
2 changes: 1 addition & 1 deletion roles/cli/cachetool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installs the `drush` command-line tool for the deploy user.
```yaml
---
cachetool:
version: 8.2.2
version: latest # # enter three-digit version number, e.g. "7.0.0", to install a specific version
```

<!--ENDROLEVARS-->
10 changes: 6 additions & 4 deletions roles/cli/drush/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Drush
Installs the `drush` command-line tool for the deploy user.
Installs the `drush` command-line tool for the deploy user. **This only works with Drupal 7** and will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23).

For Drupal 8 and above you must install `drush` with `composer` [as described in the `drush` documentation](https://www.drush.org/latest/install/).

<!--ROLEVARS-->
## Default variables
```yaml
---
drush:
# Note: This is the "default" version,
# but projects should define theirs in composer.json.
version: 8.2.2
# Where possible always load drush in your Drupal website with composer.
version: 8.4.11
use_vendor: false
```

Expand Down
5 changes: 2 additions & 3 deletions roles/cli/drush/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
drush:
# Note: This is the "default" version,
# but projects should define theirs in composer.json.
version: 8.2.2
# Where possible always load drush in your Drupal website with composer.
version: 8.4.11
use_vendor: false
Loading