From 82288fe8ceee5558ca74c06823f35816862167e5 Mon Sep 17 00:00:00 2001 From: Erik Seliger Date: Mon, 12 May 2025 14:27:34 +0200 Subject: [PATCH 1/2] Remove symbols statefulset Starting in Sourcegraph 6.4, the Symbols and Searcher services are now combined, for easier operation, simplified architecture, and better resource utilization. Customers can delete the service if not deleted automatically, and may want to consider reallocating resources previously given to symbols to searcher. Environment variables should be copied over from symbols to searcher. Test plan: This deployment ran for ~2 weeks on S2 and dotcom already and has signoff from team-product-platform. --- docker-compose/docker-compose.yaml | 33 +------------------------ prometheus/prometheus_targets.yml | 5 ---- pure-docker/deploy-frontend-internal.sh | 1 - pure-docker/deploy-frontend.sh | 3 +-- pure-docker/deploy-symbols.sh | 27 -------------------- pure-docker/deploy-worker.sh | 1 - pure-docker/deploy.sh | 1 - pure-docker/replicas.sh | 3 +-- pure-docker/teardown.sh | 1 - test/volume-config.sh | 2 +- 10 files changed, 4 insertions(+), 73 deletions(-) delete mode 100755 pure-docker/deploy-symbols.sh diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index f7a1d5643..f298132cc 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -118,7 +118,7 @@ services: # Ports exposed to other Sourcegraph services: 6060/TCP, 3080 (HTTP), and/or 3443 (HTTPS) # Ports exposed to the public internet: none # - # Note: SRC_GIT_SERVERS, SEARCHER_URL, and SYMBOLS_URL are space-separated + # Note: SRC_GIT_SERVERS, and SEARCHER_URL are space-separated # lists which each allow you to specify more container instances for scaling # purposes. Be sure to also apply such a change here to the frontend-internal # service. @@ -136,7 +136,6 @@ services: - 'SRC_GIT_SERVERS=gitserver-0:3178' - 'SRC_SYNTECT_SERVER=http://syntect-server:9238' - 'SEARCHER_URL=http://searcher-0:3181' - - 'SYMBOLS_URL=http://symbols-0:3184' - 'INDEXED_SEARCH_SERVERS=zoekt-webserver-0:6070' - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - 'GRAFANA_SERVER_URL=http://grafana:3370' @@ -150,7 +149,6 @@ services: { "Name": "frontend-internal-0", "Host": "sourcegraph-frontend-internal:6060" }, { "Name": "gitserver-0", "Host": "gitserver-0:6060" }, { "Name": "searcher-0", "Host": "searcher-0:6060" }, - { "Name": "symbols-0", "Host": "symbols-0:6060" }, { "Name": "worker", "Host": "worker:6060" }, { "Name": "zoekt-indexserver-0", "Host": "zoekt-indexserver-0:6072" }, { "Name": "zoekt-webserver-0", "Host": "zoekt-webserver-0:6070", "DefaultPath": "/debug/requests/" } @@ -189,7 +187,6 @@ services: - 'SRC_GIT_SERVERS=gitserver-0:3178' - 'SRC_SYNTECT_SERVER=http://syntect-server:9238' - 'SEARCHER_URL=http://searcher-0:3181' - - 'SYMBOLS_URL=http://symbols-0:3184' - 'INDEXED_SEARCH_SERVERS=zoekt-webserver-0:6070' - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - 'GRAFANA_SERVER_URL=http://grafana:3370' @@ -355,7 +352,6 @@ services: - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' - 'SRC_GIT_SERVERS=gitserver-0:3178' - 'SEARCHER_URL=http://searcher-0:3181' - - 'SYMBOLS_URL=http://symbols-0:3184' - 'INDEXED_SEARCH_SERVERS=zoekt-webserver-0:6070' - 'PRECISE_CODE_INTEL_UPLOAD_BACKEND=blobstore' - 'PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT=http://blobstore:9000' @@ -413,32 +409,6 @@ services: - sourcegraph restart: always - # Description: Backend for symbols operations. - # - # Disk: 128GB / non-persistent SSD - # Ports exposed to other Sourcegraph services: 3184/TCP 6060/TCP - # Ports exposed to the public internet: none - # - symbols-0: - container_name: symbols-0 - image: 'index.docker.io/sourcegraph/symbols:6.1.2889@sha256:0ffea2e2d7641decf87587a2c0fbcedb172d876f71a10da4cd3e72b566ce12b4' - cpus: 2 - mem_limit: '4g' - environment: - - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' - healthcheck: - test: "wget -q 'http://127.0.0.1:3184/healthz' -O /dev/null || exit 1" - interval: 5s - timeout: 5s - retries: 3 - start_period: 60s - volumes: - - 'symbols-0:/mnt/cache' - networks: - - sourcegraph - restart: always - # Description: Prometheus collects metrics and aggregates them into graphs. # # Disk: 200GB / persistent SSD @@ -781,7 +751,6 @@ volumes: searcher-0: sourcegraph-frontend-0: sourcegraph-frontend-internal-0: - symbols-0: zoekt-0-shared: networks: sourcegraph: diff --git a/prometheus/prometheus_targets.yml b/prometheus/prometheus_targets.yml index c7c0594e7..e7cc3e623 100644 --- a/prometheus/prometheus_targets.yml +++ b/prometheus/prometheus_targets.yml @@ -51,11 +51,6 @@ job: searcher targets: - searcher-0:6060 -- labels: - nodename: "sourcegraph-docker-compose-host" - job: symbols - targets: - - symbols-0:6060 - labels: nodename: "sourcegraph-docker-compose-host" job: pgsql diff --git a/pure-docker/deploy-frontend-internal.sh b/pure-docker/deploy-frontend-internal.sh index b3d25b6d4..c1596e98e 100755 --- a/pure-docker/deploy-frontend-internal.sh +++ b/pure-docker/deploy-frontend-internal.sh @@ -31,7 +31,6 @@ docker run --detach \ -e SRC_GIT_SERVERS="$(addresses "gitserver-" $NUM_GITSERVER ":3178")" \ -e SRC_SYNTECT_SERVER=http://syntect-server:9238 \ -e SEARCHER_URL="$(addresses "http://searcher-" $NUM_SEARCHER ":3181")" \ - -e SYMBOLS_URL="$(addresses "http://symbols-" $NUM_SYMBOLS ":3184")" \ -e INDEXED_SEARCH_SERVERS="$(addresses "zoekt-webserver-" $NUM_INDEXED_SEARCH ":6070")" \ -e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \ -e GRAFANA_SERVER_URL=http://grafana:3000 \ diff --git a/pure-docker/deploy-frontend.sh b/pure-docker/deploy-frontend.sh index c6d8bf47d..77037aa29 100755 --- a/pure-docker/deploy-frontend.sh +++ b/pure-docker/deploy-frontend.sh @@ -32,7 +32,6 @@ docker run --detach \ -e SRC_GIT_SERVERS="$(addresses "gitserver-" $NUM_GITSERVER ":3178")" \ -e SRC_SYNTECT_SERVER=http://syntect-server:9238 \ -e SEARCHER_URL="$(addresses "http://searcher-" $NUM_SEARCHER ":3181")" \ - -e SYMBOLS_URL="$(addresses "http://symbols-" $NUM_SYMBOLS ":3184")" \ -e INDEXED_SEARCH_SERVERS="$(addresses "zoekt-webserver-" $NUM_INDEXED_SEARCH ":6070")" \ -e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \ -e GRAFANA_SERVER_URL=http://grafana:3370 \ @@ -43,7 +42,7 @@ docker run --detach \ -p 0.0.0.0:$((3080 + $1)):3080 \ index.docker.io/sourcegraph/frontend:187572_2022-12-06_cbecc5321c7d@sha256:73e64a8636e70ebbaf7f4a3300479529294f67e8cf644cdaea02435915aec869 -# Note: SRC_GIT_SERVERS, SEARCHER_URL, and SYMBOLS_URL are space-separated +# Note: SRC_GIT_SERVERS, and SEARCHER_URL are space-separated # lists which each allow you to specify more container instances for scaling # purposes. Be sure to also apply such a change here to the frontend-internal # service. diff --git a/pure-docker/deploy-symbols.sh b/pure-docker/deploy-symbols.sh deleted file mode 100755 index 726202a1c..000000000 --- a/pure-docker/deploy-symbols.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Backend for symbols operations. -# -# Disk: 128GB / non-persistent SSD -# Network: 100mbps -# Liveness probe: none -# Ports exposed to other Sourcegraph services: 3184/TCP 6060/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/symbols-$1-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=symbols-$1 \ - --network=sourcegraph \ - --restart=always \ - --cpus=2 \ - --memory=4g \ - -e GOMAXPROCS=2 \ - -e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -v $VOLUME:/mnt/cache \ - index.docker.io/sourcegraph/symbols:187572_2022-12-06_cbecc5321c7d@sha256:75615a60f318dc898eae2e5037efcd53e63cf28c2b8fca388b6923d215ff9db9 - -echo "Deployed symbols $1 service" diff --git a/pure-docker/deploy-worker.sh b/pure-docker/deploy-worker.sh index 326351e82..c4876b819 100755 --- a/pure-docker/deploy-worker.sh +++ b/pure-docker/deploy-worker.sh @@ -24,7 +24,6 @@ docker run --detach \ -e INDEXED_SEARCH_SERVERS="$(addresses "zoekt-webserver-" $NUM_INDEXED_SEARCH ":6070")" \ -e SEARCHER_URL="$(addresses "http://searcher-" $NUM_SEARCHER ":3181")" \ -e SRC_GIT_SERVERS="$(addresses "gitserver-" $NUM_GITSERVER ":3178")" \ - -e SYMBOLS_URL="$(addresses "http://symbols-" $NUM_SYMBOLS ":3184")" \ -e PRECISE_CODE_INTEL_UPLOAD_BACKEND=blobstore \ -e PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT=http://blobstore:9000 \ -v $VOLUME:/mnt/cache \ diff --git a/pure-docker/deploy.sh b/pure-docker/deploy.sh index 28a1c71b8..3f79e1cc3 100755 --- a/pure-docker/deploy.sh +++ b/pure-docker/deploy.sh @@ -25,7 +25,6 @@ for i in $(seq 0 $(($NUM_GITSERVER - 1))); do ./deploy-gitserver.sh $i; done ./deploy-worker.sh ./deploy-otel-collector.sh for i in $(seq 0 $(($NUM_SEARCHER - 1))); do ./deploy-searcher.sh $i; done -for i in $(seq 0 $(($NUM_SYMBOLS - 1))); do ./deploy-symbols.sh $i; done ./deploy-syntect-server.sh for i in $(seq 0 $(($NUM_INDEXED_SEARCH - 1))); do ./deploy-zoekt-indexserver.sh $i; done for i in $(seq 0 $(($NUM_INDEXED_SEARCH - 1))); do ./deploy-zoekt-webserver.sh $i; done diff --git a/pure-docker/replicas.sh b/pure-docker/replicas.sh index e4782d9fd..23ca3ca91 100755 --- a/pure-docker/replicas.sh +++ b/pure-docker/replicas.sh @@ -1,8 +1,7 @@ # Here you can specify the number of service replicas to deploy. NUM_GITSERVER=1 NUM_SEARCHER=1 -NUM_SYMBOLS=1 NUM_INDEXED_SEARCH=1 NUM_FRONTEND=3 -addresses() { for i in $(seq 0 $(($2 - 1))); do echo -n "$1$i$3 "; done } +addresses() { for i in $(seq 0 $(($2 - 1))); do echo -n "$1$i$3 "; done; } diff --git a/pure-docker/teardown.sh b/pure-docker/teardown.sh index 81a6dc0e8..4ae10d8e2 100755 --- a/pure-docker/teardown.sh +++ b/pure-docker/teardown.sh @@ -25,7 +25,6 @@ docker rm -f redis-cache &>/dev/null || true & docker rm -f redis-store &>/dev/null || true & docker rm -f worker &>/dev/null || true & docker rm -f $(addresses "searcher-" $NUM_SEARCHER "") &>/dev/null || true & -docker rm -f $(addresses "symbols-" $NUM_SYMBOLS "") &>/dev/null || true & docker rm -f syntect-server &>/dev/null || true & docker rm -f $(addresses "zoekt-indexserver-" $NUM_INDEXED_SEARCH "") &>/dev/null || true & docker rm -f $(addresses "zoekt-webserver-" $NUM_INDEXED_SEARCH "") &>/dev/null || true & diff --git a/test/volume-config.sh b/test/volume-config.sh index 45f4bc157..020677b73 100755 --- a/test/volume-config.sh +++ b/test/volume-config.sh @@ -18,7 +18,7 @@ echo echo "forcing static permissions on volume directories" echo pushd ~/sourcegraph-docker -chown -R 100:101 gitserver* prometheus-v2* worker* searcher* sourcegraph-frontend* symbols* zoekt* blobstore-disk +chown -R 100:101 gitserver* prometheus-v2* worker* searcher* sourcegraph-frontend* zoekt* blobstore-disk chown -R 999:1000 redis-store-disk redis-cache-disk chown -R 472:472 grafana-disk chown -R 999:999 pgsql-disk codeintel-db-disk From ccecb8ce073aee86ea8c977dc6cebc00dfc80be3 Mon Sep 17 00:00:00 2001 From: Erik Seliger Date: Mon, 12 May 2025 14:59:03 +0200 Subject: [PATCH 2/2] Fixup --- test/smoke-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/smoke-test.sh b/test/smoke-test.sh index c6a3bbc3f..b8621e34d 100755 --- a/test/smoke-test.sh +++ b/test/smoke-test.sh @@ -12,10 +12,10 @@ deploy_sourcegraph() { if [[ "$TEST_TYPE" == "pure-docker-test" ]]; then ./test/volume-config.sh timeout 600s ./pure-docker/deploy.sh - expect_containers="24" + expect_containers="23" elif [[ "$TEST_TYPE" == "docker-compose-test" ]]; then docker-compose --file docker-compose/docker-compose.yaml up -d -t 600 - expect_containers="26" + expect_containers="25" fi echo "Giving containers 90s to start..."