Skip to content

Conversation

@DaedalusG
Copy link
Contributor

@DaedalusG DaedalusG commented Feb 3, 2025

This PR updates the upgrade docs embellishing instructions for the different deployment methods to include better coverage and handling of the Postgres 16 database upgrade when crossing over Sourcegraph 5.10.0 using migrator 6.0.0 or greater.

The notable change here is the inclusion of deployment specific builtin Postgres upgrade instructions, as well as changes to the MVU upgrade docs suggesting that users bring down all services and merge upstream changes from their target version into their release branch before performing their migrator upgrade. Due to migrators depends_on clause this will ensure that Postgres upgrades occur before migrator attempts connection to a PG12 database. This gets around the connect bouncer added in 6.0.0 which blocks services connection to our dbs

Testing

  • docker-compose
    • autoupgrade
    • MVU (tested 5.9 -> 5.11 with migrator 6.0)
  • kustomize
    • autoupgrade
    • MVU (tested 5.9 -> 5.11 with migrator 6.0)
  • Helm
    • autoupgrade
    • MVU

DaedalusG and others added 6 commits January 31, 2025 11:52
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
@vercel
Copy link

vercel bot commented Feb 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sourcegraph-docs 🛑 Canceled (Inspect) Feb 4, 2025 5:37pm

@DaedalusG
Copy link
Contributor Author

This is a separate thing, but autoupgrade doesn't really work very well with k8s deployments

{"SeverityText":"WARN","Timestamp":1738577648562528772,"InstrumentationScope":"frontend","Caller":"cli/autoupgrade.go:282","Function":"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/cli.claimAutoUpgradeLock","Body":"named postgres connections found, waiting for them to shutdown, manually shutdown any unexpected ones","Resource":{"service.name":"frontend","service.version":"6.0.0","service.instance.id":"sourcegraph-frontend-bc5dc56f5-t4ns2"},"Attributes":{"applications":["repo-updater"]}}
➜  deploy-sourcegraph-k8s git:(release) ✗ k get pods
NAME                                         READY   STATUS             RESTARTS        AGE
blobstore-776f6ff9d4-tbjk9                   1/1     Running            0               8m36s
codeinsights-db-0                            2/2     Running            0               8m36s
codeintel-db-0                               2/2     Running            0               8m36s
gitserver-0                                  0/1     CrashLoopBackOff   6 (16s ago)     8m36s
grafana-0                                    1/1     Running            0               8m36s
indexed-search-0                             2/2     Running            0               8m6s
node-exporter-8ch2b                          1/1     Running            0               8m37s
pgsql-0                                      2/2     Running            0               8m36s
precise-code-intel-worker-6b4469fcb8-h5bfs   0/1     CrashLoopBackOff   6 (2m17s ago)   8m37s
prometheus-564889b58c-qtd7h                  1/1     Running            0               8m36s
redis-cache-766c488dd8-4hw5n                 2/2     Running            0               8m36s
redis-store-868dc9bd4f-hmwvj                 2/2     Running            0               8m36s
repo-updater-866ddd54df-pkjq2                1/1     Running            6 (11m ago)     13m
repo-updater-df44f556f-fdt4h                 0/1     CrashLoopBackOff   6 (111s ago)    8m37s
searcher-0                                   1/1     Running            0               8m36s
sourcegraph-frontend-bc5dc56f5-hp8x9         1/1     Running            0               8m37s
sourcegraph-frontend-bc5dc56f5-t4ns2         1/1     Running            0               8m37s
symbols-0                                    0/1     Running            6 (2m55s ago)   8m36s
syntect-server-9ddff8b8d-225r2               1/1     Running            0               8m37s
worker-64c947c995-mb7fr                      0/1     CrashLoopBackOff   6 (116s ago)    8m37s

To fix this you'd need to go in and scale down the services that are continually trying to reach the DB

@DaedalusG
Copy link
Contributor Author

DaedalusG commented Feb 3, 2025

Calling it for now but I suspect we'll have to special case Helm and add a note to the kubernetes upgrade notes saying that MVU for helm specifically can't got over the v5.10 boundary. I want to investigate packaging an override file that updates the images in the repo though

https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/examples/basic/override.yaml

Copy link
Contributor

@MaedahBatool MaedahBatool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left very minor comments.

@DaedalusG DaedalusG requested a review from a team February 3, 2025 21:38
migrator:
container_name: migrator
image: 'index.docker.io/sourcegraph/migrator:5.0.4'
image: 'index.docker.io/sourcegraph/migrator:6.0.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to use CURRENT_VERSION_STRING stuff here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be into doing this as a revision later yea, at the moment I think we just need to ship this, and a lot of SG uses this stuff

Copy link
Contributor

@jdpleiness jdpleiness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few spelling or grammar issues but nothing blocking in the docs content.

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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

earlier*

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrading*

Copy link
Contributor

@MaedahBatool MaedahBatool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few fixes on format and syntax. Approving to unblock you.

## 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.
- <Callout type="warning">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).</Callout>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- <Callout type="warning">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).</Callout>
- <Callout type="warning">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.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).</Callout>

@DaedalusG DaedalusG merged commit 63790c5 into main Feb 4, 2025
4 of 5 checks passed
@DaedalusG DaedalusG deleted the wg/rel/sourcegraph-6-upgrade-docs branch February 4, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants