From 0e0369727984c54822016dca63cb58aca3bc0eec Mon Sep 17 00:00:00 2001 From: Crystal Augustus <91073224+caugustus-sourcegraph@users.noreply.github.com> Date: Tue, 12 Apr 2022 14:16:21 -0400 Subject: [PATCH] Update pure-docker code insights deployment to use postgres (#781) --- pure-docker/deploy-codeinsights-db.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pure-docker/deploy-codeinsights-db.sh b/pure-docker/deploy-codeinsights-db.sh index 72212fa21..f764dbaee 100755 --- a/pure-docker/deploy-codeinsights-db.sh +++ b/pure-docker/deploy-codeinsights-db.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -# Description: TimescaleDB time-series database for code insights data. +# Description: PostgreSQL database for code insights data. # # Disk: 128GB / persistent SSD # Network: 1Gbps @@ -11,20 +11,25 @@ set -e # VOLUME="$HOME/sourcegraph-docker/codeinsights-db-disk" ./ensure-volume.sh $VOLUME 999 + +# Remove timescaledb from the shared_preload_libraries configuration +# This step can be performed manually instead of run as part of the deploy script +sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'timescaledb(.*)\'/\1 = '\2'/;s/,'/'/" $VOLUME/pgdata/postgresql.conf + docker run --detach \ --name=codeinsights-db \ --network=sourcegraph \ --restart=always \ --cpus=4 \ --memory=2g \ + -e POSTGRES_DB=postgres \ -e POSTGRES_PASSWORD=password \ + -e POSTGRES_USER=postgres \ -e PGDATA=/var/lib/postgresql/data/pgdata \ -v $VOLUME:/var/lib/postgresql/data/ \ index.docker.io/sourcegraph/codeinsights-db:3.36.3@sha256:98133abeb1fc6d02ee9f0fca6cc3ab65e2a3a47a07db96a56aa0869389393fce -# Note: You should deploy this as a container, do not try to connect it to your external -# Postgres deployment (TimescaleDB is a bit special and most hosted Postgres deployments -# do not support TimescaleDB, the data here is akin to gitserver's data, where losing it -# would be bad but it can be rebuilt given enough time.) +# Sourcegraph requires PostgreSQL 12+. Generally newer versions are better, +# but anything 12 and higher is supported. echo "Deployed codeinsights-db service"