-
Notifications
You must be signed in to change notification settings - Fork 76
6.0.0 MVU upgrade docs update #946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
46b7841
a260768
fae5c96
b144cc0
4440ca6
2952920
84ee836
0eb5fee
bc25b93
7897d10
4d992b2
0ef56b1
6f51f57
b8a05b9
f882b71
56b10c5
099bf53
9412f04
c5cb8b6
6e45317
2518380
5636e26
ff55146
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,70 +59,84 @@ $ 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 [[email protected]](mailto:[email protected]) 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 [[email protected]](mailto:[email protected]) 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**: | ||
| - 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:** | ||
| 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. | ||
DaedalusG marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 3. **Disable Connections to the Database**: | ||
| - Stop running containers connected to the databases and the databases: | ||
| ``` | ||
| $ docker-compose down --remove-orphans | ||
| ``` | ||
|
|
||
| 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. 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' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we may want to use There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| ``` | ||
| > *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=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. **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:** | ||
| ```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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,46 +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 [[email protected]](mailto:[email protected]) 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**: | ||
| - The following services must have their replicas scaled to 0: | ||
| - Deployments (e.g., `kubectl scale deployment <name> --replicas=0`) | ||
| - precise-code-intel-worker | ||
| - repo-updater | ||
| - searcher | ||
| - sourcegraph-frontend | ||
| - sourcegraph-frontend-internal | ||
| - symbols | ||
| - worker | ||
| - Stateful sets (e.g., `kubectl scale sts <name> --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)): | ||
| 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. | ||
|
|
||
| 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:* | ||
|
|
@@ -168,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 | ||
|
|
@@ -209,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**: | ||
| 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 | ||
| ``` | ||
| 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 | ||
| ``` | ||
| Your instance should now be up and running in the new version! | ||
|
|
||
| --- | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.