Skip to content

Bump PostgreSQL in compose.#282

Merged
SebastiaanZ merged 2 commits into
masterfrom
upgrade-postgresql-to-12
Oct 11, 2019
Merged

Bump PostgreSQL in compose.#282
SebastiaanZ merged 2 commits into
masterfrom
upgrade-postgresql-to-12

Conversation

@jchristgit
Copy link
Copy Markdown
Contributor

The commit message contains instructions to upgrade, but here it is for "doppelt hält besser" again, since GitHub nicely pasted it in here:

This might break local PostgreSQL containers with the following error:

postgres_1  | 2019-10-11 20:01:48.772 UTC [1] FATAL:  database files are incompatible with server
postgres_1  | 2019-10-11 20:01:48.772 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 11, which is not compatible with this version 12.0.

You will need to do one of the following:

- Delete the old data volume and start from scratch (simple, recommended).
  As we don't have an explicit volume configured, only the one the PostgreSQL
  image uses, this is as simple as running `docker-compose stop` followed by
  `docker-compose rm`. Afterwards, you can restart it.

- The dump & restore route. Do this if you don't want to delete your
  container data. To do this, first switch the PostgreSQL version in
  `docker-compose.yml` back to `11`, then run the following commands:

    docker-compose stop                                         # Stop all containers
    docker-compose start postgres                               # Start the database
    docker-compose exec postgres pg_dumpall -U pysite > db.sql  # Pull a SQL dump
    docker-compose stop                                         # Stop the containers again
    docker-compose rm                                           # Remove the containers

  Now, update the PostgreSQL version in `docker-compose.yml` to `12` again,
  and run the following commands:

    docker-compose up -d postgres                               # Start the database
    docker-compose exec -T postgres psql -U pysite < db.sql     # Pull in the dump
    rm db.sql                                                   # Cleanup garbage, if you want

  If you're on Windows, then I can't help you. Sorry.

See also: https://github.com/python-discord/organisation/issues/149

This might break local PostgreSQL containers with the following error:

postgres_1  | 2019-10-11 20:01:48.772 UTC [1] FATAL:  database files are incompatible with server
postgres_1  | 2019-10-11 20:01:48.772 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 11, which is not compatible with this version 12.0.

You will need to do one of the following:

- Delete the old data volume and start from scratch (simple, recommended).
  As we don't have an explicit volume configured, only the one the PostgreSQL
  image uses, this is as simple as running `docker-compose stop` followed by
  `docker-compose rm`. Afterwards, you can restart it.

- The dump & restore route. Do this if you don't want to delete your
  container data. To do this, first switch the PostgreSQL version in
  `docker-compose.yml` back to `11`, then run the following commands:

    docker-compose stop                                         # Stop all containers
    docker-compose start postgres                               # Start the database
    docker-compose exec postgres pg_dumpall -U pysite > db.sql  # Pull a SQL dump
    docker-compose stop                                         # Stop the containers again
    docker-compose rm                                           # Remove the containers

  Now, update the PostgreSQL version in `docker-compose.yml` to `12` again,
  and run the following commands:

    docker-compose up -d postgres                               # Start the database
    docker-compose exec -T postgres psql -U pysite < db.sql     # Pull in the dump
    rm db.sql                                                   # Cleanup garbage, if you want

  If you're on Windows, then I can't help you. Sorry.
@SebastiaanZ SebastiaanZ merged commit d1d0d0c into master Oct 11, 2019
@SebastiaanZ SebastiaanZ deleted the upgrade-postgresql-to-12 branch October 11, 2019 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants