cmd/server: Postgres auto-upgrade procedure
Created by: tsenart
This change-set introduces a fully automated and self-contained Postgres upgrade procedure we can use going forward for major version Postgres upgrades.
For the upgrade procedure, user's need to mount the Docker socket when running the image so that we can use https://github.com/tianon/docker-postgres-upgrade/ for the upgrade.
TODO
-
Finish auto-upgrade code of server image (https://github.com/sourcegraph/sourcegraph/pull/2121) -
Write documentation for server image customers on how to upgrade. https://github.com/sourcegraph/sourcegraph/blob/master/doc/admin/migration/3_0.md -
Write documentation on how to upgrade for customers that run external Postgres databases. https://github.com/sourcegraph/sourcegraph/blob/master/doc/admin/external_database.md -
Write documentation on how to upgrade for customers that run Kubernetes (env vars, etc) https://github.com/sourcegraph/deploy-sourcegraph/blob/master/docs/sourcegraph-3.0.migrate.md#postgres-111 -
Update CHANGELOG -
Write test plans for upgrade procedures (server image and K8S) and have a few team-mates run through it. (https://github.com/sourcegraph/sourcegraph/issues/2179)
-
Tag 3.0.1 release when all of the above is done. Kick-off announcement.
-
Ship 3.0.1 to Dogfood (https://github.com/sourcegraph/sourcegraph/issues/2166) -
Update docs/dev documentation regarding minimum supported version (9.6) -
Downgrade Postgres in CI to our minimum supported version (9.6)
Part of #1404 (closed)
$ docker run -p 7080:7080 -p 2633:2633 --rm \
-v ~/.sourcegraph/config:/etc/sourcegraph \
-v ~/.sourcegraph/data:/var/opt/sourcegraph \
-v /var/run/docker.sock:/var/run/docker.sock \
sourcegraph/server:3.0.1
✱ Sourcegraph is upgrading its internal database. Please don't interrupt this operation.
01:35:58 postgres | 2019-02-04 01:35:58.341 UTC [77] LOG: listening on IPv4 address "127.0.0.1", port 5432
01:35:59 management-console | t=2019-02-04T01:35:59+0000 lvl=info msg="management-console: listening" addr=:2633
01:36:01 frontend |
01:36:01 frontend | ╓╦╬╬╬╦╖
01:36:01 frontend | ╬╬╬╬╬╬╬╬╬
01:36:01 frontend | ╞╬╬╬╬╬╬╬╬╬╬ ╓╦╦╦╦┐
01:36:01 frontend | ╬╬╬╬╬╬╬╬╬╬╕ ╔╪╪╪╪╪╪╪╪╕
01:36:01 frontend | ╘╬╬╬╬╬╬╬╬╬╬ ╔╪╪╪╪╪╪╪╪╪╪╪
01:36:01 frontend | ╬╬╬╬╬╬╬╬╬╬╗ ╔╪╪╪╪╪╪╪╪╪╪╪╪┘
01:36:01 frontend | ╓╦╦╖┐ ╬╬╬╬╬╬╬╬╬╬ ╔╝╪╪╪╪╪╪╪╪╪╪╪╜
01:36:01 frontend | ╬╪╪╪╪╪╪╪╪╬╗╦╖ ╠╬╬╬╬╬╬╬╬╝╪╪╪╪╪╪╪╪╪╪╪╪╜
01:36:01 frontend | ╠╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╝╝╬╬╬╬╝╪╪╪╪╪╪╪╪╪╪╪╪╜
01:36:01 frontend | └╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╩
01:36:01 frontend | ╙╩╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╖
01:36:01 frontend | └╙╩╬╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╬╦╗┐
01:36:01 frontend | ╙╜╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╗╦╖
01:36:01 frontend | ┌╬╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╬
01:36:01 frontend | ┌╗╪╪╪╪╪╪╪╪╪╪╪╪╬╬╬╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪╪
01:36:01 frontend | ┌╗╪╪╪╪╪╪╪╪╪╪╪╪╬╬╬╬╬╬╬╬╬ ╙╜╩╪╪╪╪╪╪╪╪╪╪╪╪╜
01:36:01 frontend | ┌╦╪╪╪╪╪╪╪╪╪╪╪╝╙╬╬╬╬╬╬╬╬╬╬ └╙╩╬╪╪╝╜
01:36:01 frontend | ╦╪╪╪╪╪╪╪╪╪╪╪╪┘ ╠╬╬╬╬╬╬╬╬╬╬
01:36:01 frontend | ╬╪╪╪╪╪╪╪╪╪╪╪┘ ╬╬╬╬╬╬╬╬╬╬┐
01:36:01 frontend | ╙╪╪╪╪╪╪╪╪╪╜ ╘╬╬╬╬╬╬╬╬╬╬
01:36:01 frontend | └╩╪╪╪╪╝╙ ╬╬╬╬╬╬╬╬╬╬╕
01:36:01 frontend | └╬╬╬╬╬╬╬╬╬╛
01:36:01 frontend | ╩╬╬╬╬╬╬┘
01:36:01 frontend |
01:36:01 frontend | ✱ Sourcegraph is ready at: http://127.0.0.1:7080