AWX/Database Backup

From Omnia
< AWX
Revision as of 19:40, 14 January 2025 by Kenneth (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
AWX V19 - Backup and Restore
https://groups.google.com/g/awx-project/c/y0k1hQfI77E
1. Export Docker DB like: pg_dump --username awx awx --format=c" > ./psql_dump.sql
2. Drop AWX-Operator DB: minikube kubectl -- exec -it awx-postgres-0 -- dropdb -U awx awx ( failed here since  the db was  currently  being  used)

3. Create new DB: minikube kubectl -- exec -it awx-postgres-0 -- createdb -U awx awx
4. Restore DB: minikube kubectl -- exec -it awx-postgres-0 -- pg_restore -U awx -d awx < psql_dump.sql
AWX Backup Readme
https://github.com/ansible/awx-operator/blob/devel/roles/backup/README.md
AWX Restore Readme
https://github.com/ansible/awx-operator/blob/devel/roles/restore/README.md

---

k -n awx get all


pod/awx-awx-postgres-15-0

k -n awx exec -it awx-awx-postgres-15-0 -- /bin/bash


pg_dump -U postgres awx17 > /var/lib/pgsql/12/backups/awx17.bak_02032023


bash-5.1$ pg_dump -U postgres awx > dumb.db
bash-5.1$ pg_dump -U postgres awx --format=c > dumb2.db

https://groups.google.com/g/awx-project/c/y0k1hQfI77E

/opt/app-root/src

# k -n awx cp awx_psql_dump.sql awx-awx-postgres-15-0:/opt/app-root/src/
k -n awx cp awx_psql_dump.sql awx-awx-postgres-15-0:/opt/app-root/src/ -c postgres

dropdb -U awx awx
createdb -U awx awx
pg_restore -U awx -d awx < psql_dump.sql

createdb -U awx awx
pg_restore -U awx -d awx < awx_psql_dump.sql

--

Default AWX Configuration causes postgres invalid password · Issue #530 · ansible/awx-operator · GitHub
https://github.com/ansible/awx-operator/issues/530

If it still doesn't work and we keep getting the same error in the awx-postgres-0 log, we will connect to the database:

   # kubectl exec -it awx-postgres-0 -- psql -U awx
We change the password to the one we have specified in the previous secrets:

   # ALTER USER awx WITH PASSWORD 'yournewpass';

At this point you should be able to connect the awx pod.