pulibrary / lae-blacklight

Lae Public Catalog
2 stars 1 forks source link

Upgrade to Postgres 15 #358

Closed tpendragon closed 1 year ago

tpendragon commented 1 year ago

Update CI to use postgres 15

Staging:

  1. Turn off LAE: ansible lae_staging -a "sudo service nginx stop && sudo service lae-sneakers stop" -u pulsys
  2. Dump Database from old server to new server: ansible lib-postgres-staging1.princeton.edu -e @group_vars/all/vault.yml -m shell -a "export PGPASSWORD=\"{{vault_postgres_staging_admin_password}}\"; pg_dump -h lib-postgres-staging3 --format custom --clean lae_staging -U postgres > /tmp/lae_staging.dump" -u pulsys
  3. Provision database (on lae_postgres_15 ansible branch): ansible-playbook playbooks/lae.yml --tags postgresql
  4. Restore database: ansible lib-postgres-staging1.princeton.edu -e @group_vars/all/vault.yml -m shell -a "export PGPASSWORD=\"{{vault_postgres_staging_admin_password}}\"; pg_restore -h 127.0.0.1 -U postgres --dbname lae_staging /tmp/lae_staging.dump" -u pulsys
  5. Run this branch: https://github.com/pulibrary/princeton_ansible/pull/4272 (ansible-playbook playbooks/lae.yml --tags site_config)

Production:

  1. Turn off LAE: ansible lae_production -a "sudo service nginx stop && sudo service lae-sneakers stop" -u pulsys
  2. Dump Database from old server to new server: ansible lib-postgres-prod1.princeton.edu -e @group_vars/all/vault.yml -m shell -a "export PGPASSWORD=\"{{vault_postgres_admin_password}}\"; pg_dump -h lib-postgres-prod3 --format custom --clean lae_production -U postgres > /tmp/lae_prod.dump" -u pulsys
  3. Provision database (on lae_postgres_15 ansible branch): ansible-playbook playbooks/lae.yml --tags postgresql -e runtime_env=production
  4. Restore database: ansible lib-postgres-prod1.princeton.edu -e @group_vars/all/vault.yml -m shell -a "export PGPASSWORD=\"{{vault_postgres_admin_password}}\"; pg_restore -h 127.0.0.1 -U postgres --dbname lae_production /tmp/lae_prod.dump" -u pulsys
  5. Run this branch: https://github.com/pulibrary/princeton_ansible/pull/4272 (ansible-playbook playbooks/lae.yml --tags site_config -e runtime_env=production)
tpendragon commented 1 year ago

Note: I did this one already in staging, because I used it to test the commands above.

tpendragon commented 1 year ago

This will result in ~ 10 minutes of down time, just do it whenever.

hackartisan commented 1 year ago

to validate: enter a dbconsole

> bundle exec rails dbconsole -p => select version();

hackartisan commented 1 year ago

done