From e0fa885694a5be5559ed075d58bd8fa5645ea9fd Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:43:02 -0600 Subject: [PATCH] chore: remove sourcegraph/server and pure-docker leftovers Docker Compose is the only deployment type this repo supports. #1386 removed pure-docker/; this removes what was still left over for sourcegraph/server and pure-docker: - nginx/: sourcegraph/server nginx config, unreferenced since 2020 - tools/migrate.sh, tools/migration_vars: sourcegraph/server to Docker Compose DB migration; the single-container image was removed in 7.0 - tools/tools.go: pinned update-docker-tags, whose script was removed in #1249; go mod tidy drops it and dev/ci/images - renovate.json rule for a Go module path that no longer exists - .gitignore entries for nginx certs - db-only-migrate.docker-compose.yaml header: it is for backup/restore, not the server migration Amp-Thread-ID: https://ampcode.com/threads/T-01a18a77-bb16-74a4-b42c-bdbad59a3194 Co-authored-by: Amp --- .gitignore | 3 - .../db-only-migrate.docker-compose.yaml | 3 +- nginx/nginx.conf | 53 ---------------- nginx/nginx/sourcegraph_backend.conf | 8 --- nginx/nginx/sourcegraph_http.conf | 9 --- nginx/nginx/sourcegraph_main.conf | 8 --- nginx/nginx/sourcegraph_server.conf | 5 -- tools/migrate.sh | 62 ------------------- tools/migration_vars | 20 ------ 9 files changed, 2 insertions(+), 169 deletions(-) delete mode 100644 nginx/nginx.conf delete mode 100644 nginx/nginx/sourcegraph_backend.conf delete mode 100644 nginx/nginx/sourcegraph_http.conf delete mode 100644 nginx/nginx/sourcegraph_main.conf delete mode 100644 nginx/nginx/sourcegraph_server.conf delete mode 100755 tools/migrate.sh delete mode 100644 tools/migration_vars diff --git a/.gitignore b/.gitignore index acd374d8b..da8ad566b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ node_modules/ -nginx/sourcegraph.crt -nginx/sourcegraph.key - .vagrant *.log /.env diff --git a/docker-compose/db-only-migrate.docker-compose.yaml b/docker-compose/db-only-migrate.docker-compose.yaml index 8fb1c7d78..60ff43bf2 100644 --- a/docker-compose/db-only-migrate.docker-compose.yaml +++ b/docker-compose/db-only-migrate.docker-compose.yaml @@ -1,6 +1,7 @@ # This file contains the pgsql service definition (the primary Sourcegraph database deployment), # as well as the codeintel-db service definition (a separate postgres deployment). Both run postgres. -# This file is used during the sourcegraph/server -> docker-compose migration process. +# This file is used for database-only operations such as backup and restore. +# See https://sourcegraph.com/docs/self-hosted/deploy/docker-compose/operations # # 🚨This file MUST be kept in sync with the pgsql definition in docker-compose/docker-compose.yaml version: '2.4' diff --git a/nginx/nginx.conf b/nginx/nginx.conf deleted file mode 100644 index 9a3af5476..000000000 --- a/nginx/nginx.conf +++ /dev/null @@ -1,53 +0,0 @@ -# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/main/cmd/server/shared/assets/nginx.conf -# -# You can adjust the configuration to add additional TLS or HTTP features. -# Read more at https://docs.sourcegraph.com/admin/nginx - -error_log stderr; -pid /var/run/nginx.pid; - -# Do not remove. The contents of sourcegraph_main.conf can change between -# versions and may include improvements to the configuration. -include nginx/sourcegraph_main.conf; - -events { -} - -http { - server_tokens off; - - # SAML redirect response headers are sometimes large - proxy_buffer_size 128k; - proxy_buffers 8 256k; - proxy_busy_buffers_size 256k; - - # Do not remove. The contents of sourcegraph_http.conf can change between - # versions and may include improvements to the configuration. - include nginx/sourcegraph_http.conf; - - access_log off; - upstream backend { - # Do not remove. The contents of sourcegraph_backend.conf can change - # between versions and may include improvements to the configuration. - include nginx/sourcegraph_backend.conf; - } - - server { - # Do not remove. The contents of sourcegraph_server.conf can change - # between versions and may include improvements to the configuration. - include nginx/sourcegraph_server.conf; - - listen 7080; - location / { - proxy_pass http://backend; - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - # SAML redirect response headers are sometimes large - proxy_buffer_size 128k; - proxy_buffers 8 256k; - proxy_busy_buffers_size 256k; - } - } -} diff --git a/nginx/nginx/sourcegraph_backend.conf b/nginx/nginx/sourcegraph_backend.conf deleted file mode 100644 index d2450fbb1..000000000 --- a/nginx/nginx/sourcegraph_backend.conf +++ /dev/null @@ -1,8 +0,0 @@ -# @sourcegraph: This file was adapted from https://github.com/sourcegraph/sourcegraph/blob/main/cmd/server/shared/assets/nginx/sourcegraph_backend.conf -# -# Do not remove. This config is included in the upstream context for backend by -# nginx.conf - -# Nginx round-robins between all of the sourcegraph-frontend service endpoints listed here. -# Add/remove 'sourcegraph-frontend-x' addresses here when changing the number of replicas. -server sourcegraph-frontend-0:3080; diff --git a/nginx/nginx/sourcegraph_http.conf b/nginx/nginx/sourcegraph_http.conf deleted file mode 100644 index de9f34b3b..000000000 --- a/nginx/nginx/sourcegraph_http.conf +++ /dev/null @@ -1,9 +0,0 @@ -# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/main/cmd/server/shared/assets/nginx/sourcegraph_http.conf -# -# Do not remove. The contents of sourcegraph_http.conf can change between -# versions and may include improvements to the configuration. -# -# This config is included in the http context by nginx.conf - -# We can upload large extensions -client_max_body_size 150M; diff --git a/nginx/nginx/sourcegraph_main.conf b/nginx/nginx/sourcegraph_main.conf deleted file mode 100644 index 39538dfd6..000000000 --- a/nginx/nginx/sourcegraph_main.conf +++ /dev/null @@ -1,8 +0,0 @@ -# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/main/cmd/server/shared/assets/nginx/sourcegraph_main.conf -# -# Do not remove. The contents of sourcegraph_main.conf can change between -# versions and may include improvements to the configuration. -# -# This config is included in the main context by nginx.conf - -# Intentionally blank diff --git a/nginx/nginx/sourcegraph_server.conf b/nginx/nginx/sourcegraph_server.conf deleted file mode 100644 index b2cdde8ef..000000000 --- a/nginx/nginx/sourcegraph_server.conf +++ /dev/null @@ -1,5 +0,0 @@ -# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/main/cmd/server/shared/assets/nginx/sourcegraph_server.conf -# -# Do not modify. - -# Intentionally blank diff --git a/tools/migrate.sh b/tools/migrate.sh deleted file mode 100755 index 3bffdba9e..000000000 --- a/tools/migrate.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Please ensure the variables in migration vars have been assigned before running this script. - -set -euxo pipefail - -( -# shellcheck source=migration_vars -source migration_vars -) - -image=${image:-sourcegraph/server} -sg_dump_file=$(mktemp) -codeintel_dump_file=$(mktemp) - -trap 'rm -f ${sg_dump_file} ${codeintel_dump_file}' EXIT - -# Get the ID of the sourcegraph container -echo "Obtaing sourcegraph container ID" -container_id=$(ssh "${src_host}" docker ps | grep "${image}:${version}" | cut -f 1 -d ' ') - -# Dump sourcegraph db and alter script for migration -echo "Dumping sourcegraph database" -ssh ${src_host} "docker exec ${container_id} pg_dump -C --username=postgres sourcegraph" >${sg_dump_file} -sed -i '/^CREATE DATABASE/a CREATE USER postgres WITH SUPERUSER CREATEROLE CREATEDB REPLICATION BYPASSRLS;' ${sg_dump_file} >/dev/null 2>&1 -printf '\connect -reuse-previous=on dbname=postgres\nDROP DATABASE sg;\nALTER DATABASE "sourcegraph" RENAME TO sg;\nALTER DATABASE sg OWNER TO sg;\n' >>${sg_dump_file} - -# Dump codeintel db and alter script for migration -echo "Dumping codeintel database" -ssh ${src_host} "docker exec ${container_id} pg_dump -C --username=postgres sourcegraph-codeintel" >${codeintel_dump_file} -sed -i '/^CREATE DATABASE/a CREATE USER postgres WITH SUPERUSER CREATEROLE CREATEDB REPLICATION BYPASSRLS;' ${codeintel_dump_file} >/dev/null 2>&1 -printf '\connect -reuse-previous=on dbname=postgres\nDROP DATABASE sg;\nALTER DATABASE "sourcegraph-codeintel" RENAME TO sg;\nALTER DATABASE sg OWNER TO sg;\n' >>${codeintel_dump_file} - -# Upload database dumps to new docker-compose deployment -echo "Uploading dumps to new deployment" -chmod 544 ${sg_dump_file} ${codeintel_dump_file} -scp ${sg_dump_file} "${dst_host}:${sg_dump_file}" -scp ${codeintel_dump_file} "${dst_host}:${codeintel_dump_file}" - -# Migrate databases and start new deployment -ssh -t "${dst_host}" " -pushd ${compose_dir} -docker-compose down --volumes -docker-compose -f db-only-migrate.docker-compose.yaml up -d -sleep 10 -docker cp ${sg_dump_file} pgsql:${sg_dump_file} -docker cp ${codeintel_dump_file} codeintel-db:${codeintel_dump_file} - -echo 'Starting migration' -docker exec pgsql sh -c 'psql -v ERROR_ON_STOP=1 -U sg -f ${sg_dump_file} postgres' -docker exec codeintel-db sh -c 'psql -v ERROR_ON_STOP=1 -U sg -f ${codeintel_dump_file} postgres' - -docker-compose -f docker-compose.yaml up -d -echo 'TEST: Checking frontend is accessible for 1 minute' - -for i in {1..6}; do -curl -f http://localhost:80 -curl -f http://localhost:80/healthz -sleep 10 -done -echo 'Migration completed' -" diff --git a/tools/migration_vars b/tools/migration_vars deleted file mode 100644 index 198058cb3..000000000 --- a/tools/migration_vars +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -set -u - -# Please populate the following variables with details of your migration - -# The name of the sourcegraph server image. Defaults to "sourcegraph/server" -IMAGE= - -# The sourcegraph version running on both the source and destination hosts. NOTE: this version must be the same when migration data ie : 3.24.1 -VERSION= - -# The username and hostname of the host you will be migrating from. Takes the form of username@host ie: sourcegraph-user@myhost -SRC_HOST= - -# The username and hostname of the host you will be migrating too. Takes the form of username@host ie: sourcegraph-user@myhost -DST_HOST= - -# Fully qualified path to the docker-compose directory on a host -COMPOSE_DIR=