From 46b784159a206edc24f14936c2a7a3fa11b3f081 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Fri, 31 Jan 2025 11:52:58 -0800 Subject: [PATCH 01/21] additional note --- docs/admin/deploy/docker-compose/upgrade.mdx | 1 + docs/admin/deploy/kubernetes/index.mdx | 2 ++ docs/admin/deploy/kubernetes/upgrade.mdx | 1 + 3 files changed, 4 insertions(+) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index 40adfc660..06ce62089 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -72,6 +72,7 @@ To perform a **manual** multi-version upgrade on a Sourcegraph instance running - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). 2. **Disable Connections to the Database**: + > **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). - Run the following command in the directory containing your `docker-compose.yaml` file. ```sh $ docker-compose stop && docker-compose up -d pgsql codeintel-db codeinsights-db diff --git a/docs/admin/deploy/kubernetes/index.mdx b/docs/admin/deploy/kubernetes/index.mdx index 2ac9f5a27..b2e2d2258 100644 --- a/docs/admin/deploy/kubernetes/index.mdx +++ b/docs/admin/deploy/kubernetes/index.mdx @@ -942,6 +942,8 @@ If you are upgrading to **Sourcegraph 5.1 or later**, we encourage you to perfor - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). **Step 2:** +> **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). + Scale down `deployments` and `statefulSets` that access the database, _this step prevents services from accessing the database while schema migrations are in process._ The following services must have their replicas scaled to 0: - Deployments (e.g., `kubectl scale deployment --replicas=0`) diff --git a/docs/admin/deploy/kubernetes/upgrade.mdx b/docs/admin/deploy/kubernetes/upgrade.mdx index ceb4f9bc5..fbb90b2de 100644 --- a/docs/admin/deploy/kubernetes/upgrade.mdx +++ b/docs/admin/deploy/kubernetes/upgrade.mdx @@ -133,6 +133,7 @@ To perform a **manual** multi-version upgrade on a Sourcegraph instance running - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). 2. **Disable Connections to the Database**: + > **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). - The following services must have their replicas scaled to 0: - Deployments (e.g., `kubectl scale deployment --replicas=0`) - precise-code-intel-worker From a26076803ce99684467b4fff59119b66558375d7 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 31 Jan 2025 15:28:19 -0800 Subject: [PATCH 02/21] feat: add upgrade guide for 6.0 --- .../deploy/docker-compose/upgrade-6.0.mdx | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 docs/admin/deploy/docker-compose/upgrade-6.0.mdx diff --git a/docs/admin/deploy/docker-compose/upgrade-6.0.mdx b/docs/admin/deploy/docker-compose/upgrade-6.0.mdx new file mode 100644 index 000000000..100819a6a --- /dev/null +++ b/docs/admin/deploy/docker-compose/upgrade-6.0.mdx @@ -0,0 +1,90 @@ +import { CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock' + +# Upgrade Sourcegraph on Docker Compose to v6.0 and beyond + +This document describes the process to update a Docker Compose Sourcegraph instance, specifically if you are targetting versions 6.0 and above, particularly if you are running in cluster databases from before v5.10. This document provides details on the steps required to also upgrade the Postgres containers to version 16. +If you are unfamiliar with sourcegraph versioning or releases see our [general concepts documentation](/admin/updates/). + +> ***⚠️ Attention: Always consult the [release notes](/admin/updates/docker_compose) for the versions your upgrade will pass over and end on.*** + +### Multi-version upgrades to the 6.0 release and beyond + +--- + +> **⚠️ Attention:** please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multiversion upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. + +To perform a **manual** multi-version upgrade on a Sourcegraph instance running on Docker compose follow the procedure below: + +1. **Check Upgrade Readiness**: + - Check the [upgrade notes](/admin/updates/docker_compose#docker-compose-upgrade-notes) for the version range you're passing through. + - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). + +2. **Shutdown your instance of Sourcegraph**: + - In order to upgrade the databess, we must first shut down your instance of Sourcegraph. In particular, you should be in the directory containing your `docker-compose.yaml` file. + ```sh + $ pwd + /cloned/repo/location/deploy-sourcegraph-docker/docker-compose + $ docker-compose down + ``` + +3. **Switch to the new release version**: + - Run the following command in local clone of your repository. + ```sh + $ git checkout v6.0.0 + ``` + +4. **Start up _only_ the database containers**: + - The database containers contain a self-executing, upgrade in place script that needs to be perfomed before starting up the remaining containers. + - Note that the names of the underlying images have changed in version 5.10, if you're manually changing the image references, be sure to checkout the correct version of the underlying image. This can be done by checking the official deployment repo [deploy-sourcegraph-docker](https://github.com/sourcegraph/deploy-sourcegraph-docker/) + ```sh + $ docker-compose up -d pgsql codeintel-db codeinsights-db + ``` + +5. **Run Migrator with the `upgrade` command**: + - The following procedure describes running migrator in brief, for more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#docker-compose). + > *Note: Always use the latest image version of migrator for migrator commands, except the startup command `up`* + 1. Set the migrator `image:` in your `docker-compose.yaml` to the **latest** release of `migrator`. **Example:** + - You may be able to skip this step if you're using the latest version of the migrator image, by upgrading to the latest version of Sourcegraph. + ```yaml + migrator: + container_name: migrator + image: 'index.docker.io/sourcegraph/migrator:6.0.0' + ``` + 2. Set the migrator `command:` to `upgrade` you'll need to supply a `--to=` argument. **Example:** + ```yaml + command: ['upgrade', '--from=v5.8.0', '--to=v6.0.0'] + ``` + > *Note: you may add the `--dry-run` flag to the `command:` to test things out before altering the dbs* + 3. Run migrator with `docker-compose up migrator` **Example:** + ```sh + $ ~/deploy-sourcegraph-docker/docker-compose/ docker-compose up migrator + codeintel-db is up-to-date + codeinsights-db is up-to-date + pgsql is up-to-date + Recreating migrator ... done + Attaching to migrator + migrator | ❗️ An error was returned when detecting the terminal size and capabilities: + migrator | + migrator | GetWinsize: inappropriate ioctl for device + migrator | + migrator | Execution will continue, but please report this, along with your operating + migrator | system, terminal, and any other details, to: + migrator | https://github.com/sourcegraph/sourcegraph/issues/new + migrator | + migrator | ✱ Sourcegraph migrator 6.0.0 + migrator | 👉 Migrating to v6.0 (step 1 of 2) + migrator | 👉 Running schema migrations + migrator | ✅ Schema migrations complete + migrator | 👉 Running out of band migrations [23 24] + ✅ Out of band migrations complete + migrator | 👉 Migrating to v6.0 (step 2 of 2) + migrator | 👉 Running schema migrations + migrator | ✅ Schema migrations complete + migrator | migrator exited with code 0 + ``` + +6. **Start your containers again**: + - run `docker-compose up -d` in the folder containing your `docker-compose.yaml` file. + ```sh + $ docker-compose up -d + ``` From fae5c960c975fa26e833c3a27301ec3e3de44301 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 31 Jan 2025 17:27:23 -0800 Subject: [PATCH 03/21] fix: update upgrade docs for PG16 docker-compose They should be "copy-pasteable" now. I put it in quotes because they have to paste it very specifically, but I think they are sufficiently idiot proof --- docs/admin/deploy/docker-compose/upgrade.mdx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index 06ce62089..f358b1afc 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -73,6 +73,26 @@ To perform a **manual** multi-version upgrade on a Sourcegraph instance running 2. **Disable Connections to the Database**: > **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). + - **NOTE**: Names of the images have changed with the release of Sourcegraph 5.10.0. If you are using a version prior to 5.10.0, please ensure you use the following image names going forward: + - `postgres-12` -> `postgresql-16` + - `codeintel-db` -> `postgresql-16` + - `codeinsights-db` -> `postgresql-16-codeinsights` + + - Change the `image:` in your `docker-compose.yaml` to the release of `pgsql`, `codeinsights-db`, and `codeintel-db`. **Example:** + ```yaml + pgsql: + container_name: pgsql + image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0' + ... + codeintel-db: + container_name: codeintel-db + image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0' + ... + codeinsights-db: + container_name: codeintel-db + image: 'index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0' + ``` + - Run the following command in the directory containing your `docker-compose.yaml` file. ```sh $ docker-compose stop && docker-compose up -d pgsql codeintel-db codeinsights-db From b144cc0a16888734832c782aa76b4fc451bc2997 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 31 Jan 2025 18:48:06 -0800 Subject: [PATCH 04/21] fix: add copy-paste commands for k8s upgrade --- docs/admin/deploy/kubernetes/upgrade.mdx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/admin/deploy/kubernetes/upgrade.mdx b/docs/admin/deploy/kubernetes/upgrade.mdx index fbb90b2de..e5d48604c 100644 --- a/docs/admin/deploy/kubernetes/upgrade.mdx +++ b/docs/admin/deploy/kubernetes/upgrade.mdx @@ -134,6 +134,30 @@ To perform a **manual** multi-version upgrade on a Sourcegraph instance running 2. **Disable Connections to the Database**: > **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). + - If you're using our built in Postgres containers, versions from 5.10 onwards contain update in place scripts than run if necessary. You will first have to update the `image` field in your `pgsql`, `codeintel-db` and `codeinsights-db` StatefulSets to `sourcegraph/postgresql-16:6.0.0` and `sourcegraph/codeinsights-db:6.0.0` respectively. + - **Example:** + ```yaml + # deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml + containers: + - name: codeinsights + image: index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0 + # deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml + containers: + - name: pgsql + image: index.docker.io/sourcegraph/postgresql-16:6.0.0 + # deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml + containers: + - name: pgsql + image: index.docker.io/sourcegraph/postgresql-16:6.0.0 + ``` + + - Apply specifically these changes to your cluster: + ```sh + $ kubectl apply -f deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml + ``` + + - Wait until the containers come up, and complete their migration to Postgresql 16 + - The following services must have their replicas scaled to 0: - Deployments (e.g., `kubectl scale deployment --replicas=0`) - precise-code-intel-worker From 4440ca69ee3a39e523cd503468618a816fa5cb3d Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Sun, 2 Feb 2025 20:59:14 -0800 Subject: [PATCH 05/21] docker-compose updates --- docs/admin/deploy/docker-compose/upgrade.mdx | 118 ++++++++---------- .../upgrade-postgres-12-16-builtin-dbs.mdx | 37 ++++++ docs/admin/postgres.mdx | 41 ++++-- 3 files changed, 125 insertions(+), 71 deletions(-) create mode 100644 docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index f358b1afc..c7b93abaf 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -59,91 +59,83 @@ $ docker-compose up -d --remove-orphans ### Multi-version upgrades -If you are upgrading to **Sourcegraph 5.1 or later**, we encourage you to perform an [**automatic multi-version upgrade**](/admin/updates/automatic). The following procedure has been automated, but is still applicable should errors occur in an automated upgrade. +> **⚠️ Attention:** Multiversion upgrades **require downtime**, please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multiversion upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. ---- - -> **⚠️ Attention:** please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multiversion upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. - -To perform a **manual** multi-version upgrade on a Sourcegraph instance running on Docker compose follow the procedure below: +To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrator/migrator-operations#upgrade) command on a Sourcegraph instance running on Docker compose follow the procedure below: 1. **Check Upgrade Readiness**: - Check the [upgrade notes](/admin/updates/docker_compose#docker-compose-upgrade-notes) for the version range you're passing through. - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). -2. **Disable Connections to the Database**: - > **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). - - **NOTE**: Names of the images have changed with the release of Sourcegraph 5.10.0. If you are using a version prior to 5.10.0, please ensure you use the following image names going forward: - - `postgres-12` -> `postgresql-16` - - `codeintel-db` -> `postgresql-16` - - `codeinsights-db` -> `postgresql-16-codeinsights` +2. **Pull and merge upstream changes**: + - Follow the [standard upgrade procedure](#standard-upgrades) to pull and merge upstream changes from the version you are upgrading to to your `release` branch. - - Change the `image:` in your `docker-compose.yaml` to the release of `pgsql`, `codeinsights-db`, and `codeintel-db`. **Example:** - ```yaml - pgsql: - container_name: pgsql - image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0' - ... - codeintel-db: - container_name: codeintel-db - image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0' - ... - codeinsights-db: - container_name: codeintel-db - image: 'index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0' - ``` +3. **Disable Connections to the Database**: + - Stop running containers connected to the databases and the databases: + ``` + $ docker-compose down --remove-orphans + ``` - - Run the following command in the directory containing your `docker-compose.yaml` file. - ```sh - $ docker-compose stop && docker-compose up -d pgsql codeintel-db codeinsights-db - ``` -3. **Run Migrator with the `upgrade` command**: - - The following procedure describes running migrator in brief, for more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#docker-compose). - 1. Set the migrator `image:` in your `docker-compose.yaml` to the **latest** release of `migrator`. **Example:** +4. **Run Migrator with the `upgrade` command**: + - *For more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#docker-compose).* + 1. If the migrator `image:` in your `docker-compose.yaml` wasn't updated to in the **latest** release of `migrator` in step 2 set migrator's image to the latest release. **Example:** ```yaml migrator: container_name: migrator - image: 'index.docker.io/sourcegraph/migrator:5.0.4' + image: 'index.docker.io/sourcegraph/migrator:6.0.0' ``` > *Note: Always use the latest image version of migrator for migrator commands, except the startup command `up`* 2. Set the migrator `command:` to `upgrade` you'll need to supply a `--to=` argument. **Example:** ```yaml - command: ['upgrade', '--from=v4.1.2', '--to=v4.4.0'] + command: ['upgrade', '--from=v5.9.0', '--to=v6.0.0'] ``` > *Note: you may add the `--dry-run` flag to the `command:` to test things out before altering the dbs* - 3. Run migrator with `docker-compose up migrator` **Example:** + 3. Run migrator with `docker-compose up migrator` + + - Migrator `depends_on:` will ensure that the databases are ready before attempting to run migrator. Ensuring that database entrypoint scripts are run before migrator attempts to connect to the databases. For users upgrading from a version earliar than `5.10.0` a PostrgreSQL version is required and will be performed automatically here. For more details see [Upgradeing PostgreSQL](/admin/postgresql#upgrading-postgresql). + + **Example:** ```sh $ ~/deploy-sourcegraph-docker/docker-compose/ docker-compose up migrator - codeintel-db is up-to-date - codeinsights-db is up-to-date - pgsql is up-to-date - Recreating migrator ... done + ✔ Network docker-compose_sourcegraph Create... 0.1s + ✔ Container pgsql Created 0.1s + ✔ Container codeinsights-db Created 0.1s + ✔ Container codeintel-db Created 0.1s + ! codeinsights-db The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s + ! pgsql The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s + ! codeintel-db The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s + ✔ Container migrator Created 0.0s + ! migrator The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s Attaching to migrator - migrator | ❗️ An error was returned when detecting the terminal size and capabilities: - migrator | - migrator | GetWinsize: inappropriate ioctl for device - migrator | - migrator | Execution will continue, but please report this, along with your operating - migrator | system, terminal, and any other details, to: - migrator | https://github.com/sourcegraph/sourcegraph/issues/new - migrator | - migrator | ✱ Sourcegraph migrator 4.4.0 - migrator | 👉 Migrating to v4.3 (step 1 of 2) - migrator | 👉 Running schema migrations - migrator | ✅ Schema migrations complete - migrator | 👉 Running out of band migrations [17 18] - ✅ Out of band migrations complete - migrator | 👉 Migrating to v4.4 (step 2 of 2) - migrator | 👉 Running schema migrations - migrator | ✅ Schema migrations complete - migrator | migrator exited with code 0 + migrator | ✱ Sourcegraph migrator 6.0.0 + migrator | ⚠️ Failed to check for migrator update: unexpected status code 404. Continuing... + migrator | Attempting connection to frontend... + migrator | ✅ Connection to frontend succeeded + migrator | Attempting connection to frontend... + migrator | ✅ Connection to frontend succeeded + migrator | Attempting connection to codeintel... + migrator | ✅ Connection to codeintel succeeded + migrator | Attempting connection to codeinsights... + migrator | ✅ Connection to codeinsights succeeded + migrator | 👉 Migrating to v6.0 (step 1 of 1) + migrator | 👉 Running schema migrations + migrator | ✅ Schema migrations complete + migrator exited with code 0 ``` +5. **Set Migrator to `up`** + - Set your migrator `command:` to `up` + > *Note: If you aren't upgrading to the latest release remember to set the migrator image back to the version you are upgrading to.* + **Example:** + ```yaml + migrator: + container_name: migrator + image: 'index.docker.io/sourcegraph/migrator:6.0.0@sha256:ec295eb0b743da6bf56777ca6524972267a5c442b0288095e2fe12fce38ebacc' + cpus: 0.5 + mem_limit: '500m' + command: ['up'] + ``` -4. **Pull and merge upstream changes**: - - Follow the [standard upgrade procedure](#standard-upgrades) to pull and merge upstream changes from the version you are upgrading to to your `release` branch. - - **⚠️ Attention:** *merging upstream changes should set the migrator `image:` version back to the release you are upgrading to, and the `command:` should be set back to `up`, this is necessary to start your instance again.* - -5. **Start your containers again**: +6. **Start your containers again**: - run `docker-compose up -d` in the folder containing your `docker-compose.yaml` file. ```sh $ docker-compose up -d diff --git a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx new file mode 100644 index 000000000..0b301196b --- /dev/null +++ b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx @@ -0,0 +1,37 @@ +# Upgrading Built-in PostgreSQL + +The following doc contains detailed instructions for upgrading the built-in PostgreSQL databases. Via our `postgresql-16` and `postgresql-16-codeinsights` image entrypoint script. This doc assumes an admin is attempting to upgrade to Sourcegraph `6.0.0` from an older version (usually pre `5.10.0`) using one of our "deploy" repos. For more general info see [Upgrading PostgreSQL](/admin/postgres#upgrading-postgresql). + +> WARNING: Upgrading the PostgreSQL database requires stopping your Sourcegraph deployment which will result in **downtime**. +> +> Additionally, once the upgrade process is started via the database container, interrupting the container before the upgrade is complete could result in corrupting the underlying Postgres database. **We strongly advise taking a backup before the upgrade.** + +## Docker Compose + +1. Bring down your deployments +```bash +docker-compose down --remove-orphans +``` +2. Change the `image:` in your `docker-compose.yaml` to the release of `pgsql`, `codeinsights-db`, and `codeintel-db`. Or [merge in changes](/admin/deploy/docker-compose/upgrade#standard-upgrades) from the tagged sourcegraph release you're planning to upgrade to. **Example:** +```yaml +pgsql: + container_name: pgsql + image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0' +... +codeintel-db: + container_name: codeintel-db + image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0' +... +codeinsights-db: + container_name: codeintel-db + image: 'index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0' +``` +3. Bring up your deployments +```bash +docker-compose up -d pgsql codeintel-db codeinsights-db +``` +At this point simply wait for the database containers to come up healthy. If for some reason the database containers fail to come up healthy, please check their logs and reach out to us for support at support@sourcegraph.com. + +## Kubernetes Kustomize + +## Helm \ No newline at end of file diff --git a/docs/admin/postgres.mdx b/docs/admin/postgres.mdx index 021d4ec0a..0a0bbfc38 100644 --- a/docs/admin/postgres.mdx +++ b/docs/admin/postgres.mdx @@ -6,11 +6,20 @@ Sourcegraph uses several PostgreSQL databases to support various functionality. - `codeintel-db`: provides support for lsif data and part of the code-intelligence - `codeinsights-db`: provides support for code insights data -## Version requirements +## Requirements + +### Version requirements We support Postgres 16 and above. Older versions of Sourcegraph supported 12 see our [Postgres 12 deprecation notice](/admin/postgres12_end_of_life_notice) for more details. -## Role requirements +Sourcegraph services attempting to connect to a database running Postgres 12 or less will display the following error message: +``` +"new db handle: Sourcegraph requires PostgreSQL 16+. For more information about PostgreSQL requirements and upgrade guides, visit https://sourcegraph.com/docs/admin/postgres" +``` + +See [below](#upgrading-postgresql) for more details about how to upgrade your PostgreSQL database. + +### Role requirements The user provided to Sourcegraph must have full access to the `sg` database and be able to create the following extensions: @@ -25,22 +34,38 @@ pgcrypto vector ``` -## [Configuring PostgreSQL](/admin/config/postgres-conf) +## Configuring PostgreSQL + +Sourcegraph databases come preconfigured, however admins may make custom configurations as needed. For more information see our [configuration docs](/admin/config/postgres-conf). + +## Upgrading PostgreSQL ### Upgrading Built-in PostgreSQL -Sourcegraph deployments come packaged with containers using the `postgresql-16` image for `pgsql` and `codeintel-db` deployments and `postgresql-16-codeinsights` for `codeinsights`. These images contain an entryscript which will detect and upgrade Postgres instances at version 12 (our previous images Postgres version). See the (Postgres 12 end of life notice)[/admin/prostgres12_end_of_life_notice#] for more details. +In Sourcegraph 5.10.0, we've upgraded our builtin database images to PostgreSQL 16. + +Database Image Updates: +- `postgres-12` is now `postgresql-16` +- `codeintel-db` is now `postgresql-16` +- `codeinsights-db` is now `postgresql-16-codeinsights` + +These images contain an entryscript which will detect and upgrade Postgres instances at version 12 (our previous images Postgres version) to Postgres 16. > WARNING: Upgrading the PostgreSQL database requires stopping your Sourcegraph deployment which will result in **downtime**. > -> Additionally, once the upgrade process is started via the database container, interrupting the container before the upgrade is complete could result in corrupting the underlying Postgres database. We strongly advise taking a backup before the upgrade. +> Additionally, once the upgrade process is started via the database container, interrupting the container before the upgrade is complete could result in corrupting the underlying Postgres database. **We strongly advise taking a backup before the upgrade.** + +**For instance specfic instructions on how to upgrade a builtin Postgres database via the image entrypoint script, see [our instance specific operational instructions](/admin/how-to/upgrade-postgres-12-16-builtin-dbs).** -The `PG_UPGRADE_EXTRA_ARGS` env var can be set in the built-in `postgresql-16` and `postgresql-16-codeinsights` deployments to provide extra arguments to the `pg_upgrade` command. +### Upgrade entrypoint script options -Setting the env var `PG_UPGRADE_EXTRA_ARGS=--link` provides the `--link` option to the underlying `pg_update`; creating a hard links between the old and new data directories instead of copying data. This option is faster and requires less disk space, however if the database containers are interrupted during the upgrade process there is a strong possibility of data corruption. This can still be a viable choice for users who are confident in their container scheduling and backups and would like to avoid longer downtimes. +The `PG_UPGRADE_EXTRA_ARGS` environment variable allows you to customize the `pg_upgrade` command in `postgresql-16` and `postgresql-16-codeinsights` deployments. -If not using the `--link` option, you will need enough disk space available for Postgres to make a copy of the existing data. For example, if your database is currently using 100GiB of storage, you will need an additional 100GiB free space in order for the upgrade process to succeed. +- **Quick upgrade option:** +Setting `PG_UPGRADE_EXTRA_ARGS=--link` creates hard links between old and new data directories instead of copying data. While faster and space-efficient, this method risks data corruption if containers are interrupted during upgrade. Best used when you have reliable container scheduling and solid backups. +- **Storage requirements:** +Without `--link`, you'll need double the current database size in free disk space. For example, a 100GiB database requires an additional 100GiB free space for the upgrade. ### Upgrading external PostgreSQL instances From 295292034f0c873aaf758cf4e405d75ca4b03d10 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Sun, 2 Feb 2025 21:03:59 -0800 Subject: [PATCH 06/21] docker-compose formating edits --- docs/admin/deploy/docker-compose/upgrade.mdx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index c7b93abaf..d45e78e4a 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -78,14 +78,15 @@ To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrat 4. **Run Migrator with the `upgrade` command**: - *For more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#docker-compose).* - 1. If the migrator `image:` in your `docker-compose.yaml` wasn't updated to in the **latest** release of `migrator` in step 2 set migrator's image to the latest release. **Example:** + 1. If the migrator `image:` in your `docker-compose.yaml` wasn't updated to in the **latest** release of `migrator` in step 2 set migrator's image to the latest release. + **Example:** ```yaml migrator: container_name: migrator image: 'index.docker.io/sourcegraph/migrator:6.0.0' ``` - > *Note: Always use the latest image version of migrator for migrator commands, except the startup command `up`* - 2. Set the migrator `command:` to `upgrade` you'll need to supply a `--to=` argument. **Example:** + 2. Set the migrator `command:` to `upgrade` you'll need to supply a `--to=` argument to the version you're upgrading to. + **Example:** ```yaml command: ['upgrade', '--from=v5.9.0', '--to=v6.0.0'] ``` @@ -122,7 +123,7 @@ To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrat migrator | ✅ Schema migrations complete migrator exited with code 0 ``` -5. **Set Migrator to `up`** +5. **Run Migrator with the `up` command** - Set your migrator `command:` to `up` > *Note: If you aren't upgrading to the latest release remember to set the migrator image back to the version you are upgrading to.* **Example:** From 84ee8361a0fd6707ec43b559e9a811de9893b7ab Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Mon, 3 Feb 2025 01:42:22 -0800 Subject: [PATCH 07/21] remove unneeded special case docker-compose upgrade doc --- .../deploy/docker-compose/upgrade-6.0.mdx | 90 ------------------- 1 file changed, 90 deletions(-) delete mode 100644 docs/admin/deploy/docker-compose/upgrade-6.0.mdx diff --git a/docs/admin/deploy/docker-compose/upgrade-6.0.mdx b/docs/admin/deploy/docker-compose/upgrade-6.0.mdx deleted file mode 100644 index 100819a6a..000000000 --- a/docs/admin/deploy/docker-compose/upgrade-6.0.mdx +++ /dev/null @@ -1,90 +0,0 @@ -import { CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock' - -# Upgrade Sourcegraph on Docker Compose to v6.0 and beyond - -This document describes the process to update a Docker Compose Sourcegraph instance, specifically if you are targetting versions 6.0 and above, particularly if you are running in cluster databases from before v5.10. This document provides details on the steps required to also upgrade the Postgres containers to version 16. -If you are unfamiliar with sourcegraph versioning or releases see our [general concepts documentation](/admin/updates/). - -> ***⚠️ Attention: Always consult the [release notes](/admin/updates/docker_compose) for the versions your upgrade will pass over and end on.*** - -### Multi-version upgrades to the 6.0 release and beyond - ---- - -> **⚠️ Attention:** please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multiversion upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. - -To perform a **manual** multi-version upgrade on a Sourcegraph instance running on Docker compose follow the procedure below: - -1. **Check Upgrade Readiness**: - - Check the [upgrade notes](/admin/updates/docker_compose#docker-compose-upgrade-notes) for the version range you're passing through. - - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). - -2. **Shutdown your instance of Sourcegraph**: - - In order to upgrade the databess, we must first shut down your instance of Sourcegraph. In particular, you should be in the directory containing your `docker-compose.yaml` file. - ```sh - $ pwd - /cloned/repo/location/deploy-sourcegraph-docker/docker-compose - $ docker-compose down - ``` - -3. **Switch to the new release version**: - - Run the following command in local clone of your repository. - ```sh - $ git checkout v6.0.0 - ``` - -4. **Start up _only_ the database containers**: - - The database containers contain a self-executing, upgrade in place script that needs to be perfomed before starting up the remaining containers. - - Note that the names of the underlying images have changed in version 5.10, if you're manually changing the image references, be sure to checkout the correct version of the underlying image. This can be done by checking the official deployment repo [deploy-sourcegraph-docker](https://github.com/sourcegraph/deploy-sourcegraph-docker/) - ```sh - $ docker-compose up -d pgsql codeintel-db codeinsights-db - ``` - -5. **Run Migrator with the `upgrade` command**: - - The following procedure describes running migrator in brief, for more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#docker-compose). - > *Note: Always use the latest image version of migrator for migrator commands, except the startup command `up`* - 1. Set the migrator `image:` in your `docker-compose.yaml` to the **latest** release of `migrator`. **Example:** - - You may be able to skip this step if you're using the latest version of the migrator image, by upgrading to the latest version of Sourcegraph. - ```yaml - migrator: - container_name: migrator - image: 'index.docker.io/sourcegraph/migrator:6.0.0' - ``` - 2. Set the migrator `command:` to `upgrade` you'll need to supply a `--to=` argument. **Example:** - ```yaml - command: ['upgrade', '--from=v5.8.0', '--to=v6.0.0'] - ``` - > *Note: you may add the `--dry-run` flag to the `command:` to test things out before altering the dbs* - 3. Run migrator with `docker-compose up migrator` **Example:** - ```sh - $ ~/deploy-sourcegraph-docker/docker-compose/ docker-compose up migrator - codeintel-db is up-to-date - codeinsights-db is up-to-date - pgsql is up-to-date - Recreating migrator ... done - Attaching to migrator - migrator | ❗️ An error was returned when detecting the terminal size and capabilities: - migrator | - migrator | GetWinsize: inappropriate ioctl for device - migrator | - migrator | Execution will continue, but please report this, along with your operating - migrator | system, terminal, and any other details, to: - migrator | https://github.com/sourcegraph/sourcegraph/issues/new - migrator | - migrator | ✱ Sourcegraph migrator 6.0.0 - migrator | 👉 Migrating to v6.0 (step 1 of 2) - migrator | 👉 Running schema migrations - migrator | ✅ Schema migrations complete - migrator | 👉 Running out of band migrations [23 24] - ✅ Out of band migrations complete - migrator | 👉 Migrating to v6.0 (step 2 of 2) - migrator | 👉 Running schema migrations - migrator | ✅ Schema migrations complete - migrator | migrator exited with code 0 - ``` - -6. **Start your containers again**: - - run `docker-compose up -d` in the folder containing your `docker-compose.yaml` file. - ```sh - $ docker-compose up -d - ``` From 0eb5fee32ad8837d6ae372c86bf78e29359e9b1d Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Mon, 3 Feb 2025 02:25:28 -0800 Subject: [PATCH 08/21] 6.0.0 kustomize update --- docs/admin/deploy/docker-compose/upgrade.mdx | 2 +- docs/admin/deploy/kubernetes/upgrade.mdx | 105 +++++++----------- .../upgrade-postgres-12-16-builtin-dbs.mdx | 46 +++++++- 3 files changed, 85 insertions(+), 68 deletions(-) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index d45e78e4a..909d7d137 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -77,7 +77,7 @@ To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrat ``` 4. **Run Migrator with the `upgrade` command**: - - *For more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#docker-compose).* + - *For more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#upgrade).* 1. If the migrator `image:` in your `docker-compose.yaml` wasn't updated to in the **latest** release of `migrator` in step 2 set migrator's image to the latest release. **Example:** ```yaml diff --git a/docs/admin/deploy/kubernetes/upgrade.mdx b/docs/admin/deploy/kubernetes/upgrade.mdx index e5d48604c..a2e9906fa 100644 --- a/docs/admin/deploy/kubernetes/upgrade.mdx +++ b/docs/admin/deploy/kubernetes/upgrade.mdx @@ -120,71 +120,41 @@ For example, if you use [overlays to make changes to the manifests](https://gith ## Multi-version upgrades -If you are upgrading to **Sourcegraph 5.1 or later**, we encourage you to perform an [**automatic multi-version upgrade**](/admin/updates/automatic). The following procedure has been automated, but is still applicable should errors occur in an automated upgrade. - ---- - > **⚠️ Attention:** please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multiversion upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. -To perform a **manual** multi-version upgrade on a Sourcegraph instance running on our **kubernetes** repo follow the procedure below: +To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrator/migrator-operations#upgrade) command on a Sourcegraph instance deployed with our [kustomize repo](https://github.com/sourcegraph/deploy-sourcegraph-k8s) follow the procedure below: 1. **Check Upgrade Readiness**: - Check the [upgrade notes](/admin/updates/kubernetes#kubernetes-upgrade-notes) for the version range you're passing through. - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). -2. **Disable Connections to the Database**: - > **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). - - If you're using our built in Postgres containers, versions from 5.10 onwards contain update in place scripts than run if necessary. You will first have to update the `image` field in your `pgsql`, `codeintel-db` and `codeinsights-db` StatefulSets to `sourcegraph/postgresql-16:6.0.0` and `sourcegraph/codeinsights-db:6.0.0` respectively. - - **Example:** - ```yaml - # deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml - containers: - - name: codeinsights - image: index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0 - # deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml - containers: - - name: pgsql - image: index.docker.io/sourcegraph/postgresql-16:6.0.0 - # deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml - containers: - - name: pgsql - image: index.docker.io/sourcegraph/postgresql-16:6.0.0 - ``` - - - Apply specifically these changes to your cluster: - ```sh - $ kubectl apply -f deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml - ``` +2. **Pull and merge upstream changes**: + - Follow the [standard legacy upgrade procedure](#upgrade-with-legacy-kubernetes) to pull and merge upstream changes from the version you are upgrading to to your `release` branch. - - Wait until the containers come up, and complete their migration to Postgresql 16 - - - The following services must have their replicas scaled to 0: - - Deployments (e.g., `kubectl scale deployment --replicas=0`) - - precise-code-intel-worker - - repo-updater - - searcher - - sourcegraph-frontend - - sourcegraph-frontend-internal - - symbols - - worker - - Stateful sets (e.g., `kubectl scale sts --replicas=0`): - - gitserver - - indexed-search - - *convenience command:* - ```sh - $ kubectl scale deployment precise-code-intel-worker repo-updater searcher sourcegraph-frontend sourcegraph-frontend-internal symbols worker --replicas=0 && kubectl scale sts gitserver indexed-search --replicas=0 - ``` - -3. **Run Migrator with the `upgrade` command**: - - The following procedure describes running migrator in brief, for more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#kubernetes-kustomize). - 1. In the `configure/migrator/migrator.Job.yaml` manifest ([kustomize](https://github.com/sourcegraph/deploy-sourcegraph/blob/master/configure/migrator/migrator.Job.yaml) or [legacy](https://github.com/sourcegraph/deploy-sourcegraph/blob/master/configure/migrator/migrator.Job.yaml)): +3. **Update cluster.yaml and scale down non-database deployments and replicas**: + - In your cluster kustomization file (`instances/my-sourcegraph/kustomize.yaml`), uncomment the [multi-version-upgrade util](https://github.com/sourcegraph/deploy-sourcegraph-k8s/blob/main/instances/template/kustomization.template.yaml#L155). This will scale down all non-database deployments and statefulSets replicas to 0. + ```yaml + # - ../../components/utils/uid # -- Run all Postgres database with valid users on host + - ../../components/utils/multi-version-upgrade # -- Scale down non-database pods to 0 for multi-version upgrade + # - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged + # + ``` + - Generate and apply a new cluster.yaml file. + ```sh + kubectl kustomize instances/my-sourcegraph -o cluster.yaml + kubectl apply --prune -l deploy=sourcegraph -f cluster.yaml + ``` + > Note: This step will ensure that any PostgreSQL upgrade performed as an entrypoint script will have a chance to execute before the migrator is run. For more information see [Upgradeing PostgreSQL](/admin/postgres#upgrading-postgresql). + +4. **Run Migrator with the `upgrade` command**: + - *For more detailed instructions and available command flags see our [migrator docs](/admin/updates/migrator/migrator-operations#upgrade).* + 1. In the `configure/migrator/migrator.Job.yaml` [manifest](https://github.com/sourcegraph/deploy-sourcegraph-k8s/blob/main/components/utils/migrator/resources/migrator.Job.yaml): - set the `image:` to the **latest** release of `migrator` - set the `args:` value to `upgrade`. **Example:** ```yaml - - name: migrator - image: "index.docker.io/sourcegraph/migrator:5.0.3" - args: ["upgrade", "--from=v3.41.0", "--to=v4.5.1"] + - name: migrator + image: "index.docker.io/sourcegraph/migrator:6.0.0" // here we use a later version of migrator than the version we're upgrading too. + args: ["upgrade", "--from=v5.9.0", "--to=5.11.0"] env: ``` > *Note:* @@ -193,11 +163,11 @@ To perform a **manual** multi-version upgrade on a Sourcegraph instance running 2. Run the following commands to schedule the migrator job with the upgrade command and monitor its progress: ```sh # To ensure no previous job invocations will conflict with our current invocation - kubectl delete -f configure/migrator/migrator.Job.yaml + kubectl delete job migrator # Start the migrator job - kubectl apply -f configure/migrator/migrator.Job.yaml + kubectl apply -f components/utils/migrator/resources/migrator.Job.yaml # Stream the migrator's stdout logs for progress - kubectl logs job.batch/migrator -f + kubectl logs job/migrator -f ``` **Example:** ```sh @@ -234,14 +204,19 @@ To perform a **manual** multi-version upgrade on a Sourcegraph instance running migrator 1/1 9s 35s ``` -4. **Pull and merge upstream changes**: - - Follow the [standard legacy upgrade procedure](#upgrade-with-legacy-kubernetes) to pull and merge upstream changes from the version you are upgrading to to your `release` branch. - -5. **Scale your replicas back up and apply new manifests**: - - The [legacy kubernetes upgrade procedure](#upgrade-with-legacy-kubernetes) describes this step in more detail. - - Ensure that the replica counts adjusted in the previous steps are turned back up. - - Run `./kubectl-apply-all.sh` to deploy the new pods to the Kubernetes cluster. - - Monitor the status of the deployment via `kubectl get pods -o wide --watch`. +5. **Generate and apply a new cluster.yaml file**: + - Comment out the [multi-version-upgrade util](https://github.com/sourcegraph/deploy-sourcegraph-k8s/blob/main/instances/template/kustomization.template.yaml#L155) in your cluster kustomization file (`instances/my-sourcegraph/kustomize.yaml`). + ```yaml + # - ../../components/utils/uid # -- Run all Postgres database with valid users on host + # - ../../components/utils/multi-version-upgrade # -- Scale down non-database pods to 0 for multi-version upgrade + # - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged + ``` + - Generate and apply a new cluster.yaml with the new images from Step 2. + ```sh + kubectl kustomize instances/my-sourcegraph -o cluster.yaml + kubectl apply --prune -l deploy=sourcegraph -f cluster.yaml + ``` + Your instance should now be up and running in the new version! --- diff --git a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx index 0b301196b..46d9261de 100644 --- a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx +++ b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx @@ -8,7 +8,7 @@ The following doc contains detailed instructions for upgrading the built-in Post ## Docker Compose -1. Bring down your deployments +1. **Bring down your containers** ```bash docker-compose down --remove-orphans ``` @@ -30,8 +30,50 @@ codeinsights-db: ```bash docker-compose up -d pgsql codeintel-db codeinsights-db ``` -At this point simply wait for the database containers to come up healthy. If for some reason the database containers fail to come up healthy, please check their logs and reach out to us for support at support@sourcegraph.com. +Wait for the database containers to come up healthy. If for some reason the database containers fail to come up healthy, please check their logs and reach out to us for support at support@sourcegraph.com. ## Kubernetes Kustomize +1. **Disable Connections to the Database**: + - The following services must have their replicas scaled to 0: + - Deployments (e.g., `kubectl scale deployment --replicas=0`) + - precise-code-intel-worker + - repo-updater + - searcher + - sourcegraph-frontend + - sourcegraph-frontend-internal + - symbols + - worker + - Stateful sets (e.g., `kubectl scale sts --replicas=0`): + - gitserver + - indexed-search +*convenience command:* +```sh +$ kubectl scale deployment precise-code-intel-worker repo-updater searcher sourcegraph-frontend sourcegraph-frontend-internal symbols worker --replicas=0 && kubectl scale sts gitserver indexed-search --replicas=0 +``` +2. **Update base files for the database statefulSets**: + - Update the `image` field in your `pgsql`, `codeintel-db` and `codeinsights-db` StatefulSets to `sourcegraph/postgresql-16:6.0.0` and `sourcegraph/codeinsights-db:6.0.0` respectively. + **Example:** + ```yaml + # deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml + containers: + - name: codeinsights + image: index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0 + # deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml + containers: + - name: pgsql + image: index.docker.io/sourcegraph/postgresql-16:6.0.0 + # deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml + containers: + - name: pgsql + image: index.docker.io/sourcegraph/postgresql-16:6.0.0 + ``` + +3. Apply the new container images to the database statefulsets: +```sh +$ kubectl apply -f deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml +``` +- Wait until the containers come up, and complete their migration to Postgresql 16 + + ## Helm \ No newline at end of file From bc25b93f40ccb08508ab8d156f9d5bf0b3019951 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Mon, 3 Feb 2025 02:27:18 -0800 Subject: [PATCH 09/21] slight edit to kustomize doc --- docs/admin/deploy/kubernetes/upgrade.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/admin/deploy/kubernetes/upgrade.mdx b/docs/admin/deploy/kubernetes/upgrade.mdx index a2e9906fa..24dfd4396 100644 --- a/docs/admin/deploy/kubernetes/upgrade.mdx +++ b/docs/admin/deploy/kubernetes/upgrade.mdx @@ -205,13 +205,13 @@ To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrat ``` 5. **Generate and apply a new cluster.yaml file**: - - Comment out the [multi-version-upgrade util](https://github.com/sourcegraph/deploy-sourcegraph-k8s/blob/main/instances/template/kustomization.template.yaml#L155) in your cluster kustomization file (`instances/my-sourcegraph/kustomize.yaml`). + 1. Comment out the [multi-version-upgrade util](https://github.com/sourcegraph/deploy-sourcegraph-k8s/blob/main/instances/template/kustomization.template.yaml#L155) in your cluster kustomization file (`instances/my-sourcegraph/kustomize.yaml`). ```yaml # - ../../components/utils/uid # -- Run all Postgres database with valid users on host # - ../../components/utils/multi-version-upgrade # -- Scale down non-database pods to 0 for multi-version upgrade # - ../../components/utils/migrate-to-nonprivileged # -- Component for migrating from privileged to non-privileged ``` - - Generate and apply a new cluster.yaml with the new images from Step 2. + 2. Generate and apply a new cluster.yaml with the new images from Step 2. ```sh kubectl kustomize instances/my-sourcegraph -o cluster.yaml kubectl apply --prune -l deploy=sourcegraph -f cluster.yaml From 7897d101001fe76910141ef20d6113075df74214 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Mon, 3 Feb 2025 13:57:34 -0800 Subject: [PATCH 10/21] Update docs/admin/deploy/docker-compose/upgrade.mdx Co-authored-by: Maedah Batool --- docs/admin/deploy/docker-compose/upgrade.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index 909d7d137..56306989d 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -59,7 +59,7 @@ $ docker-compose up -d --remove-orphans ### Multi-version upgrades -> **⚠️ Attention:** Multiversion upgrades **require downtime**, please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multiversion upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. +> Multiversion upgrades **require downtime**, please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multiversion upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrator/migrator-operations#upgrade) command on a Sourcegraph instance running on Docker compose follow the procedure below: From 4d992b2c9029b928a08c1ef9e4aa929dd183e9e5 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Mon, 3 Feb 2025 13:57:40 -0800 Subject: [PATCH 11/21] Update docs/admin/deploy/kubernetes/index.mdx Co-authored-by: Maedah Batool --- docs/admin/deploy/kubernetes/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/deploy/kubernetes/index.mdx b/docs/admin/deploy/kubernetes/index.mdx index b2e2d2258..028aede9d 100644 --- a/docs/admin/deploy/kubernetes/index.mdx +++ b/docs/admin/deploy/kubernetes/index.mdx @@ -942,7 +942,7 @@ If you are upgrading to **Sourcegraph 5.1 or later**, we encourage you to perfor - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). **Step 2:** -> **⚠️ Attention:** If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). +> If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). Scale down `deployments` and `statefulSets` that access the database, _this step prevents services from accessing the database while schema migrations are in process._ The following services must have their replicas scaled to 0: From 6f51f570ccdc2df59d5d3ee660b1667cb676f257 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Mon, 3 Feb 2025 16:02:49 -0800 Subject: [PATCH 12/21] helm special notes and edits --- docs/admin/deploy/docker-compose/upgrade.mdx | 2 +- docs/admin/deploy/kubernetes/index.mdx | 6 +----- .../how-to/upgrade-postgres-12-16-builtin-dbs.mdx | 10 +++++++++- docs/admin/updates/kubernetes.mdx | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index 56306989d..087f0d827 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -4,7 +4,7 @@ import { CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock' This document describes the process to update a Docker Compose Sourcegraph instance. If you are unfamiliar with sourcegraph versioning or releases see our [general concepts documentation](/admin/updates/). -> ***⚠️ Attention: Always consult the [release notes](/admin/updates/docker_compose) for the versions your upgrade will pass over and end on.*** +> Always consult the [release notes](/admin/updates/docker_compose) for the versions your upgrade will pass over and end on. ### Standard upgrades diff --git a/docs/admin/deploy/kubernetes/index.mdx b/docs/admin/deploy/kubernetes/index.mdx index 028aede9d..0c8459f1f 100644 --- a/docs/admin/deploy/kubernetes/index.mdx +++ b/docs/admin/deploy/kubernetes/index.mdx @@ -928,10 +928,6 @@ When all pods have restarted and show as Running, you can browse to your Sourceg ### Multi-version upgrades -If you are upgrading to **Sourcegraph 5.1 or later**, we encourage you to perform an [**automatic multi-version upgrade**](/admin/updates/automatic). The following instructions are still applicable, just the manual version of what automatic multi-version upgrade do for you now (and therefore is valuable information during a bumpy upgrade). - ---- - Please see our [cautionary note](/admin/updates/#best-practices) on upgrades, if you have any concerns about running a multi-version upgrade, please reach out to us at [support@sourcegraph.com](mailto:support@sourcegraph.com) for advisement. ### Multi-version upgrade procedure @@ -942,7 +938,7 @@ If you are upgrading to **Sourcegraph 5.1 or later**, we encourage you to perfor - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). **Step 2:** -> If your database is still running Postgres 12, upgrade your database to Postgres 16 in this step. For our built-in databases offerings, this can be accomplished by starting the databases using our `postgresql-16` images packaged in the deploy repos starting in version `5.10.0`. Learn more [here](/admin/postgres). +> The Kuberentes Helm deployment type does not support MVU from Sourcegraph `v5.9.45` versions and earlier to Sourcegraph `v6.0.0`. Admins seeking to upgrade to Sourcegraph `v6.0.0` should upgrade to `v5.10.3940` or `v5.11.6271` then use the standard upgrade procedure to get to `v6.0.0`. This is because migrator v6.0.0 will no longer connect to Postgres 12 databases. For more info see our [PostgreSQL upgrade docs](/admin/postgres#requirements). Scale down `deployments` and `statefulSets` that access the database, _this step prevents services from accessing the database while schema migrations are in process._ The following services must have their replicas scaled to 0: diff --git a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx index 46d9261de..9c64d8de1 100644 --- a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx +++ b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx @@ -8,6 +8,8 @@ The following doc contains detailed instructions for upgrading the built-in Post ## Docker Compose +Docker compose supports [standard](/admin/deploy/docker-compose/upgrade#standard-upgrades) and [multi-version](/admin/deploy/docker-compose/upgrade#multi-version-upgrades) upgrades to Postgres 16 versions! However if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure. + 1. **Bring down your containers** ```bash docker-compose down --remove-orphans @@ -34,6 +36,8 @@ Wait for the database containers to come up healthy. If for some reason the data ## Kubernetes Kustomize +Kubernetes Kustomize supports [standard](/admin/deploy/kubernetes/upgrade#standard-upgrades) and [multi-version](/deploy/kubernetes/upgrade#multi-version-upgrades) upgrades to Postgres 16 versions! However if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure. + 1. **Disable Connections to the Database**: - The following services must have their replicas scaled to 0: - Deployments (e.g., `kubectl scale deployment --replicas=0`) @@ -76,4 +80,8 @@ $ kubectl apply -f deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulS - Wait until the containers come up, and complete their migration to Postgresql 16 -## Helm \ No newline at end of file +## Helm + +To upgrade builtin containers in Helm admins must update their instance to v5.10.0 or v5.11.0 via the [helm multi-version upgrade procedure](/admin/deploy/kubernetes#multi-version-upgrade-procedure) or standard upgrade procedure. This is because `helm upgrade` doesn't support just the DBs in a chart. + + In Sourcegraph version 6.0.0 Sourcegraph services will no longer be able to connect to a Postgres 12 database. This means at and after Sourcegraph 6.0.0, migrator will not be connect to older versions to execute the `upgrade` command. \ No newline at end of file diff --git a/docs/admin/updates/kubernetes.mdx b/docs/admin/updates/kubernetes.mdx index 814736b3c..4a33ec6ba 100644 --- a/docs/admin/updates/kubernetes.mdx +++ b/docs/admin/updates/kubernetes.mdx @@ -15,6 +15,7 @@ For upgrade procedures or general info about sourcegraph versioning see the link ## v6.0.0 - Sourcegraph 6.0.0 no longer supports PostgreSQL 12, admins must upgrade to PostgreSQL 16. See our [postgres 12 end of life](/admin/postgres12_end_of_life_notice) notice! As well as [supporting documentation](/admin/postgres) and advisements on how to upgrade. +- The Kuberentes Helm deployment type does not support MVU from Sourcegraph `v5.9.45` versions and earlier to Sourcegraph `v6.0.0`. Admins seeking to upgrade to Sourcegraph `v6.0.0` should upgrade to `v5.11.6271` then use the standard upgrade procedure to get to `v6.0.0`. This is because migrator v6.0.0 will no longer connect to Postgres 12 databases. For more info see our [PostgreSQL upgrade docs](/admin/postgres#requirements). ## v5.9.0 ➔ v5.10.1164 From b8a05b9718ab46fce06979c22f1187d06d37cb65 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Tue, 4 Feb 2025 09:14:52 -0800 Subject: [PATCH 13/21] Update docs/admin/deploy/docker-compose/upgrade.mdx Co-authored-by: Jacob Pleiness --- docs/admin/deploy/docker-compose/upgrade.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index 087f0d827..b177dbaaa 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -68,7 +68,7 @@ To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrat - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). 2. **Pull and merge upstream changes**: - - Follow the [standard upgrade procedure](#standard-upgrades) to pull and merge upstream changes from the version you are upgrading to to your `release` branch. + - Follow the [standard upgrade procedure](#standard-upgrades) to pull and merge upstream changes from the version you are upgrading to your `release` branch. 3. **Disable Connections to the Database**: - Stop running containers connected to the databases and the databases: From f882b71621bc5a3aaaf1a6543aa154a050530fef Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Tue, 4 Feb 2025 09:15:04 -0800 Subject: [PATCH 14/21] Update docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx Co-authored-by: Jacob Pleiness --- docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx index 9c64d8de1..d712cafff 100644 --- a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx +++ b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx @@ -82,6 +82,6 @@ $ kubectl apply -f deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulS ## Helm -To upgrade builtin containers in Helm admins must update their instance to v5.10.0 or v5.11.0 via the [helm multi-version upgrade procedure](/admin/deploy/kubernetes#multi-version-upgrade-procedure) or standard upgrade procedure. This is because `helm upgrade` doesn't support just the DBs in a chart. +To upgrade builtin containers in Helm admins must update their instance to v5.11.6271 via the [helm multi-version upgrade procedure](/admin/deploy/kubernetes#multi-version-upgrade-procedure) or standard upgrade procedure. This is because `helm upgrade` doesn't support just the DBs in a chart. In Sourcegraph version 6.0.0 Sourcegraph services will no longer be able to connect to a Postgres 12 database. This means at and after Sourcegraph 6.0.0, migrator will not be connect to older versions to execute the `upgrade` command. \ No newline at end of file From 56b10c54612fc6fcab1215e56cd4a6dbd32ac6d6 Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Tue, 4 Feb 2025 09:15:12 -0800 Subject: [PATCH 15/21] Update docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx Co-authored-by: Jacob Pleiness --- docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx index d712cafff..8148f6e39 100644 --- a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx +++ b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx @@ -36,7 +36,7 @@ Wait for the database containers to come up healthy. If for some reason the data ## Kubernetes Kustomize -Kubernetes Kustomize supports [standard](/admin/deploy/kubernetes/upgrade#standard-upgrades) and [multi-version](/deploy/kubernetes/upgrade#multi-version-upgrades) upgrades to Postgres 16 versions! However if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure. +Kubernetes Kustomize supports [standard](/admin/deploy/kubernetes/upgrade#standard-upgrades) and [multi-version](/deploy/kubernetes/upgrade#multi-version-upgrades) upgrades to Postgres 16 versions! However, if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure. 1. **Disable Connections to the Database**: - The following services must have their replicas scaled to 0: From 099bf5396db2631bb36ba9504983ddb19fb9bf3c Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Tue, 4 Feb 2025 09:15:22 -0800 Subject: [PATCH 16/21] Update docs/admin/postgres.mdx Co-authored-by: Jacob Pleiness --- docs/admin/postgres.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/postgres.mdx b/docs/admin/postgres.mdx index 7520bad66..1f3f55b8b 100644 --- a/docs/admin/postgres.mdx +++ b/docs/admin/postgres.mdx @@ -10,7 +10,7 @@ Sourcegraph uses several PostgreSQL databases to support various functionality. ### Version requirements -We support Postgres 16 and above. Older versions of Sourcegraph supported 12 see our [Postgres 12 deprecation notice](/admin/postgres12_end_of_life_notice) for more details. Starting in Sourcegraph 6.0.0, sourcegraph services will no longer connect to a PostgreSQL 12 or lower database. Instead displaying an error message in container logs for services attempting to connect to a PostgreSQL database below version 16. +We support Postgres 16 and above. Older versions of Sourcegraph supported 12 see our [Postgres 12 deprecation notice](/admin/postgres12_end_of_life_notice) for more details. Starting in Sourcegraph 6.0.0, sourcegraph services will no longer connect to a PostgreSQL 12 or lower database. Instead, it will display an error message in container logs for services attempting to connect to a PostgreSQL database below version 16. ``` migrator | ✱ Sourcegraph migrator 6.0.0 migrator | ⚠️ Failed to check for migrator update: unexpected status code 404. Continuing... From 9412f04dbef835a1a1cb8a468c7ca4694d8b0fde Mon Sep 17 00:00:00 2001 From: Warren Gifford Date: Tue, 4 Feb 2025 09:15:32 -0800 Subject: [PATCH 17/21] Update docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx Co-authored-by: Jacob Pleiness --- docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx index 8148f6e39..ba60d24ec 100644 --- a/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx +++ b/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs.mdx @@ -8,7 +8,7 @@ The following doc contains detailed instructions for upgrading the built-in Post ## Docker Compose -Docker compose supports [standard](/admin/deploy/docker-compose/upgrade#standard-upgrades) and [multi-version](/admin/deploy/docker-compose/upgrade#multi-version-upgrades) upgrades to Postgres 16 versions! However if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure. +Docker compose supports [standard](/admin/deploy/docker-compose/upgrade#standard-upgrades) and [multi-version](/admin/deploy/docker-compose/upgrade#multi-version-upgrades) upgrades to Postgres 16 versions! However, if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure. 1. **Bring down your containers** ```bash From 6e45317b89a44ee96984864bd92031fed217c499 Mon Sep 17 00:00:00 2001 From: Maedah Batool Date: Tue, 4 Feb 2025 09:30:44 -0800 Subject: [PATCH 18/21] Update docs/admin/deploy/kubernetes/index.mdx --- docs/admin/deploy/kubernetes/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/deploy/kubernetes/index.mdx b/docs/admin/deploy/kubernetes/index.mdx index 0c8459f1f..0f70d4468 100644 --- a/docs/admin/deploy/kubernetes/index.mdx +++ b/docs/admin/deploy/kubernetes/index.mdx @@ -938,7 +938,7 @@ When all pods have restarted and show as Running, you can browse to your Sourceg - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). **Step 2:** -> The Kuberentes Helm deployment type does not support MVU from Sourcegraph `v5.9.45` versions and earlier to Sourcegraph `v6.0.0`. Admins seeking to upgrade to Sourcegraph `v6.0.0` should upgrade to `v5.10.3940` or `v5.11.6271` then use the standard upgrade procedure to get to `v6.0.0`. This is because migrator v6.0.0 will no longer connect to Postgres 12 databases. For more info see our [PostgreSQL upgrade docs](/admin/postgres#requirements). +> The Kubernetes Helm deployment type does not support MVU from Sourcegraph `v5.9.45` versions and earlier to Sourcegraph `v6.0.0`. Admins seeking to upgrade to Sourcegraph `v6.0.0` should upgrade to `v5.10.3940` or `v5.11.6271` and then use the standard upgrade procedure to get to `v6.0.0`. This is because migrator v6.0.0 will no longer connect to Postgres 12 databases. For more info see our [PostgreSQL upgrade docs](/admin/postgres#requirements). Scale down `deployments` and `statefulSets` that access the database, _this step prevents services from accessing the database while schema migrations are in process._ The following services must have their replicas scaled to 0: From 25183801753ef9a347bab225297cbaf7046255fa Mon Sep 17 00:00:00 2001 From: Maedah Batool Date: Tue, 4 Feb 2025 09:30:53 -0800 Subject: [PATCH 19/21] Update docs/admin/deploy/docker-compose/upgrade.mdx --- docs/admin/deploy/docker-compose/upgrade.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/deploy/docker-compose/upgrade.mdx b/docs/admin/deploy/docker-compose/upgrade.mdx index b177dbaaa..19f454d66 100644 --- a/docs/admin/deploy/docker-compose/upgrade.mdx +++ b/docs/admin/deploy/docker-compose/upgrade.mdx @@ -93,7 +93,7 @@ To perform a multi-version upgrade via migrators [upgrade](/admin/updates/migrat > *Note: you may add the `--dry-run` flag to the `command:` to test things out before altering the dbs* 3. Run migrator with `docker-compose up migrator` - - Migrator `depends_on:` will ensure that the databases are ready before attempting to run migrator. Ensuring that database entrypoint scripts are run before migrator attempts to connect to the databases. For users upgrading from a version earliar than `5.10.0` a PostrgreSQL version is required and will be performed automatically here. For more details see [Upgradeing PostgreSQL](/admin/postgresql#upgrading-postgresql). + - Migrator `depends_on:` will ensure the databases are ready before attempting to run the migrator. Ensuring that database entry point scripts are run before the migrator attempts to connect to the databases. For users upgrading from a version earlier than `5.10.0`, a PostgreSQL version is required and will be performed automatically here. For more details, see [Upgradeing PostgreSQL](/admin/postgresql#upgrading-postgresql). **Example:** ```sh From 5636e261fab45f06f45d9a9c02b7fe15833b6c73 Mon Sep 17 00:00:00 2001 From: Maedah Batool Date: Tue, 4 Feb 2025 09:30:59 -0800 Subject: [PATCH 20/21] Update docs/admin/postgres.mdx --- docs/admin/postgres.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/postgres.mdx b/docs/admin/postgres.mdx index 1f3f55b8b..939f0e379 100644 --- a/docs/admin/postgres.mdx +++ b/docs/admin/postgres.mdx @@ -56,7 +56,7 @@ Database Image Updates: - `codeintel-db` is now `postgresql-16` - `codeinsights-db` is now `postgresql-16-codeinsights` -These images contain an entryscript which will detect and upgrade Postgres instances at version 12 (our previous images Postgres version) to Postgres 16. +These images contain an entry script that will detect and upgrade Postgres instances from version 12 (the version in our previous images) to Postgres 16. > WARNING: Upgrading the PostgreSQL database requires stopping your Sourcegraph deployment which will result in **downtime**. > From ff55146865e99d8669d99ad81381c16b4de738a3 Mon Sep 17 00:00:00 2001 From: Maedah Batool Date: Tue, 4 Feb 2025 09:31:07 -0800 Subject: [PATCH 21/21] Update docs/admin/postgres.mdx --- docs/admin/postgres.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/admin/postgres.mdx b/docs/admin/postgres.mdx index 939f0e379..2041809a7 100644 --- a/docs/admin/postgres.mdx +++ b/docs/admin/postgres.mdx @@ -75,7 +75,7 @@ For additional assistance with PostgreSQL upgrades, please contact support@sourc The `PG_UPGRADE_EXTRA_ARGS` environment variable allows you to customize the `pg_upgrade` command in `postgresql-16` and `postgresql-16-codeinsights` deployments. - **Quick upgrade option:** -Setting `PG_UPGRADE_EXTRA_ARGS=--link` creates hard links between old and new data directories instead of copying data. While faster and space-efficient, this method risks data corruption if containers are interrupted during upgrade. Best used when you have reliable container scheduling and solid backups. +Setting `PG_UPGRADE_EXTRA_ARGS=--link` creates hard links between old and new data directories instead of copying data. While faster and space-efficient, this method risks data corruption if containers are interrupted during an upgrade. It is best used when you have reliable container scheduling and solid backups. - **Storage requirements:** Without `--link`, you'll need double the current database size in free disk space. For example, a 100GiB database requires an additional 100GiB free space for the upgrade.