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

Bump Postgres 12.2 to 15.x on docker-compose.yml #9641

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

atsu1125
Copy link
Contributor

@atsu1125 atsu1125 commented Jan 17, 2023

What

Bump Postgres 12.2 to 15.x on docker-compose.yml

Why

Misskey v13 requires Postgres 15.x

Additional info (optional)

Should work properly 🥴
User needs to manually update PostgreSQL.

Part 1 - Backup DB from PostgreSQL 12.2

# Shutdown app containers (keeping db online)
$ docker-compose stop web

# Create backup of misskey db to local file
$ docker-compose exec db pg_dumpall -U example-misskey-user > ~/12.2.backup

# Shutdown db container
$ docker-compose down --remove-orphans

# Move Old db volume
$ sudo mv db ~/12.2db

Part 2 - Import DB to PostgreSQL 15

# Checkout for Misskey 
$ git fetch && VERSION=$(curl -s https://api.github.com/repos/misskey-dev/misskey/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest Misskey version is $VERSION" && git checkout ${VERSION}

# Boot the new DB - PostgreSQL 15
$ docker-compose up -d db

# Import the backup
$ cat ~/12.2.backup | docker-compose exec -T db psql -U example-misskey-user -d misskey

Part 3 - Confirm import of DB has no serious errors

$ docker-compose logs db and confirm there are not any errors in the import stage. Below is a list of known errors, and their resolution.

Error 1

db_1 | ERROR: invalid input syntax for type <something>

These errors are bad and need to be investigated.

Running vacuumdb has apparently resolved these issues. Please read the optional command as an alternative to step 1.

Error 2

db_1 | LOG:  checkpoints are occurring too frequently (20 seconds apart)
db_1 | HINT:  Consider increasing the configuration parameter "max_wal_size".

These errors can be ignored.

Part 4 - Upgrade Misskey

  • Follow standard Upgrade notes.

Alternative Step 1 - Vacuum DB before backup

# Shutdown app containers (keeping db online)
$ docker-compose stop web

# Vacuum your db (untested command)
## Note: If you believe your 12.2 DB might be corrupted or experience errors with the importing stage, 
$ docker-compose exec db pg_dumpall -U example-misskey-user > ~/12.2.novacuum.backup
$ docker-compose exec db vacuumdb -U example-misskey-user --all --full --analyze --verbose 
$ docker-compose exec db pg_dumpall -U example-misskey-user > ~/12.2.backup

# Shutdown db container
$ docker-compose down --remove-orphans

@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Merging #9641 (2721b45) into develop (d456308) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop    #9641   +/-   ##
========================================
  Coverage    22.62%   22.62%           
========================================
  Files          731      731           
  Lines        68487    68487           
  Branches      2028     2028           
========================================
  Hits         15495    15495           
  Misses       52992    52992           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@syuilo syuilo merged commit 57b1fe4 into misskey-dev:develop Jan 17, 2023
@syuilo
Copy link
Member

syuilo commented Jan 17, 2023

👍

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.

None yet

2 participants