# Docker Compose Upgrade Notes

This page lists the changes that are relevant for upgrading Sourcegraph on **Docker Compose**.

For upgrade procedures or general info about sourcegraph versioning see the links below:

-   [Docker Compose Upgrade Procedures](/self-hosted/deploy/docker-compose/upgrade)
-   [General Upgrade Info](/self-hosted/updates/)
-   [Technical changelog](/technical-changelog)

> **\*Attention:** These notes may contain relevant information about the infrastructure update such as resource requirement changes or versions of dependencies (Docker, Docker Compose, externalized databases).\*
>
> **_If the notes indicate a patch release exists, target the highest one._**

## v6.3 patch 1

-   Grafana's port 3370 is no longer open by default for unauthenticated access for Docker Compose and Pure Docker deployments. Admins can still access Grafana by logging in to their Sourcegraph instance, navigating to the Site Admin page, then clicking Monitoring from the left navigation menu. If customers require port 3370 to be open, see [[PR 1204](https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/1204/files)] for insight on how to add this port to their `docker-compose.override.yaml` file.

## v6.2.2553

### Known issues

Customers running Sourcegraph versions prior to v6.2.2553 and using the Sourcegraph provided PostgreSQL containers may encounter PostgreSQL collation version mismatch warnings after upgrading to more recent Sourcegraph versions due to an underlying glibc version update.

When logging into the database via psql or similar tools you may see the following warning:

```shell
WARNING: database "sg" has a collation version mismatch DETAIL: The database was created using collation version 2.40, but the operating system provides version 2.41.
```

Mismatched collation versions can lead to database index corruption if left unchecked.

Affected Services

-   pgsql container
-   codeintel-db container
-   codeinsights-db container

Only self-hosted customers using the Sourcegraph provided PostgreSQL container images are affected.

Self-hosted customers using external databases, such as AWS RDS, GCP CloudSQL, or another self-managed solution are NOT affected.

See our [PostgreSQL Collation Version Mismatch Resolution](/self-hosted/postgresql-collation-version-mismatch-resolution) notes for more details.

## 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](/self-hosted/postgres12-end-of-life-notice) notice! As well as [supporting documentation](/self-hosted/postgres) and advisements on how to upgrade.

## v5.9.0 ➔ v5.10.1164

-   This release resolves an issue in the v5.10.0 release which prevented multiversion upgrades from working. You may now target `v5.10.1164` using migrator's `upgrade` command. Or use autoupgrade by setting the environment variable `SRC_AUTOUPGRADE_IGNORE_DRIFT=true` on the `frontend` container.

## v5.9.0 ➔ v5.10.0

