Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to postgres:15 #14230

Merged
merged 2 commits into from Mar 7, 2024
Merged

Conversation

john-westcott-iv
Copy link
Member

@john-westcott-iv john-westcott-iv commented Jul 12, 2023

SUMMARY

Upgrade from using postgres 12 to postgres 15.

Postgres 15 is not able to load a postgres 12 database directly. So we have modified the docker volume name to help distinguish the two version. However, please note that docker-compose will attempt to use the old volume if the tools_postgres_1 container already exists. If this happens you will see an error in the logs like:

tools_postgres_1 | 
tools_postgres_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
tools_postgres_1 | 
tools_redis_1 | 1:M 12 Jul 2023 13:53:13.739 * monotonic clock: POSIX clock_gettime
tools_postgres_1 | 2023-07-12 13:53:13.919 UTC [1] FATAL:  database files are incompatible with server
tools_postgres_1 | 2023-07-12 13:53:13.919 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 15.3 (Debian 15.3-1.pgdg120+1).

First, remove the container with docker container rm tools_postgres_1. If you then start the containers again you will get a fresh install of AWX.

If you want to migrate your existing docker-compose development installation do the following:

  1. Start with latest current version running via make docker-compose.
  2. Run docker exec -it -u postgres tools_postgres_1 pg_dumpall --database awx -U awx > awx_dump.sql
  3. Stop your existing containers.
  4. Remove the existing tools_postgres_1 container by running docker container rm tools_postgres_1.
  5. Checkout the new version of the code.
  6. Run make docker-compose-sources to upgrade the docker-compose.yml file.
  7. Run docker-compose -f tools/docker-compose/_sources/docker-compose.yml up postgres to start up the new version of the container.
  8. Run docker cp awx_dump.sql tools_postgres_1:/tmp to copy the backup file into the new postgres container.
  9. Run docker exec -it tools_postgres_1 /usr/bin/psql -U awx -f /tmp/awx_dump.sql to restore your old data into the new postgres 15 database.
  10. Stop the container being run from docker-compose up and start the full environment with make docker-compose.

I did simple testing with the keycloak integration (which uses the postgres container) and it works fine. There did not seems to be a compatibility matrix for keycloak and postgres but I did find one doc indicating that it worked with pg 15 (but that was likely intended for the latest version 20 and we are on 15).

ISSUE TYPE
  • Breaking Change
COMPONENT NAME
  • Other
AWX VERSION

ADDITIONAL INFORMATION

@john-westcott-iv
Copy link
Member Author

Should this be considered an X version release since it can't be directly upgraded to? @shanemcd @AlanCoding et. al.

@AlanCoding
Copy link
Member

I wouldn't say that we support docker-compose upgrades to begin with.

@rooftopcellist
Copy link
Member

Agreed, and the operator deployments will work because there is migration logic built in.

rooftopcellist
rooftopcellist previously approved these changes Jul 26, 2023
@TheRealHaoLiu TheRealHaoLiu self-assigned this Aug 2, 2023
AlanCoding
AlanCoding previously approved these changes Aug 3, 2023
relrod
relrod previously approved these changes Aug 9, 2023
@relrod
Copy link
Member

relrod commented Aug 9, 2023

:shipit:

@rooftopcellist rooftopcellist changed the title Upgrade to postgres:15 Upgrade to postgres:15 [Holding for now] Aug 28, 2023
@rooftopcellist
Copy link
Member

We are holding off merging this to coordinate with other related PR's. This may be a couple of weeks. Sorry for the delay.

If anyone needs to start using pg 15 before this merges, you can modify the following variables on your spec to override the postgres images:

  • postgres_image
  • postgres_image_version

@dmzoneill dmzoneill marked this pull request as draft February 12, 2024 16:41
@dmzoneill dmzoneill dismissed stale reviews from relrod, AlanCoding, and rooftopcellist February 12, 2024 16:42

blocked

@rooftopcellist rooftopcellist changed the title Upgrade to postgres:15 [Holding for now] Upgrade to postgres:15 Mar 7, 2024
@rooftopcellist rooftopcellist marked this pull request as ready for review March 7, 2024 13:53
@rooftopcellist
Copy link
Member

This PR is ready for final review, I rebased and addressed all remaining comments.

@TheRealHaoLiu TheRealHaoLiu merged commit ee9eac1 into ansible:devel Mar 7, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants