From d84595054815d899e816c023b8fd24062065ee8a Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 24 Nov 2026 16:12:20 -0500 Subject: [PATCH 1/4] worker: set DEPLOY_TYPE=docker-compose The worker runs the update-check job that sends pings, but had no DEPLOY_TYPE, so deploy.Type() fell back to kubernetes and Docker Compose instances reported their deploy type as kubernetes. Amp-Thread-ID: https://ampcode.com/threads/T-01a20e96-2bcd-7332-8f00-abc10c5225ac Co-authored-by: Amp --- docker-compose/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index 6febd829d..09c6f275c 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -369,6 +369,7 @@ services: - no-new-privileges:true env_file: sourcegraph-uploads.env environment: + - DEPLOY_TYPE=docker-compose - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' - 'SRC_GIT_SERVERS=gitserver-0:3178' From 24bf4eca7c1a086bdfc2bbec63f1cfb3a37d97be Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 24 Nov 2026 16:24:21 -0500 Subject: [PATCH 2/4] Set DEPLOY_TYPE=docker-compose on every container Like deploy-sourcegraph-helm#929 does for Helm, set DEPLOY_TYPE explicitly instead of relying on deploy.Type()'s kubernetes fallback, which is wrong for Docker Compose. Covers every service with an image in the base, executor, and Jaeger compose files, and the migrator in the two example overrides that replace its environment with !override. --- docker-compose/docker-compose.yaml | 33 +++++++++++++++++++ .../docker-compose.override.yaml | 1 + .../docker-compose.override.yaml | 1 + .../executors/executor.docker-compose.yaml | 1 + docker-compose/jaeger/docker-compose.yaml | 2 ++ 5 files changed, 38 insertions(+) diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index 09c6f275c..0755891f9 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -19,6 +19,7 @@ services: - no-new-privileges:true command: ['up'] environment: + - DEPLOY_TYPE=docker-compose - PGHOST=pgsql - PGPORT=5432 - PGUSER=sg @@ -76,6 +77,7 @@ services: security_opt: - no-new-privileges:true environment: + - DEPLOY_TYPE=docker-compose - 'XDG_DATA_HOME=/caddy-storage/data' - 'XDG_CONFIG_HOME=/caddy-storage/config' - 'SRC_FRONTEND_ADDRESSES=sourcegraph-frontend-0:3080' @@ -235,6 +237,7 @@ services: - no-new-privileges:true env_file: sourcegraph-uploads.env environment: + - DEPLOY_TYPE=docker-compose - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' volumes: @@ -260,6 +263,7 @@ services: security_opt: - no-new-privileges:true environment: + - DEPLOY_TYPE=docker-compose - 'HOSTNAME=zoekt-webserver-0:6070' - 'SRC_FRONTEND_INTERNAL=http://sourcegraph-frontend-internal:3090' - 'OPENTELEMETRY_DISABLED=false' @@ -285,6 +289,7 @@ services: security_opt: - no-new-privileges:true environment: + - DEPLOY_TYPE=docker-compose - 'HOSTNAME=zoekt-webserver-0:6070' - 'OPENTELEMETRY_DISABLED=false' - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' @@ -315,6 +320,7 @@ services: - no-new-privileges:true env_file: sourcegraph-uploads.env environment: + - DEPLOY_TYPE=docker-compose - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' healthcheck: @@ -342,6 +348,7 @@ services: - no-new-privileges:true env_file: sourcegraph-uploads.env environment: + - DEPLOY_TYPE=docker-compose - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' healthcheck: @@ -396,6 +403,7 @@ services: - no-new-privileges:true env_file: sourcegraph-uploads.env environment: + - DEPLOY_TYPE=docker-compose - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' healthcheck: @@ -421,6 +429,8 @@ services: mem_limit: '6g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose healthcheck: test: "wget -q 'http://127.0.0.1:9238/health' -O /dev/null || exit 1" interval: 5s @@ -453,6 +463,7 @@ services: - sourcegraph restart: always environment: + - DEPLOY_TYPE=docker-compose - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' # Description: Dashboards and graphs for Prometheus metrics. @@ -473,6 +484,8 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose volumes: - 'grafana:/var/lib/grafana' - '../grafana/datasources:/sg_config_grafana/provisioning/datasources' @@ -494,6 +507,8 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose # You may set `privileged` to `false and `cadvisor` will run with reduced privileges. # `cadvisor` requires root privileges in order to display provisioning metrics. # These metrics provide critical information to help you scale the Sourcegraph deployment. @@ -529,6 +544,8 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose pid: 'host' volumes: - /proc:/host/proc:ro @@ -561,6 +578,8 @@ services: security_opt: - no-new-privileges:true shm_size: '1g' + environment: + - DEPLOY_TYPE=docker-compose healthcheck: test: '/liveness.sh' interval: 10s @@ -594,6 +613,7 @@ services: - sourcegraph restart: always environment: + - DEPLOY_TYPE=docker-compose - 'DATA_SOURCE_NAME=postgres://sg:@pgsql:5432/?sslmode=disable' - 'PG_EXPORTER_EXTEND_QUERY_PATH=/config/queries.yaml' @@ -612,6 +632,8 @@ services: security_opt: - no-new-privileges:true shm_size: '1g' + environment: + - DEPLOY_TYPE=docker-compose healthcheck: test: '/liveness.sh' interval: 10s @@ -645,6 +667,7 @@ services: - sourcegraph restart: always environment: + - DEPLOY_TYPE=docker-compose - 'DATA_SOURCE_NAME=postgres://sg:@codeintel-db:5432/?sslmode=disable' - 'PG_EXPORTER_EXTEND_QUERY_PATH=/config/code_intel_queries.yaml' @@ -664,6 +687,7 @@ services: - no-new-privileges:true shm_size: '1g' environment: + - DEPLOY_TYPE=docker-compose - POSTGRES_PASSWORD=password - POSTGRES_USER=postgres - POSTGRES_DB=postgres @@ -701,6 +725,7 @@ services: - sourcegraph restart: always environment: + - DEPLOY_TYPE=docker-compose - 'DATA_SOURCE_NAME=postgres://postgres:password@codeinsights-db:5432/?sslmode=disable' - 'PG_EXPORTER_EXTEND_QUERY_PATH=/config/code_insights_queries.yaml' @@ -718,6 +743,8 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose healthcheck: test: ['CMD', 'curl', '-f', 'http://127.0.0.1:9000/'] interval: 10s @@ -743,6 +770,8 @@ services: mem_limit: '7g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose volumes: - 'redis-cache:/redis-data' networks: @@ -761,6 +790,8 @@ services: mem_limit: '7g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose volumes: - 'redis-store:/redis-data' networks: @@ -778,6 +809,8 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose networks: - sourcegraph restart: always diff --git a/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml b/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml index a5a8ca557..435195ec9 100644 --- a/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml +++ b/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml @@ -61,6 +61,7 @@ services: # !override drops all env vars from earlier compose files, then defines new ones, to ensure no other env vars are in the mix environment: !override <<: *database-env-vars + DEPLOY_TYPE: docker-compose # Normal startup of migrator should only ever use the default "up" command, no additional args # Overriding the command should only to be used to make specific changes, on single startups, only when needed, only when directed by Sourcegraph Customer Support Engineering diff --git a/docker-compose/examples/external-databases/docker-compose.override.yaml b/docker-compose/examples/external-databases/docker-compose.override.yaml index 81451e000..164bc59a1 100644 --- a/docker-compose/examples/external-databases/docker-compose.override.yaml +++ b/docker-compose/examples/external-databases/docker-compose.override.yaml @@ -37,6 +37,7 @@ services: depends_on: !reset [] # Remove the dependency on the built-in Postgres databases environment: !override <<: *env-vars-database + DEPLOY_TYPE: docker-compose sourcegraph-frontend-0: environment: diff --git a/docker-compose/executors/executor.docker-compose.yaml b/docker-compose/executors/executor.docker-compose.yaml index 473bc7072..0ba95250c 100644 --- a/docker-compose/executors/executor.docker-compose.yaml +++ b/docker-compose/executors/executor.docker-compose.yaml @@ -9,6 +9,7 @@ services: # Run with privileged capabilities (required for docker daemon control) privileged: true environment: + - DEPLOY_TYPE=docker-compose # Refer to https://sourcegraph.com/docs/self-hosted/executors/executors-config on how to populate these variables - EXECUTOR_FRONTEND_URL=http://sourcegraph-frontend-0:3080 # Note: Must match `executors.accessToken` in site config diff --git a/docker-compose/jaeger/docker-compose.yaml b/docker-compose/jaeger/docker-compose.yaml index a74593689..48a77bedc 100644 --- a/docker-compose/jaeger/docker-compose.yaml +++ b/docker-compose/jaeger/docker-compose.yaml @@ -14,6 +14,8 @@ services: mem_limit: '512m' security_opt: - no-new-privileges:true + environment: + - DEPLOY_TYPE=docker-compose ports: # Query port - '0.0.0.0:16686:16686' From 974589cacda93a17af226deb695e3d846fb222c0 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 24 Nov 2026 16:32:38 -0500 Subject: [PATCH 3/4] Drop DEPLOY_TYPE from third-party containers Match deploy-sourcegraph-helm#929: set it only on Sourcegraph services, not on the databases, Redis, monitoring, Caddy, OpenTelemetry, or Jaeger, where it has no meaning. Amp-Thread-ID: https://ampcode.com/threads/T-01a20e96-2bcd-7332-8f00-abc10c5225ac Co-authored-by: Amp --- docker-compose/docker-compose.yaml | 22 ---------------------- docker-compose/jaeger/docker-compose.yaml | 2 -- 2 files changed, 24 deletions(-) diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index 0755891f9..f02cf4c8f 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -77,7 +77,6 @@ services: security_opt: - no-new-privileges:true environment: - - DEPLOY_TYPE=docker-compose - 'XDG_DATA_HOME=/caddy-storage/data' - 'XDG_CONFIG_HOME=/caddy-storage/config' - 'SRC_FRONTEND_ADDRESSES=sourcegraph-frontend-0:3080' @@ -463,7 +462,6 @@ services: - sourcegraph restart: always environment: - - DEPLOY_TYPE=docker-compose - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' # Description: Dashboards and graphs for Prometheus metrics. @@ -484,8 +482,6 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true - environment: - - DEPLOY_TYPE=docker-compose volumes: - 'grafana:/var/lib/grafana' - '../grafana/datasources:/sg_config_grafana/provisioning/datasources' @@ -507,8 +503,6 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true - environment: - - DEPLOY_TYPE=docker-compose # You may set `privileged` to `false and `cadvisor` will run with reduced privileges. # `cadvisor` requires root privileges in order to display provisioning metrics. # These metrics provide critical information to help you scale the Sourcegraph deployment. @@ -544,8 +538,6 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true - environment: - - DEPLOY_TYPE=docker-compose pid: 'host' volumes: - /proc:/host/proc:ro @@ -578,8 +570,6 @@ services: security_opt: - no-new-privileges:true shm_size: '1g' - environment: - - DEPLOY_TYPE=docker-compose healthcheck: test: '/liveness.sh' interval: 10s @@ -613,7 +603,6 @@ services: - sourcegraph restart: always environment: - - DEPLOY_TYPE=docker-compose - 'DATA_SOURCE_NAME=postgres://sg:@pgsql:5432/?sslmode=disable' - 'PG_EXPORTER_EXTEND_QUERY_PATH=/config/queries.yaml' @@ -632,8 +621,6 @@ services: security_opt: - no-new-privileges:true shm_size: '1g' - environment: - - DEPLOY_TYPE=docker-compose healthcheck: test: '/liveness.sh' interval: 10s @@ -667,7 +654,6 @@ services: - sourcegraph restart: always environment: - - DEPLOY_TYPE=docker-compose - 'DATA_SOURCE_NAME=postgres://sg:@codeintel-db:5432/?sslmode=disable' - 'PG_EXPORTER_EXTEND_QUERY_PATH=/config/code_intel_queries.yaml' @@ -687,7 +673,6 @@ services: - no-new-privileges:true shm_size: '1g' environment: - - DEPLOY_TYPE=docker-compose - POSTGRES_PASSWORD=password - POSTGRES_USER=postgres - POSTGRES_DB=postgres @@ -725,7 +710,6 @@ services: - sourcegraph restart: always environment: - - DEPLOY_TYPE=docker-compose - 'DATA_SOURCE_NAME=postgres://postgres:password@codeinsights-db:5432/?sslmode=disable' - 'PG_EXPORTER_EXTEND_QUERY_PATH=/config/code_insights_queries.yaml' @@ -770,8 +754,6 @@ services: mem_limit: '7g' security_opt: - no-new-privileges:true - environment: - - DEPLOY_TYPE=docker-compose volumes: - 'redis-cache:/redis-data' networks: @@ -790,8 +772,6 @@ services: mem_limit: '7g' security_opt: - no-new-privileges:true - environment: - - DEPLOY_TYPE=docker-compose volumes: - 'redis-store:/redis-data' networks: @@ -809,8 +789,6 @@ services: mem_limit: '1g' security_opt: - no-new-privileges:true - environment: - - DEPLOY_TYPE=docker-compose networks: - sourcegraph restart: always diff --git a/docker-compose/jaeger/docker-compose.yaml b/docker-compose/jaeger/docker-compose.yaml index 48a77bedc..a74593689 100644 --- a/docker-compose/jaeger/docker-compose.yaml +++ b/docker-compose/jaeger/docker-compose.yaml @@ -14,8 +14,6 @@ services: mem_limit: '512m' security_opt: - no-new-privileges:true - environment: - - DEPLOY_TYPE=docker-compose ports: # Query port - '0.0.0.0:16686:16686' From e169c4ca7bf456049776c0f59819a3fd1a3b26c4 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Tue, 24 Nov 2026 17:14:56 -0500 Subject: [PATCH 4/4] Drop DEPLOY_TYPE from the database example overrides --- .../examples/aws-rds-databases/docker-compose.override.yaml | 1 - .../examples/external-databases/docker-compose.override.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml b/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml index 435195ec9..a5a8ca557 100644 --- a/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml +++ b/docker-compose/examples/aws-rds-databases/docker-compose.override.yaml @@ -61,7 +61,6 @@ services: # !override drops all env vars from earlier compose files, then defines new ones, to ensure no other env vars are in the mix environment: !override <<: *database-env-vars - DEPLOY_TYPE: docker-compose # Normal startup of migrator should only ever use the default "up" command, no additional args # Overriding the command should only to be used to make specific changes, on single startups, only when needed, only when directed by Sourcegraph Customer Support Engineering diff --git a/docker-compose/examples/external-databases/docker-compose.override.yaml b/docker-compose/examples/external-databases/docker-compose.override.yaml index 164bc59a1..81451e000 100644 --- a/docker-compose/examples/external-databases/docker-compose.override.yaml +++ b/docker-compose/examples/external-databases/docker-compose.override.yaml @@ -37,7 +37,6 @@ services: depends_on: !reset [] # Remove the dependency on the built-in Postgres databases environment: !override <<: *env-vars-database - DEPLOY_TYPE: docker-compose sourcegraph-frontend-0: environment: