Skip to content

Commit

Permalink
Update pure-docker code insights deployment to use postgres (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
caugustus-sourcegraph authored Apr 12, 2022
1 parent 0b0ec26 commit 0e03697
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pure-docker/deploy-codeinsights-db.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"

0 comments on commit 0e03697

Please sign in to comment.