diff --git a/group_vars/shxco/vars.yml b/group_vars/shxco/vars.yml index 6b023597..54e71252 100644 --- a/group_vars/shxco/vars.yml +++ b/group_vars/shxco/vars.yml @@ -12,19 +12,21 @@ django_app: "{{ python_app }}" symlink: mep # wsgi file relative to deploy location wsgi_path: "{{ django_app }}/wsgi.py" -# use python 3.6 -python_version: 3.6 +# use python 3.8 +python_version: 3.8 # nodejs version -node_version: "10" +node_version: "18" # Override clone root to use deploy user home instead of root clone_root: "/home/{{ deploy_user }}/repos" # don't distinguish between qa/prod paths install_root: "/srv/www/{{ app_name }}" -# apache location -apache_app_path: "/var/www/{{ app_name }}" -# use site name instead of 'mep' for apache site config -apache_conf_name: "shakespeareandco" + +# set passenger defaults for production; override for other environments +passenger_app_root: "/var/www/{{ app_name }}" +passenger_server_name: "shakespeareandco.princeton.edu" +passenger_startup_file: "{{ app_name }}/wsgi.py" +passenger_python: "{{ passenger_app_root }}/env/bin/python" # pul deploy user deploy_user: "conan" diff --git a/group_vars/shxco_qa/vars.yml b/group_vars/shxco_qa/vars.yml index 5e909738..1e829963 100644 --- a/group_vars/shxco_qa/vars.yml +++ b/group_vars/shxco_qa/vars.yml @@ -12,6 +12,17 @@ zk_host: "lib-zk-staging1:2181,lib-zk-staging2:2181,lib-zk-staging3:2181/solr8" solr_url: "http://lib-solr8-staging.princeton.edu:8983/solr/" solr_server: "{{ groups['solr_staging'][0] }}" +# override passenger server name with qa hostname +application_url: "test-shakespeareandco.cdh.princeton.edu" + +# passenger settings +passenger_server_name: "{{ application_url }}" + + + + +# source host when replicating data/media (from ansible host inventory file) +replication_source_host: shxco_prod # configure scripts to run as cron jobs crontab: @@ -21,4 +32,4 @@ crontab: minute: 30 hour: 2 job: "bin/cron-wrapper {{ deploy }}/env/bin/python {{ deploy }}/manage.py twitterbot_100years schedule >> {{ logging_dir }}/twitterbot_100years.log 2>&1" - state: absent \ No newline at end of file + state: absent diff --git a/playbooks/replicate.yml b/playbooks/replicate.yml index 9aadf6fd..8fa87e83 100644 --- a/playbooks/replicate.yml +++ b/playbooks/replicate.yml @@ -14,7 +14,7 @@ # source hosts tasks - name: Generate database and media backups on source host - hosts: geniza_prod, cdhweb_prod, prosody_prod + hosts: geniza_prod, cdhweb_prod, prosody_prod, shxco_prod connection: ssh remote_user: pulsys # generate backups on source host @@ -48,7 +48,7 @@ - name: Restore database and media backups on target host # hosts: dev # connection: local - hosts: geniza_qa, cdhweb_qa, prosody_qa + hosts: geniza_qa, cdhweb_qa, prosody_qa, shxco_qa connection: ssh remote_user: pulsys vars: diff --git a/playbooks/shxco.yml b/playbooks/shxco.yml index 7da491a5..0ae2439e 100644 --- a/playbooks/shxco.yml +++ b/playbooks/shxco.yml @@ -18,12 +18,12 @@ name: pulibrary.princeton_ansible.timezone - build_project_repo - postgresql + - passenger - build_npm - run_webpack # dependency for collectstatic - configure_logging # logging directory must exist before running django commands - django - solr_collection - - configure_apache - finalize_deploy - configure_crontab # used in prod but not always in qa - - close_deployment \ No newline at end of file + - close_deployment diff --git a/playbooks/shxco_qa.yml b/playbooks/shxco_qa.yml index 0f858bed..fbd1c088 100644 --- a/playbooks/shxco_qa.yml +++ b/playbooks/shxco_qa.yml @@ -18,12 +18,12 @@ name: pulibrary.princeton_ansible.timezone - build_project_repo - postgresql + - passenger - build_npm - run_webpack # dependency for collectstatic - configure_logging # logging directory must exist before running django commands - django - solr_collection - - configure_apache - finalize_deploy - configure_crontab # used in prod but not always in qa - - close_deployment \ No newline at end of file + - close_deployment diff --git a/roles/passenger/tasks/main.yml b/roles/passenger/tasks/main.yml index f83b3151..9e74e502 100644 --- a/roles/passenger/tasks/main.yml +++ b/roles/passenger/tasks/main.yml @@ -53,9 +53,10 @@ - never become: true ansible.builtin.apt: - # update cache fails on bionic because postgres no longer has a release - # only update cache on newer VMs; skip updating on older vms - update_cache: "{{ ansible_distribution_version != '18.04' }}" + update_cache: true + # update cache fails on bionic because postgres no longer has a release + # only update cache on newer VMs; skip updating on older vms + when: ansible_distribution_version != "18.04" # Nginx and passenger installation. - name: Install Nginx and Passenger. diff --git a/roles/postgresql/tasks/main.yml b/roles/postgresql/tasks/main.yml index a42a9c44..f27f61f8 100644 --- a/roles/postgresql/tasks/main.yml +++ b/roles/postgresql/tasks/main.yml @@ -29,6 +29,19 @@ repo: "{{ postgres_apt_repository }}" update_cache: true state: present + when: ansible_distribution_version != '18.04' + +- name: Remove postgres repository for bionic (no longer valid) + become: true + tags: + - setup + - never + ansible.builtin.apt_repository: + repo: "{{ postgres_apt_repository }}" + update_cache: true + state: absent + when: ansible_distribution_version == '18.04' + - name: Install postgres client libraries become: true