From ae62a5aa89dd051ad68223625d23f1eda62ac723 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Fri, 13 Nov 2026 00:15:32 -0600 Subject: [PATCH 1/2] Copy Docker Compose restore files into the database volumes The restore copied the dumps into /tmp in each database container. With a read-only root filesystem, /tmp is not writable and docker cp refuses the copy. Copy them into the database volumes instead, as the Kubernetes restore does, and delete them after the restore. Amp-Thread-ID: https://ampcode.com/threads/T-01a1d36e-7d38-77c8-98dc-e4678a3ad2b0 Co-authored-by: Amp --- .../deploy/docker-compose/operations.mdx | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/self-hosted/deploy/docker-compose/operations.mdx b/docs/self-hosted/deploy/docker-compose/operations.mdx index 895082fa3..5ebc851e7 100644 --- a/docs/self-hosted/deploy/docker-compose/operations.mdx +++ b/docs/self-hosted/deploy/docker-compose/operations.mdx @@ -117,40 +117,52 @@ docker compose -f db-only-migrate.docker-compose.yaml up -d 4. Copy the database files into the containers ```bash -docker cp sourcegraph_db.out pgsql:/tmp/sourcegraph_db.out -docker cp codeintel_db.out codeintel-db:/tmp/codeintel_db.out -docker cp codeinsights_db.out codeinsights-db:/tmp/codeinsights_db.out +docker cp sourcegraph_db.out pgsql:/data/sourcegraph_db.out +docker cp codeintel_db.out codeintel-db:/data/codeintel_db.out +docker cp codeinsights_db.out \ + codeinsights-db:/var/lib/postgresql/data/codeinsights_db.out ``` +The database containers can have a read-only root filesystem, so copy the files into the database volumes. Step 6 deletes them after the restore. + 5. Restore the databases ```bash docker exec pgsql \ psql -v ON_ERROR_STOP=1 --username sg \ - -f /tmp/sourcegraph_db.out postgres + -f /data/sourcegraph_db.out postgres docker exec codeintel-db \ psql -v ON_ERROR_STOP=1 --username sg \ - -f /tmp/codeintel_db.out postgres + -f /data/codeintel_db.out postgres docker exec codeinsights-db \ psql -v ON_ERROR_STOP=1 --username postgres \ - -f /tmp/codeinsights_db.out template1 + -f /var/lib/postgresql/data/codeinsights_db.out template1 +``` + +6. After all three restores succeed, delete the backup files from the containers + +```bash +docker exec pgsql rm /data/sourcegraph_db.out +docker exec codeintel-db rm /data/codeintel_db.out +docker exec codeinsights-db \ + rm /var/lib/postgresql/data/codeinsights_db.out ``` -6. Start the remaining Sourcegraph services +7. Start the remaining Sourcegraph services ```bash docker compose up -d --remove-orphans ``` -7. Verify the deployment has started +8. Verify the deployment has started ```bash docker compose ps ``` -8. Browse to your Sourcegraph deployment, login and verify your existing configuration has been restored +9. Browse to your Sourcegraph deployment, login and verify your existing configuration has been restored ## Monitoring From 9c9151427fe97604ff8f0b70031bc47dd9bb2f00 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Fri, 13 Nov 2026 00:19:13 -0600 Subject: [PATCH 2/2] Match the Kubernetes page's read-only note on the Compose page Amp-Thread-ID: https://ampcode.com/threads/T-01a1d36e-7d38-77c8-98dc-e4678a3ad2b0 Co-authored-by: Amp --- docs/self-hosted/deploy/docker-compose/operations.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/self-hosted/deploy/docker-compose/operations.mdx b/docs/self-hosted/deploy/docker-compose/operations.mdx index 5ebc851e7..86e74cc3a 100644 --- a/docs/self-hosted/deploy/docker-compose/operations.mdx +++ b/docs/self-hosted/deploy/docker-compose/operations.mdx @@ -123,7 +123,7 @@ docker cp codeinsights_db.out \ codeinsights-db:/var/lib/postgresql/data/codeinsights_db.out ``` -The database containers can have a read-only root filesystem, so copy the files into the database volumes. Step 6 deletes them after the restore. +The database containers have a read-only root filesystem, so copy the files into the database volumes. Step 6 deletes them after the restore. 5. Restore the databases