diff --git a/docs/_Sidebar.md b/docs/_Sidebar.md index b8c4d52e..b1f28b08 100644 --- a/docs/_Sidebar.md +++ b/docs/_Sidebar.md @@ -10,6 +10,7 @@ - [Matomo](/roles/cache_clear/cache_clear-matomo) - [Drupal 8](/roles/cache_clear/cache_clear-mautic) - [Opcache](/roles/cache_clear/cache_clear-opcache) + - [Symfony](/roles/cache_clear/cache_clear-symfony) - [ce-dev](/roles/ce_dev) - [ce-dev prebuild](/roles/ce_dev/ce_dev_prebuild) - [CLI Tools](/roles/cli) diff --git a/docs/roles/cache_clear/cache_clear-symfony.md b/docs/roles/cache_clear/cache_clear-symfony.md new file mode 100644 index 00000000..65c608f9 --- /dev/null +++ b/docs/roles/cache_clear/cache_clear-symfony.md @@ -0,0 +1,14 @@ +# Symfony +Clears the Symfony application cache. + + + + +## Default variables +```yaml +--- +cache_clear_symfony_env: prod + +``` + + diff --git a/docs/roles/cron/cron_drupal7.md b/docs/roles/cron/cron_drupal7.md index 14356d15..dd46727a 100644 --- a/docs/roles/cron/cron_drupal7.md +++ b/docs/roles/cron/cron_drupal7.md @@ -19,11 +19,14 @@ drupal: # month: job: cron # disabled: true + # mailto: "{{ drupal.cron_mailto | default('') }}" # Each cron can have it's own mailto and can be configured to use different e-mail addresses. + cron_mailto: "" # 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" + ``` diff --git a/docs/roles/cron/cron_drupal8.md b/docs/roles/cron/cron_drupal8.md index bafd49b0..7ff5f24c 100644 --- a/docs/roles/cron/cron_drupal8.md +++ b/docs/roles/cron/cron_drupal8.md @@ -19,6 +19,8 @@ drupal: # month: job: cron # disabled: true + # mailto: "{{ drupal.cron_mailto | default('') }}" # Each cron can have it's own mailto and can be configured to use different e-mail addresses. + cron_mailto: "" # 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] diff --git a/docs/roles/deploy_code.md b/docs/roles/deploy_code.md index 634dbbe5..b3860144 100644 --- a/docs/roles/deploy_code.md +++ b/docs/roles/deploy_code.md @@ -85,7 +85,15 @@ Deploying code with autoscaling clusters relies on [cloud-init](https://cloudini ## Default variables ```yaml --- +# Required for NGINX config in feature branching. +_ce_provision_data_dir: /home/deploy/ce-deploy/data + deploy_code: + # Feature branching config. + feature_branch: + enabled: false + # NGINX domains to build, see ce-provision for docs: https://github.com/codeenigma/ce-provision/blob/2.x/roles/debian/nginx/defaults/main.yml#L133 + domains: [] # 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') diff --git a/docs/roles/sync/database_sync/database_sync-mysql.md b/docs/roles/sync/database_sync/database_sync-mysql.md index ab07346d..1fd2afe8 100644 --- a/docs/roles/sync/database_sync/database_sync-mysql.md +++ b/docs/roles/sync/database_sync/database_sync-mysql.md @@ -25,8 +25,9 @@ mysql_sync: credentials_file: "/home/{{ deploy_user }}/.mysql.creds" # This can be of types: # - rolling: (database backups). In that case we'll need build parameters.@todo - # - fixed: "fixed" database name + # - fixed: "fixed" database name # currently this var means the same as "dump" # - dump: Use an existing dump. In that case, the "database" variable is the absolute file path. + # This parameter is ignored if var 'path_on_deploy_server' is defined. type: fixed # For "rolling builds", so we can compute the database name. build_id: mybuildprod @@ -37,6 +38,9 @@ mysql_sync: 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: "" + # Uncomment and specify full path if you want to use your own dump file on the deploy server (gzip compressed). + # In this case it's the only variable you need in 'database.source'. + #path_on_deploy_server: "/home/{{ deploy_user }}/compressed_database_dump.gz" target: database: "{{ project_name }}_dev" credentials_file: "/home/{{ deploy_user }}/.mysql.creds" diff --git a/roles/cache_clear/cache_clear-symfony/README.md b/roles/cache_clear/cache_clear-symfony/README.md index 8bb3fde2..65c608f9 100644 --- a/roles/cache_clear/cache_clear-symfony/README.md +++ b/roles/cache_clear/cache_clear-symfony/README.md @@ -4,4 +4,11 @@ Clears the Symfony application cache. +## Default variables +```yaml +--- +cache_clear_symfony_env: prod + +``` + diff --git a/roles/cron/cron_drupal7/README.md b/roles/cron/cron_drupal7/README.md index 14356d15..dd46727a 100644 --- a/roles/cron/cron_drupal7/README.md +++ b/roles/cron/cron_drupal7/README.md @@ -19,11 +19,14 @@ drupal: # month: job: cron # disabled: true + # mailto: "{{ drupal.cron_mailto | default('') }}" # Each cron can have it's own mailto and can be configured to use different e-mail addresses. + cron_mailto: "" # 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" + ``` diff --git a/roles/cron/cron_drupal7/defaults/main.yml b/roles/cron/cron_drupal7/defaults/main.yml index 4dc29105..636557ca 100644 --- a/roles/cron/cron_drupal7/defaults/main.yml +++ b/roles/cron/cron_drupal7/defaults/main.yml @@ -12,7 +12,7 @@ drupal: # month: job: cron # disabled: true - mailto: "{{ drupal.cron_mailto | default('') }}" + # mailto: "{{ drupal.cron_mailto | default('') }}" # Each cron can have it's own mailto and can be configured to use different e-mail addresses. cron_mailto: "" # 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 diff --git a/roles/cron/cron_drupal7/tasks/job.yml b/roles/cron/cron_drupal7/tasks/job.yml index f2eb2ff7..307c9342 100644 --- a/roles/cron/cron_drupal7/tasks/job.yml +++ b/roles/cron/cron_drupal7/tasks/job.yml @@ -1,7 +1,7 @@ --- - name: Define cron job command. ansible.builtin.set_fact: - _cron_job_command: "cd {{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }} && {{ drupal.drush_location }} {{ entry.job }}" + _cron_job_command: "cd {{ live_symlink_dest }}/{{ webroot }}/sites/{{ site.folder }} && {{ drupal.drush_location }} {{ entry.job }} > /dev/null 2>&1" - name: Define cron job command if deferred (ASG). ansible.builtin.set_fact: @@ -20,6 +20,13 @@ - drupal.defer is defined - drupal.defer +- name: Set global MAILTO for cron jobs (if defined) + community.general.cronvar: + name: MAILTO + value: "{{ drupal.cron_mailto | default(omit) }}" + state: present + when: drupal.cron_mailto is defined and drupal.cron_mailto | length > 0 + - name: Setup Drupal cron tasks on app server. ansible.builtin.cron: name: "{{ project_name }}_{{ site.folder }}_{{ build_type }}_{{ entry.job }}" @@ -28,8 +35,8 @@ day: "{{ entry.day | default(omit) }}" weekday: "{{ entry.weekday | default(omit) }}" month: "{{ entry.month | default(omit) }}" - job: "{{ _cron_job_command }}" + job: > + {% if entry.mailto is defined and entry.mailto | length > 0 %}MAILTO={{ entry.mailto }} {% endif %}{{ _cron_job_command }} state: present disabled: "{{ entry.disabled | default(omit) }}" - mailto: "{{ entry.mailto if entry.mailto is defined else omit }}" delegate_to: "{{ 'localhost' if drupal.defer else inventory_hostname }}" diff --git a/roles/cron/cron_drupal8/README.md b/roles/cron/cron_drupal8/README.md index bafd49b0..7ff5f24c 100644 --- a/roles/cron/cron_drupal8/README.md +++ b/roles/cron/cron_drupal8/README.md @@ -19,6 +19,8 @@ drupal: # month: job: cron # disabled: true + # mailto: "{{ drupal.cron_mailto | default('') }}" # Each cron can have it's own mailto and can be configured to use different e-mail addresses. + cron_mailto: "" # 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] diff --git a/roles/cron/cron_drupal8/defaults/main.yml b/roles/cron/cron_drupal8/defaults/main.yml index 4dc29105..636557ca 100644 --- a/roles/cron/cron_drupal8/defaults/main.yml +++ b/roles/cron/cron_drupal8/defaults/main.yml @@ -12,7 +12,7 @@ drupal: # month: job: cron # disabled: true - mailto: "{{ drupal.cron_mailto | default('') }}" + # mailto: "{{ drupal.cron_mailto | default('') }}" # Each cron can have it's own mailto and can be configured to use different e-mail addresses. cron_mailto: "" # 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 diff --git a/roles/cron/cron_drupal8/tasks/job.yml b/roles/cron/cron_drupal8/tasks/job.yml index 77f3c6ae..e3eeafeb 100644 --- a/roles/cron/cron_drupal8/tasks/job.yml +++ b/roles/cron/cron_drupal8/tasks/job.yml @@ -1,14 +1,9 @@ --- - name: Define cron job command. ansible.builtin.set_fact: - _cron_job_command: "cd {{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }} && {{ drupal.drush_location }} {{ entry.job }}" + _cron_job_command: "cd {{ live_symlink_dest }}/{{ webroot }}/sites/{{ site.folder }} && {{ drupal.drush_location }} {{ entry.job }} > /dev/null 2>&1" when: deploy_operation == "deploy" -- name: Revert cron job command. - ansible.builtin.set_fact: - _cron_job_command: "cd {{ previous_deploy_path }}/{{ webroot }}/sites/{{ site.folder }} && {{ drupal.drush_location }} {{ entry.job }}" - when: deploy_operation == "revert" - - name: Define cron job command if deferred (ASG). ansible.builtin.set_fact: _cron_job_command: "cd {{ _ce_deploy_base_dir }} && {{ _ce_deploy_ansible_location }} {{ drupal.defer_target }} -m shell -a \"{{ _cron_job_command }}\"" @@ -26,6 +21,13 @@ - drupal.defer is defined - drupal.defer +- name: Set global MAILTO for cron jobs (if defined) + community.general.cronvar: + name: MAILTO + value: "{{ drupal.cron_mailto | default(omit) }}" + state: present + when: drupal.cron_mailto is defined and drupal.cron_mailto | length > 0 + - name: Setup Drupal cron tasks on app server. ansible.builtin.cron: name: "{{ project_name }}_{{ site.folder }}_{{ build_type }}_{{ entry.job }}" @@ -34,8 +36,8 @@ day: "{{ entry.day | default(omit) }}" weekday: "{{ entry.weekday | default(omit) }}" month: "{{ entry.month | default(omit) }}" - job: "{{ _cron_job_command }}" + job: > + {% if entry.mailto is defined and entry.mailto | length > 0 %}MAILTO={{ entry.mailto }} {% endif %}{{ _cron_job_command }} state: present disabled: "{{ entry.disabled | default(omit) }}" - mailto: "{{ entry.mailto if entry.mailto is defined else omit }}" delegate_to: "{{ 'localhost' if drupal.defer else inventory_hostname }}" diff --git a/roles/deploy_code/README.md b/roles/deploy_code/README.md index 634dbbe5..b3860144 100644 --- a/roles/deploy_code/README.md +++ b/roles/deploy_code/README.md @@ -85,7 +85,15 @@ Deploying code with autoscaling clusters relies on [cloud-init](https://cloudini ## Default variables ```yaml --- +# Required for NGINX config in feature branching. +_ce_provision_data_dir: /home/deploy/ce-deploy/data + deploy_code: + # Feature branching config. + feature_branch: + enabled: false + # NGINX domains to build, see ce-provision for docs: https://github.com/codeenigma/ce-provision/blob/2.x/roles/debian/nginx/defaults/main.yml#L133 + domains: [] # 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') diff --git a/roles/sync/database_sync/database_sync-mysql/README.md b/roles/sync/database_sync/database_sync-mysql/README.md index ab07346d..1fd2afe8 100644 --- a/roles/sync/database_sync/database_sync-mysql/README.md +++ b/roles/sync/database_sync/database_sync-mysql/README.md @@ -25,8 +25,9 @@ mysql_sync: credentials_file: "/home/{{ deploy_user }}/.mysql.creds" # This can be of types: # - rolling: (database backups). In that case we'll need build parameters.@todo - # - fixed: "fixed" database name + # - fixed: "fixed" database name # currently this var means the same as "dump" # - dump: Use an existing dump. In that case, the "database" variable is the absolute file path. + # This parameter is ignored if var 'path_on_deploy_server' is defined. type: fixed # For "rolling builds", so we can compute the database name. build_id: mybuildprod @@ -37,6 +38,9 @@ mysql_sync: 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: "" + # Uncomment and specify full path if you want to use your own dump file on the deploy server (gzip compressed). + # In this case it's the only variable you need in 'database.source'. + #path_on_deploy_server: "/home/{{ deploy_user }}/compressed_database_dump.gz" target: database: "{{ project_name }}_dev" credentials_file: "/home/{{ deploy_user }}/.mysql.creds"