From b05be36067ee128c35052590c9694e5e854dc6c3 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Mon, 4 Nov 2024 14:44:27 -0500 Subject: [PATCH] Update PPA configurations and playbook - enable crontab - configure cron job to reindex gale pages every first Saturday - revise gale local ocr path - remove unneeded transitional extra dependency --- inventory/group_vars/prosody/vars.yml | 11 +++++++---- inventory/group_vars/prosody_production/vars.yml | 15 +++++++++++++++ inventory/group_vars/prosody_staging/vars.yml | 3 +++ playbooks/prosody.yml | 13 ++++++++----- roles/configure_crontab/tasks/main.yml | 2 ++ 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/inventory/group_vars/prosody/vars.yml b/inventory/group_vars/prosody/vars.yml index e186d75e..a6b8edc1 100644 --- a/inventory/group_vars/prosody/vars.yml +++ b/inventory/group_vars/prosody/vars.yml @@ -43,7 +43,7 @@ marc_data_path: "{{ data_path }}/marc/" # path to EEBO TCP data eebo_data_path: "{{ data_path }}/eebo_tcp/" # path to Gale OCR data on tigerdata -gale_ocr_data_path: "{{ tigerdata_mount_dir }}/prosody/ppa-ocr/Gale" +gale_ocr_data_path: "{{ tigerdata_mount_dir }}/prosody/ppa-ocr/Gale-by-vol" technical_contact: cdhdevteam@princeton.edu # flag that csp is enabled @@ -80,8 +80,11 @@ tigerdata_enabled: true # media nfs path media_root: /mnt/nfs/cdh/prosody/media/ -# app-specific system dependencies -app_dependencies: - - libmysqlclient-dev # for mysql installation during the migration +# app-specific system dependencies - no longer needed +#app_dependencies: # common datadog configuration set in all vars datadog_app_name: cdh_prosody + +# configure scripts to run as cron jobs +crontab: [] +# currently production only diff --git a/inventory/group_vars/prosody_production/vars.yml b/inventory/group_vars/prosody_production/vars.yml index 7b974b2f..02ce6e50 100644 --- a/inventory/group_vars/prosody_production/vars.yml +++ b/inventory/group_vars/prosody_production/vars.yml @@ -13,3 +13,18 @@ deploy_contexts: - 'javascript unit tests' - 'Python unit tests' # - 'codecov/project' + +# run cron jobs on the first vm +cronjob_host: "cdh-prosody1.princeton.edu" + +# configure scripts to run as cron jobs +crontab: + # schedule monthly reindex of Gale pages to update encrypted image urls + - name: "{{ django_app }} reindex Gale pages" + # run at 2am on the first Saturday of every month + minute: 0 + hour: 2 + weekday: "SAT" + day: "1-7" + job: "bin/cron-wrapper {{ deploy }}/env/bin/python {{ deploy }}/manage.py index_pages -p 4 --gale --no-progress >> {{ logging_dir }}/cron_reindex_gale_pages.log 2>&1" + state: present diff --git a/inventory/group_vars/prosody_staging/vars.yml b/inventory/group_vars/prosody_staging/vars.yml index 69113300..c22cea38 100644 --- a/inventory/group_vars/prosody_staging/vars.yml +++ b/inventory/group_vars/prosody_staging/vars.yml @@ -19,3 +19,6 @@ zk_host: "lib-zk-staging4:2181,lib-zk-staging5:2181,lib-zk-staging6:2181/solr9" solr_url: "http://lib-solr9-staging.princeton.edu:8983/solr/" solr_server: "{{ groups['solr9_staging'][0] }}" solr_version: 9 + +# run cron jobs on the first vm +cronjob_host: "cdh-test-prosody1.princeton.edu" diff --git a/playbooks/prosody.yml b/playbooks/prosody.yml index 91597e52..7f388feb 100644 --- a/playbooks/prosody.yml +++ b/playbooks/prosody.yml @@ -31,10 +31,13 @@ - solr_collection - prosody_setup - finalize_deploy + - configure_crontab # used in production but not always in staging - close_deployment tasks: - - ansible.builtin.include_role: # datadog for logging - name: pulibrary.princeton_ansible.datadog - when: runtime_env | default('staging') == "production" - tags: - - datadog + - ansible.builtin.include_role: # timezone needed for cron jobs + name: pulibrary.princeton_ansible.timezone + - ansible.builtin.include_role: # datadog for logging + name: pulibrary.princeton_ansible.datadog + when: runtime_env | default('staging') == "production" + tags: + - datadog diff --git a/roles/configure_crontab/tasks/main.yml b/roles/configure_crontab/tasks/main.yml index ca8f92c3..e4af0ed1 100644 --- a/roles/configure_crontab/tasks/main.yml +++ b/roles/configure_crontab/tasks/main.yml @@ -1,5 +1,7 @@ - name: Configure cron jobs when: inventory_hostname == cronjob_host + tags: + - crontab block: - name: "Configure crontab — special times" cron: