This document describes the process to update a Docker Compose Sourcegraph instance. If you are unfamiliar with sourcegraph versioning or releases see our general concepts documentation.
Standard upgrades
A standard upgrade occurs between a Sourcegraph version and the minor or major version released immediately after it. If you would like to jump forward several versions, you must perform a multi-version upgrade instead.
If you've configured Docker Compose with a release branch, please merge the upstream release tag for the next minor version into your release
branch.
In the following example, the release branch is being upgraded to v6.6.2517.
# first, checkout the release branch git checkout release # fetch updates git fetch upstream # merge the upstream release tag into your release branch git checkout release git merge v6.6.2517Address any merge conflicts you might have
For each conflict, you need to reconcile any customizations you made with the updates from the new version. Use the information you gathered earlier from the change log and changes list to interpret the merge conflict and to ensure that it doesn't over-write your customizations. You may need to update your customizations to accommodate the new version.
Clone the updated release branch to your serverNOTE: If you have made no changes or only very minimal changes to your configuration, you can also ask git to always select incoming changes in the event of merge conflicts. In the following example merges will be accepted from the upstream version v6.6.2517:
git merge -X theirs {CURRENT_VERSION_STRING}
If you do this, make sure your configuration is correct before proceeding because it may have made changes to your docker-compose YAML file.
SSH into your instance and navigate to the appropriate folder:
# AWS
cd /home/ec2-user/deploy-sourcegraph-docker/docker-compose
# Azure, Digital Ocean, Google Cloud
cd /root/deploy-sourcegraph-docker/docker-compose
Download all the latest docker images to your local docker daemon:
$ docker-compose pull --include-deps
Restart Docker Compose using the new minor version along with your customizations:
$ docker-compose up -d --remove-orphans
Multi-version upgrades
To perform a multi-version upgrade via migrators upgrade command on a Sourcegraph instance running on Docker compose follow the procedure below:
Check Upgrade Readiness:
Site Admin > Updates
page to determine upgrade readiness.Pull and merge upstream changes:
release
branch.Disable Connections to the Database:
$ docker-compose down --remove-orphans
Run Migrator with the upgrade
command:
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:migrator:
container_name: migrator
image: 'index.docker.io/sourcegraph/migrator:6.0.0'
command:
to upgrade
you'll need to supply a --to=
argument to the version you're upgrading to. Example:command: ['upgrade', '--from=v5.9.0', '--to=v6.0.0']
Note: you may add the
--dry-run
flag to thecommand:
to test things out before altering the dbs
Run migrator with docker-compose up migrator
depends_on:
will ensure the databases are ready before attempting to run the migrator. Ensuring that database entry point scripts are run before the migrator attempts to connect to the databases. For users upgrading from a version earlier than 5.10.0
, a PostgreSQL version is required and will be performed automatically here. For more details, see Upgrading PostgreSQL.Example:
$ ~/deploy-sourcegraph-docker/docker-compose/ docker-compose up migrator
✔ 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 | ✱ 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
Run Migrator with the up
command
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:
migrator:
container_name: migrator
image: 'index.docker.io/sourcegraph/migrator:6.0.0@sha256:ec295eb0b743da6bf56777ca6524972267a5c442b0288095e2fe12fce38ebacc'
cpus: 0.5
mem_limit: '500m'
command: ['up']
Start your containers again:
docker-compose up -d
in the folder containing your docker-compose.yaml
file.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4