> Warning: Admins are advised to upgrade directly to v5.10.1164 circumventing this release.
>
> Warning: This release updates the database container images from Postgres 12 to Postgres 16, and begins using Wolfi based images. Customers are advised to take a database backup before upgrading! See our [postgres 12 end of life](https://sourcegraph.com/docs/self-hosted/postgres12-end-of-life-notice#postgres-12-end-of-life) notice!
>
> Warning: `automatic` and migrator `upgrade` command will not work for this release, please upgrade directly to `v5.10.1164`, or to a 5.9 version and conduct a standard upgrade using migrator's default `up` command!

#### Notes:

-   The container image for pgsql and codeintel-db have been renamed from `postgres-12-alpine` and `codeintel-db` respectively to `postgresql-16`. The `codeinsights-db` container has been renamed to `postgresql-16-codeinsights`.
-   **Admins using external dbs who have not yet upgraded from postgres 12 to postgres 16**, can expect to see database drift after upgrading to `5.10.0`. The new expected schema definition for Sourcegraph is based on postgres 16. The schema drift is the result of automatic changes made to the schema by pg_upgrade utils, and will not cause issues in the application.
    -   Admins should not run migrators suggested drift fixes, and should instead upgrade their database from postgres 12 to postgres 16.
-   The [Autoupgrade](https://sourcegraph.com/docs/admin/updates/automatic#pre-v500-automatic-multiversion-upgrades) upgrade method, will detect drift and exit before conducting the upgrade unless the env var `SRC_AUTOUPGRADE_IGNORE_DRIFT=true` is set in the server container.
-   Postgres 12 image containers cannot be started with data volumes which have been upgraded by postgres 16.

## v5.1.4 ➔ v5.1.5

#### Notes:

-   Upgrades from versions `v5.0.3`, `v5.0.4`, `v5.0.5`, and `v5.0.6` to `v5.1.5` are affected by an ordering error in the `frontend` databases migration tree.

## v5.1.3 ➔ v5.1.4

#### Notes:

-   Migrator images were built without the `v5.1.x` tag in this version, as such multiversion upgrades using this image version will fail to upgrade to versions in `v5.1.x`.

## v5.1.2 ➔ v5.1.3

#### Notes:

-   Migrator images were built without the `v5.1.x` tag in this version, as such multiversion upgrades using this image version will fail to upgrade to versions in `v5.1.x`.

## v5.1.1 ➔ v5.1.2

#### Notes:

-   Migrator images were built without the `v5.1.x` tag in this version, as such multiversion upgrades using this image version will fail to upgrade to versions in `v5.1.x`.

## v5.1.0 ➔ v5.1.1

#### Notes:

-   Migrator images were built without the `v5.1.x` tag in this version, as such multiversion upgrades using this image version will fail to upgrade to versions in `v5.1.x`.

## v5.0.6 ➔ v5.1.0

#### Notes:

-   See note under v5.1.5 release on issues with standard and multiversion upgrades to v5.1.5.

## v5.0.5 ➔ v5.0.6

#### Notes:

-   See note under v5.1.5 release on issues with standard and multiversion upgrades to v5.1.5.

## v5.0.4 ➔ v5.0.5

#### Notes:

-   See note under v5.1.5 release on issues with standard and multiversion upgrades to v5.1.5.

## v5.0.3 ➔ v5.0.4

#### Notes:

-   See note under v5.1.5 release on issues with standard and multiversion upgrades to v5.1.5.

## v4.4.2 ➔ v4.5.0

#### Notes:

This release introduces a background job that will convert all LSIF data into SCIP. **This migration is irreversible** and a rollback from this version may result in loss of precise code intelligence data. Please see the [migration notes](/admin/how-to/lsif-scip-migration) for more details.

## v4.3 ➔ v4.4.1

#### Notes:

-   Users attempting a multi-version upgrade to v4.4.0 may be affected by a bug in which an outdated schema migration is included in the upgrade process. _This issue is fixed in patch v4.4.2_
-   The error will be encountered while running `upgrade`, and contains the following text: `"frontend": failed to apply migration 1648115472`.
    -   To resolve this issue run migrator with the args `'add-log', '-db=frontend', '-version=1648115472'`.
    -   If migrator was stopped while running `upgrade` the next run of upgrade will encounter drift, this drift should be disregarded by providing migrator with the `--skip-drift-check` flag.

## v4.1 ➔ v4.2.1

#### Notes:

-   This upgrade adds the [node-exporter](https://github.com/prometheus/node_exporter) deployment, which collects crucial machine-level metrics that help Sourcegraph scale your deployment.

## v3.43 ➔ v4.0

#### Notes:

-   Target the tag [`v4.0.1`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v4.0.1/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   `jaeger` (deployed with the `jaeger-all-in-one` image) has been removed in favor of an [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) DaemonSet + Deployment configuration. See [Configure a tracing backend](/self-hosted/deploy/docker-compose/operations#configure-a-tracing-backend)
-   Exporting traces to an external observability backend is now available. Read the [documentation](/self-hosted/deploy/docker-compose/operations#configure-a-tracing-backend) to configure.
-   The bundled Jaeger instance is now disabled by default. It can be [enabled](/self-hosted/deploy/docker-compose/operations#enable-the-bundled-jaeger-deployment) if you do not wish to utilize your own external tracing backend.

## v3.42 ➔ v3.43

#### Notes:

-   Target the tag [`v3.43.2`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.43.2/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.41 ➔ v3.42

#### Notes:

-   Target the tag [`v3.42.2`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.42.2/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.40 ➔ v3.41

#### Notes:

-   Target the tag [`v3.41.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.41.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   `caddy` is upgraded to version 2.5.1 and contains a breaking change from version 2.5.0. Incoming `X-Forwarded-*` headers will no longer be trusted automatically. In order to preserve existing product functionality, the Caddyfile was updated to trust all incoming `X-Forwarded-*` headers. [#828](https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/828)
-   The Postgres DBs `frontend` and `codeintel-db` are now given 1 hour to begin accepting connections before Kubernetes restarts the containers. [#4136](https://github.com/sourcegraph/deploy-sourcegraph/pull/4136)

## v3.39 ➔ v3.40

#### Notes:

-   Target the tag [`v3.40.2`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.40.2/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   `cadvisor` now defaults to run in `privileged` mode. This allows `cadvisor` to collect out of memory events happening to containers which can be used to discover underprovisioned resources. [#804](https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/804)

## v3.38 ➔ v3.39

#### Notes:

-   Target the tag [`v3.39.1`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.39.1/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

-   `v3.39.1`

#### Notes:

-   We made a number of changes to our built-in postgres databases (the `pgsql`, `codeintel-db`, and `codeinsights-db` container)
    -   **CAUTION**: Added the ability to customize postgres server configuration by mounting external configuration files. If you have customized the config in any way, you should copy your changes to the added `postgresql.conf` files [sourcegraph/deploy-sourcegraph-docker#792](https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/792).
    -   Increased the minimal memory requirement of `pgsql` and `codeintel-db` from `2GB` to `4GB`. -`codeinsights-db` container no longer uses TimescaleDB and is now based on the standard Postgres image [sourcegraph/deploy-sourcegraph-docker#780](https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/780). Metrics scraping is also enabled.

## v3.37 ➔ v3.38

#### Notes:

-   Target the tag [`v3.38.1`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.38.1/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

-   `v3.38.1`

#### Notes:

-   **Minimum version of 1.29 for docker compose is required for this update**
-   This release adds the requirement that the environment variables `SRC_GIT_SERVERS`, `SEARCHER_URL`, `SYMBOLS_URL`, and `INDEXED_SEARCH_SERVERS` are set for the worker process.

## v3.36 ➔ v3.37

#### Notes:

-   Target the tag [`v3.37.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.37.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   This release adds a new container that runs database migrations (`migrator`) independently of the frontend container. Confirm the environment variables on this new container match your database settings.
-   **If performing a multiversion upgrade from an instance prior to this version see our [upgrading early versions documentation](/self-hosted/updates/migrator/upgrading-early-versions#before-v3370)**

## v3.35 ➔ v3.36

#### Notes:

-   Target the tag [`v3.36.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.36.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.34 ➔ v3.35

#### Notes:

-   Target the tag [`v3.35.1`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.35.1/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   The `query-runner` service has been decommissioned in the 3.35 release and will be removed during the upgrade. To delete the `query-runner` service, specify `--remove-orphans` to your `docker-compose` command.
-   There is a [known issue](/code-insights/how-tos/Troubleshooting#oob-migration-has-made-progress-but-is-stuck-before-reaching-100) with the Code Insights out-of-band settings migration not reaching 100% complete when encountering deleted users or organizations.

## v3.33 ➔ v3.34

#### Notes:

-   Target the tag [`v3.34.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.34.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.32 ➔ v3.33

#### Notes:

-   Target the tag [`v3.33.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.33.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.31 ➔ v3.32

#### Notes:

-   Target the tag [`v3.32.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.32.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.30 ➔ v3.31

> WARNING: **This upgrade must originate from `v3.30.3`.**

#### Notes:

-   Target the tag [`v3.31.2`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.31.2/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   The **built-in** main Postgres (`pgsql`) and codeintel (`codeintel-db`) databases have switched to an alpine-based Docker image. Upon upgrading, Sourcegraph will need to re-index the entire database.

## v3.29 ➔ v3.30

> WARNING: **If you have already upgraded to 3.30.0, 3.30.1, or 3.30.2** please see the rebuild corrupt postgres indexes guide for recovery steps.

#### Notes:

-   Target the tag [`v3.30.3`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.30.3/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.28 ➔ v3.29

#### Notes:

-   Target the tag [`v3.29.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.29.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   This upgrade adds a new `worker` service that runs a number of background jobs that were previously run in the `frontend` service. See [notes on deploying workers](/self-hosted/workers#deploying-workers) for additional details. Good initial values for CPU and memory resources allocated to this new service should match the `frontend` service.

## v3.27 ➔ v3.28

#### Notes:

-   Target the tag [`v3.28.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.28.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   The memory requirements for `redis-cache` and `redis-store` have been increased by 1GB. See https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/373 for more context.

## v3.26 ➔ v3.27

> WARNING: Sourcegraph 3.27 now requires **Postgres 12+**.

#### Notes:

-   Target the tag [`v3.27.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.27.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   If you are using an external database, [upgrade your database](/self-hosted/postgres#upgrading-external-postgresql-instances) to Postgres 12 or above prior to upgrading Sourcegraph. No action is required if you are using the supplied supplied database images.
-   **If performing a multiversion upgrade from an instance prior to this version see our [upgrading early versions documentation](/self-hosted/updates/migrator/upgrading-early-versions#before-v3270)**

## v3.25 ➔ v3.26

#### Notes:

-   Target the tag [`v3.26.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.26.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.24 ➔ v3.25

#### Notes:

-   Target the tag [`v3.25.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.25.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   Go `1.15` introduced changes to SSL/TLS connection validation which requires certificates to include a `SAN`. This field was not included in older certificates and clients relied on the `CN` field. You might see an error like `x509: certificate relies on legacy Common Name field`. We recommend that customers using Sourcegraph with an external database and and connecting to it using SSL/TLS check whether the certificate is up to date.
    -   AWS RDS customers please reference [AWS' documentation on updating the SSL/TLS certificate](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL-certificate-rotation.html) for steps to rotate your certificate.

## v3.23 ➔ v3.24

#### Notes:

-   Target the tag [`v3.24.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.24.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.22 ➔ v3.23

#### Notes:

-   Target the tag [`v3.23.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.23.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.

## v3.21 ➔ v3.22

#### Notes:

-   Target the tag [`v3.22.0`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.22.0/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   This upgrade removes the `code intel bundle manager`. This service has been deprecated and all references to it have been removed.
-   This upgrade also adds a MinIO container that doesn't require any custom configuration. You can find more detailed documentation [here](/self-hosted/external-services/object-storage).

## v3.20 ➔ v3.21

#### Notes:

-   Target the tag [`v3.21.1`](https://github.com/sourcegraph/deploy-sourcegraph-docker/tree/v3.21.1/docker-compose) when fetching upstream from `deploy-sourcegraph-docker`.
-   This release introduces a second database instance, `codeintel-db`. If you have configured Sourcegraph with an external database, then update the `CODEINTEL_PG*` environment variables to point to a new external database as described in the [external database documentation](/self-hosted/external-services/postgres). Again, these must not point to the same database or the Sourcegraph instance will refuse to start.
