|
| 1 | +import { CURRENT_VERSION_STRING } from 'src/components/PreCodeBlock' |
| 2 | + |
| 3 | +# Upgrade Sourcegraph on Docker Compose to v6.0 and beyond |
| 4 | + |
| 5 | +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. |
| 6 | +If you are unfamiliar with sourcegraph versioning or releases see our [general concepts documentation](/admin/updates/). |
| 7 | + |
| 8 | +> ***⚠️ Attention: Always consult the [release notes](/admin/updates/docker_compose) for the versions your upgrade will pass over and end on.*** |
| 9 | +
|
| 10 | +### Multi-version upgrades to the 6.0 release and beyond |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +> **⚠️ 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. |
| 15 | +
|
| 16 | +To perform a **manual** multi-version upgrade on a Sourcegraph instance running on Docker compose follow the procedure below: |
| 17 | + |
| 18 | +1. **Check Upgrade Readiness**: |
| 19 | + - Check the [upgrade notes](/admin/updates/docker_compose#docker-compose-upgrade-notes) for the version range you're passing through. |
| 20 | + - Check the `Site Admin > Updates` page to determine [upgrade readiness](/admin/updates/#upgrade-readiness). |
| 21 | + |
| 22 | +2. **Shutdown your instance of Sourcegraph**: |
| 23 | + - 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. |
| 24 | + ```sh |
| 25 | + $ pwd |
| 26 | + /cloned/repo/location/deploy-sourcegraph-docker/docker-compose |
| 27 | + $ docker-compose down |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Switch to the new release version**: |
| 31 | + - Run the following command in local clone of your repository. |
| 32 | + ```sh |
| 33 | + $ git checkout v6.0.0 |
| 34 | + ``` |
| 35 | + |
| 36 | +4. **Start up _only_ the database containers**: |
| 37 | + - The database containers contain a self-executing, upgrade in place script that needs to be perfomed before starting up the remaining containers. |
| 38 | + - 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/) |
| 39 | + ```sh |
| 40 | + $ docker-compose up -d pgsql codeintel-db codeinsights-db |
| 41 | + ``` |
| 42 | + |
| 43 | +5. **Run Migrator with the `upgrade` command**: |
| 44 | + - 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). |
| 45 | + > *Note: Always use the latest image version of migrator for migrator commands, except the startup command `up`* |
| 46 | + 1. Set the migrator `image:` in your `docker-compose.yaml` to the **latest** release of `migrator`. **Example:** |
| 47 | + - 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. |
| 48 | + ```yaml |
| 49 | + migrator: |
| 50 | + container_name: migrator |
| 51 | + image: 'index.docker.io/sourcegraph/migrator:6.0.0' |
| 52 | + ``` |
| 53 | + 2. Set the migrator `command:` to `upgrade` you'll need to supply a `--to=` argument. **Example:** |
| 54 | + ```yaml |
| 55 | + command: ['upgrade', '--from=v5.8.0', '--to=v6.0.0'] |
| 56 | + ``` |
| 57 | + > *Note: you may add the `--dry-run` flag to the `command:` to test things out before altering the dbs* |
| 58 | + 3. Run migrator with `docker-compose up migrator` **Example:** |
| 59 | + ```sh |
| 60 | + $ ~/deploy-sourcegraph-docker/docker-compose/ docker-compose up migrator |
| 61 | + codeintel-db is up-to-date |
| 62 | + codeinsights-db is up-to-date |
| 63 | + pgsql is up-to-date |
| 64 | + Recreating migrator ... done |
| 65 | + Attaching to migrator |
| 66 | + migrator | ❗️ An error was returned when detecting the terminal size and capabilities: |
| 67 | + migrator | |
| 68 | + migrator | GetWinsize: inappropriate ioctl for device |
| 69 | + migrator | |
| 70 | + migrator | Execution will continue, but please report this, along with your operating |
| 71 | + migrator | system, terminal, and any other details, to: |
| 72 | + migrator | https://github.com/sourcegraph/sourcegraph/issues/new |
| 73 | + migrator | |
| 74 | + migrator | ✱ Sourcegraph migrator 6.0.0 |
| 75 | + migrator | 👉 Migrating to v6.0 (step 1 of 2) |
| 76 | + migrator | 👉 Running schema migrations |
| 77 | + migrator | ✅ Schema migrations complete |
| 78 | + migrator | 👉 Running out of band migrations [23 24] |
| 79 | + ✅ Out of band migrations complete |
| 80 | + migrator | 👉 Migrating to v6.0 (step 2 of 2) |
| 81 | + migrator | 👉 Running schema migrations |
| 82 | + migrator | ✅ Schema migrations complete |
| 83 | + migrator | migrator exited with code 0 |
| 84 | + ``` |
| 85 | + |
| 86 | +6. **Start your containers again**: |
| 87 | + - run `docker-compose up -d` in the folder containing your `docker-compose.yaml` file. |
| 88 | + ```sh |
| 89 | + $ docker-compose up -d |
| 90 | + ``` |
0 commit comments