A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://sourcegraph.com/docs/admin/how-to/upgrade-postgres-12-16-builtin-dbs below:

Upgrading Built-in PostgreSQL - Sourcegraph docs

Upgrading Built-in PostgreSQL

The following doc contains detailed instructions for upgrading the built-in PostgreSQL databases. Via our postgresql-16 and postgresql-16-codeinsights image entrypoint script. This doc assumes an admin is attempting to upgrade to Sourcegraph 6.0.0 from an older version (usually pre 5.10.0) using one of our "deploy" repos. For more general info see Upgrading PostgreSQL.

WARNING: Upgrading the PostgreSQL database requires stopping your Sourcegraph deployment which will result in downtime.

Additionally, once the upgrade process is started via the database container, interrupting the container before the upgrade is complete could result in corrupting the underlying Postgres database. We strongly advise taking a backup before the upgrade.

Docker Compose

Docker compose supports standard and multi-version upgrades to Postgres 16 versions! However, if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure.

  1. Bring down your containers
docker-compose down --remove-orphans
  1. Change the image: in your docker-compose.yaml to the release of pgsql, codeinsights-db, and codeintel-db. Or merge in changes from the tagged sourcegraph release you're planning to upgrade to. Example:
pgsql:
    container_name: pgsql
    image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0'
...
codeintel-db:
    container_name: codeintel-db
    image: 'index.docker.io/sourcegraph/postgresql-16:6.0.0'
...
codeinsights-db:
    container_name: codeintel-db
    image: 'index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0'
  1. Bring up your deployments
docker-compose up -d pgsql codeintel-db codeinsights-db

Wait for the database containers to come up healthy. If for some reason the database containers fail to come up healthy, please check their logs and reach out to us for support at [email protected].

Kubernetes Kustomize

Kubernetes Kustomize supports standard and multi-version upgrades to Postgres 16 versions! However, if you prefer to upgrade your DBs independent of a Sourcegraph version upgrade see the following procedure.

  1. Disable Connections to the Database:
$ 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
  1. Update base files for the database statefulSets:
# deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml 
    containers:
      - name: codeinsights
        image: index.docker.io/sourcegraph/postgresql-16-codeinsights:6.0.0
# deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml 
    containers:
      - name: pgsql
        image: index.docker.io/sourcegraph/postgresql-16:6.0.0
# deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml 
    containers:
      - name: pgsql
        image: index.docker.io/sourcegraph/postgresql-16:6.0.0
  1. Apply the new container images to the database statefulsets:
$ kubectl apply -f deploy-sourcegraph-k8s/base/sourcegraph/pgsql/pgsql.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeintel-db/codeintel-db.StatefulSet.yaml deploy-sourcegraph-k8s/base/sourcegraph/codeinsights-db/codeinsights-db.StatefulSet.yaml
Helm

When using the in-cluster PostgreSQL databases included in the Sourcegraph Helm chart, database upgrades are integrated with the overall application upgrade process and there is no mechanism to upgrade only the PostgreSQL containers independently. Therefore, the PostgreSQL upgrade must be performed as part of a full Sourcegraph version upgrade.

For production deployments, we recommend using external PostgreSQL databases, which allows for more flexible database management outside the Helm deployment lifecycle.

Required Upgrade Path

To safely upgrade PostgreSQL in Helm deployments:

  1. First upgrade to an intermediate version:

  2. Verify the PostgreSQL upgrade (optional):

  3. Proceed to target version:

For any issues during the PostgreSQL upgrade process, please contact [email protected].


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