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
42 commits
Select commit Hold shift + click to select a range
3ccfe51
Defer nightly backups, disable ASG processes during syncs and run syn…
EmlynK Jan 20, 2022
a54c09c
Added deploy.yml examples for Drupal 9 and Localgov. Updated tests (#97)
DionisioFG Mar 10, 2022
223a3b5
Adding a new SimpleSAMLphp meta role. (#100)
gregharvey Mar 31, 2022
32843d5
Allowing users to set cachetool version properly. (#102)
gregharvey Apr 13, 2022
91ea64e
Deploy ami pr 1.x (#106)
gregharvey Apr 14, 2022
371b6b9
Making the MySQL dump command for routine back-ups less aggressive. (…
gregharvey Apr 20, 2022
a9cc7ad
Fix database backups pr 1.x (#109)
gregharvey Apr 20, 2022
4c4c3ad
Fix MySQL backup deferral. (#110)
EmlynK Apr 22, 2022
029848d
Files recurse fix pr 1.x (#112)
EmlynK Apr 26, 2022
b71fa83
Improve multisite support (#115)
EmlynK Apr 29, 2022
c933dc8
Static credentials handling fix pr 1.x (#119)
EmlynK May 23, 2022
b6ea020
Making contents of deploy tar 'ownerless'. (#117)
gregharvey May 31, 2022
1c2b206
Implement file syncing (#124)
EmlynK Jun 7, 2022
1cd0ed0
Create Drupal-specific sync roles (#128)
EmlynK Jun 8, 2022
904033f
Fixing GRANT query for MySQL > 8.0. (#131)
gregharvey Jun 10, 2022
94715d8
Use IF NOT EXISTS when creating database user as that command fails i…
EmlynK Jun 13, 2022
42f12c8
Attempt to fix syncs whenever the 'dump' type is used for source or t…
EmlynK Jun 16, 2022
a9c6abf
Squashfs pr 1.x (#150)
gregharvey Jun 20, 2022
a4de771
Check deploy_code.mount_type is defined when setting facts in init ro…
EmlynK Jun 24, 2022
fe2aaf1
Make config imports during syncs optional (#157)
EmlynK Jun 28, 2022
451227d
Squashfs pr 1.x (#153)
gregharvey Jun 29, 2022
c7aae71
Add cache clears to Drupal deployments, before DB updates and stuff (…
EmlynK Aug 16, 2022
15b8daa
Avoid leaving exponentially growing sqsh files in build locations! (#…
gregharvey Sep 5, 2022
5cab4ae
Exclude sqsh file pr 1.x (#167)
gregharvey Oct 6, 2022
459faba
Removing unnecessary lines in Drupal config generation. (#169)
gregharvey Oct 7, 2022
200f590
Ensuring dump directory exists on backup step. (#172)
gregharvey Oct 10, 2022
2c74432
Allowing Drupal 7 jobs to disable cron. (#174)
gregharvey Oct 14, 2022
0385211
Suppress db revert pr 1.x (#177)
gregharvey Oct 14, 2022
86f138a
Fixing bad assumption that databases will have TCP connections. (#179)
gregharvey Nov 18, 2022
b236540
Handling the 'drush deploy' command more elegantly for Drupal 8+. (#180)
gregharvey Dec 9, 2022
58069b6
Attempt to clear the opcache during Drupal deployments. (#182)
gregharvey Dec 9, 2022
3ea0bfe
Better drush deploy support pr 1.x (#185)
gregharvey Dec 9, 2022
b835344
Cron job schedule params pr 1.x (#190)
tymofiisobchenko Dec 30, 2022
e97e852
Adding option to stop services that might interfere with a squashfs m…
gregharvey Jan 23, 2023
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
55c0d24
Merge branch 'devel' into drush_refactor-PR-devel
gregharvey Jan 24, 2023
7bc602f
Merge branch 'drush_refactor' into drush_refactor-PR-devel
gregharvey Jan 24, 2023
1f6fae4
Updating drush README.
gregharvey Jan 24, 2023
39b0870
Merge branch 'drush_refactor' into drush_refactor-PR-devel
gregharvey Jan 24, 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
4 changes: 3 additions & 1 deletion 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 Down
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-->
7 changes: 4 additions & 3 deletions docs/roles/cli/drush.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Drush
Installs the `drush` command-line tool for the deploy user.
Installs the `drush` command-line tool for the deploy user. Note, support for `drush` version 8 and below will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23).

<!--ROLEVARS-->
## Default variables
```yaml
---
drush:
# Note: This is the "default" version,
# but projects should define theirs in composer.json.
version: 8.2.2
# but projects should define theirs in composer.json or in their ce-deploy variables files.
version: 11.4.0
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
4 changes: 3 additions & 1 deletion 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 Down
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('/home/{{ deploy_user }}/.bin/drush') }}"

- name: Ensure we have Drush binary.
import_role:
Expand Down
2 changes: 1 addition & 1 deletion roles/_init/tasks/drupal8.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('/home/{{ deploy_user }}/.bin/drush') }}"

- name: Ensure we have Drush binary.
import_role:
Expand Down
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-->
7 changes: 4 additions & 3 deletions roles/cli/drush/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Drush
Installs the `drush` command-line tool for the deploy user.
Installs the `drush` command-line tool for the deploy user. Note, support for `drush` version 8 and below will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23).

<!--ROLEVARS-->
## Default variables
```yaml
---
drush:
# Note: This is the "default" version,
# but projects should define theirs in composer.json.
version: 8.2.2
# but projects should define theirs in composer.json or in their ce-deploy variables files.
version: 11.4.0
use_vendor: false
```

Expand Down
4 changes: 2 additions & 2 deletions roles/cli/drush/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
drush:
# Note: This is the "default" version,
# but projects should define theirs in composer.json.
version: 8.2.2
# but projects should define theirs in composer.json or in their ce-deploy variables files.
version: 11.4.0
use_vendor: false
Loading