This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Make reindexing work in server image#53256
Merged
Merged
Conversation
This is required from the CI "Sourcegraph Upgrade" test to pass
eseliger
approved these changes
Jun 14, 2023
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff dc0f2d7...a44128f.
|
Contributor
|
Codenotify: Notifying subscribers in OWNERS files for diff dc0f2d7...a44128f.
|
Revert changes to push_all, and instead use a candidate tag
1 task
ErikaRS
pushed a commit
that referenced
this pull request
Jun 22, 2023
## Info for reviewers In 5.1 we’ll be migrating the `server` image from Alpine to Wolfi, which means `server`'s built-in Postgres database needs reindexing ([see RFC 793](https://docs.google.com/document/d/1kVdpTgPFPf1O25TVpFfSiLFIF2CFxUXyV9q2UlhOkfo/edit#heading=h.hgkt2mv20sbx)). The [existing reindexing script](https://github.com/sourcegraph/sourcegraph/blob/main/docker-images/postgres-12-alpine/rootfs/reindex.sh) is only used with the standalone database containers, so I’ve adapted it to work with server.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Info for reviewers
In 5.1 we’ll be migrating the
serverimage from Alpine to Wolfi, which meansserver's built-in Postgres database needs reindexing (see RFC 793).The existing reindexing script is only used with the standalone database containers, so I’ve adapted it to work with server. I’ve tested the cases I can think of locally, but would appreciate a thorough review of the changes.
To get this running locally for testing, you can use the following images:
sourcegraph/server:5.0.5us.gcr.io/sourcegraph-dev/server:bazel-5201a0869411_2023-06-13(built from this CI run)Additional background
To be clear, only
server(i.e. single-container deployments) will require a database reindex in 5.1; we won’t be migrating the standalone postgres-12-alpine, codeintel-db, codeinsights-db containers in this release.The reindexing time varies a lot - it can be very quick, but for instances with lots of code intel it can be several hours. To avoid surprises the migration will not run unless the server container is started with the envar
SOURCEGRAPH_5_1_DB_MIGRATION=true. Working with CE/TA to ensure all affected customers get a heads-up ahead of time.When an admin first starts up a server instance after upgrading to 5.1, they'll see the following message:
Todo
SKIP_DB_MIGRATIONworkaroundTest plan
I've tested the following cases locally using the following images:
sourcegraph/server:5.0.5us.gcr.io/sourcegraph-dev/server:bazel-5201a0869411_2023-06-13(built from this CI run)reindex.shscript continues to work for standalone database containersLocal testing can be done by starting an Alpine-based instance locally with mounted data volumes and setting up Sourcegraph. Once done, stop the image and switch to a Wolfi-based image - this should perform a full reindexing process on startup.