You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: doc/admin/deploy/docker-compose/upgrade.md
+20-8Lines changed: 20 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -68,11 +68,23 @@ A [multi-version upgrade](../../updates/index.md#multi-version-upgrades) is a do
68
68
69
69
To perform a multi-version upgrade on a Sourcegraph instance running on Docker compose:
70
70
71
-
1. Spin down the instance:
72
-
-`docker-compose stop`
73
-
1. Spin back up each in-use local database so that the `migrator` can access them. Any [externalized database](../../external_services/postgres.md) is already accessible from the `migrator` so no action is needed for them.
74
-
-`docker-compose up -d pgsql`
75
-
-`docker-compose up -d codeintel-db`
76
-
-`docker-compose up -d codeinsights-db`
77
-
1. Run the `migrator upgrade` command targetting the same databases as your instance. See the [command documentation](./../../how-to/manual_database_migrations.md#upgrade) for additional details. In short, the [migrator](https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/sourcegraph/deploy-sourcegraph-docker%24+file:docker-compose%5C.yaml+container_name:+migrator) is invoked with a `docker run` command using the same compose network and using environment variables indicating the instance's databases.
78
-
1. Now that the data has been prepared to run against a new version of Sourcegraph, the infrastructure can be updated. The remaining steps follow the [standard upgrade for Docker Compose](#standard-upgrades).
71
+
1. Spin down any pods that access the database. The easiest way to do this is to shut down the instance entirely:
72
+
- Run `docker-compose stop` in the directory with the `docker-compose.yaml` file.
73
+
1.**If upgrading from 3.26 or before to 3.27 or later**, the `pgsql` and `codeintel-db` databases must be upgraded from Postgres 11 to Postgres 12. If this step is not performed, then the following upgrade procedure will fail fast (and leave all existing data untouched).
74
+
- If using an external database, follow the [upgrading external PostgreSQL instances](../../postgres.md#upgrading-external-postgresql-instances) guide.
75
+
- Otherwise, perform the following steps from the [upgrading internal Postgres instances](../../postgres.md#upgrading-internal-postgresql-instances) guide:
76
+
1. It's assumed that your fork of `deploy-sourcegraph-docker` is up to date with your instance's current version. Pull the upstream changes for `v3.27.0` and resolve any git merge conflicts. We need to temporarily boot the containers defined at this specific version to rewrite existing data to the new Postgres 12 format.
77
+
1. Run `docker-compose up pgsql` to launch new Postgres 12 containers and rewrite the old Postgres 11 data. This may take a while, but streaming container logs should show progress.
78
+
1. Wait until the database container is accepting connections. Once ready, run the command `docker exec pgsql -- psql -U sg -c 'REINDEX database sg;'` to repair indexes that were silently invalidated by the previous data rewrite step. **If you skip this step**, then some data may become inaccessible under normal operation, the following steps are not guaranteed to work, and **data loss will occur**.
79
+
1. Follow the same steps for the `codeintel-db`:
80
+
- Run `docker-compose up codeintel-db` to launch Postgres 12.
81
+
- Run `docker exec codeintel-db -- pgsql -U sg -c 'REINDEX database sg;'` to reindex the database.
82
+
1. Pull the upstream changes for the target instance version and resolve any git merge conflicts. The [standard upgrade procedure](#standard-upgrades) describes this step in more detail.
83
+
1. If using local database instances, start the containers now via `docker-compose up -d pgsql codeintel-db codeinsights-db`. The following migrator command will start these containers on-demand if this step is skipped, but running them separately will make startup errors more apparent.
84
+
1. Follow the instructions on [how to run the migrator job in Docker Compose](../../how-to/manual_database_migrations.md#docker-compose) to perform the upgrade migration. For specific documentation on the `upgrade` command, see the [command documentation](../../how-to/manual_database_migrations.md#upgrade). The following specific steps are an easy way to run the upgrade command:
85
+
1. Edit the definition of the `migrator` container in the `docker-compose.yaml` so that the value of the `command` key is set to `['upgrade', '--from=<old version>', '--to=<new version>']`.
86
+
1. Run the upgrade via `docker-compose up migrator` and wait for it to complete.
87
+
1. Reset the `command` key altered in the previous steps to `['up']` so that the container initialization process will work as expected.
88
+
1. The remaining infrastructure can now be updated. The [standard upgrade procedure](#standard-upgrades) describes this step in more detail.
89
+
- Run `docker-compose pull --include-deps` to pull new images.
90
+
- Run `docker-compose up -d --remove-orphans` to start the containers of the updated instance.
Copy file name to clipboardExpand all lines: doc/admin/updates/docker_compose.md
+1-14Lines changed: 1 addition & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -11,20 +11,7 @@ This page lists the changes that are relevant for [upgrading Sourcegraph on Dock
11
11
## Multi-version upgrade procedure
12
12
13
13
1. Read our [update policy](index.md#update-policy) to learn about Sourcegraph updates.
14
-
1. For each version within the multi-version upgrade range, read the stepwise update notes on this page. For example, when upgrading from 3.20 to 3.23, update notes for the stepwise updates [3.20 -> 3.21](#3-20-1-3-21-0), [3.21 -> 3.22](#3-21-3-22), and [3.22 -> 3.23](#3-22-3-23) are relevant. Neglecting this step can cause you to [miss important upgrade notes](#if-you-wish-to-keep-existing-lsif-data) and data that required special treatment can be lost permanently.
15
-
1. Check the [update notes](#multi-version-upgrade-notes) specific to multi-version upgrades.
16
-
1. After checking the relevant update notes, refer to the [upgrade procedure](../deploy/docker-compose/upgrade.md#multi-version-upgrades) to upgrade your instance.
17
-
18
-
### Multi-version upgrade notes
19
-
20
-
Some stepwise upgrade notes have multi-version considerations.
21
-
22
-
-**Upgrades crossing 3.26 -> 3.27** will require an update to Postgres 12.
23
-
- If you are using an external database, follow the [upgrade instructions](../postgres.md#upgrading-external-postgresql-instances) prior to starting the upgrade procedure.
24
-
- If you are using the provided database containers, update the `pgsql` and `codeintel-db` images to the new version prior to starting the upgrade procedure. These images will convert postgres 9.6 data on-disk to a Postgres 12-compatible format.
25
-
-**Upgrades crossing 3.26 -> 3.27** will require a deprecation of TimescaleDB for codeinsights. This should not require special treatment from the user: the old `codeinsights-db` image is compatible with Postgres 12. This database's image should be updated with the rest of the instance after the migrator has ran successfully.
26
-
-**Upgrades crossing 3.20 -> 3.21** wil require a new `codeintel-db` database. This database should be added to the instance prior to starting the upgrade procedure.
27
-
14
+
1. Refer to the [upgrade procedure](../deploy/docker-compose/upgrade.md#multi-version-upgrades) to upgrade your instance.
28
15
29
16
<!-- GENERATE UPGRADE GUIDE ON RELEASE (release tooling uses this to add entries) -->
0 commit comments