Skip to content

Commit

Permalink
Simpler instruction in case of pg_upgrade failure
Browse files Browse the repository at this point in the history
There are many cases (database had bad shutdown, missing locale env)
where the manual export isn't needed, so point the admin to meta so
some easier solutions can be tried first.
  • Loading branch information
xfalcox committed May 26, 2020
1 parent a554d3d commit 416fe17
Showing 1 changed file with 2 additions and 30 deletions.
32 changes: 2 additions & 30 deletions templates/postgres.template.yml
Expand Up @@ -91,38 +91,10 @@ run:
echo -------------------------------------------------------------------------------------
echo UPGRADE OF POSTGRES FAILED
echo
echo You are going to need to export your data and import into a clean instance:
echo Please visit https://meta.discourse.org/t/postgresql-12-update/151236 for support
echo
if [ "$PG_MAJOR_OLD" = "10" ]; then
echo 'In containers/app.yml: Change "templates/postgres.template.yml" TO "templates/postgres.10.template.yml"'
echo
fi
echo Run "./launcher rebuild app" again
echo
echo When your instance is running:
echo Run "./launcher enter app"
echo "Run apt-get remove postgresql-client-10 && apt-get install postgresql-client-12"
echo Run "cd /shared/postgres_backup && sudo -u postgres pg_dump discourse > backup.db"
echo
if [ "$PG_MAJOR_OLD" = "10" ]; then
echo Undo the base_image in your container config
fi
echo Run: "./launcher stop app"
echo Run: "sudo mv /var/discourse/shared/standalone/postgres_data /var/discourse/shared/standalone/postgres_data_old"
echo Run: "./launcher rebuild app"
echo You can run "./launcher start app" to restart your app in the meanwhile
echo
echo Run: "./launcher enter app"
echo Run: "cd /shared/postgres_backup"
echo Run: "sv stop unicorn"
echo Run: "sudo -iu postgres dropdb discourse"
echo Run: "sudo -iu postgres createdb discourse"
echo Run: "sudo -iu postgres psql discourse < backup.db"
echo Run: "exit"
echo Run: "./launcher rebuild app"
exit 1
fi
Expand Down

0 comments on commit 416fe17

Please sign in to comment.