diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index 90eefa8ab..852b496b9 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -16,13 +16,6 @@ steps: command: .buildkite/verify-release/verify-release.sh agents: { queue: standard } - - label: ":rice: pure-docker-test" - command: .buildkite/vagrant-run.sh docker-test - artifact_paths: ./*.log - env: - TEST_TYPE: "pure-docker-test" - agents: { queue: "vagrant" } - - label: ":rice: docker-compose-test" command: .buildkite/vagrant-run.sh docker-test artifact_paths: ./*.log diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9210416f8..81100d3cc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,13 +2,6 @@ ### Checklist - -* [ ] Sister [deploy-sourcegraph](https://github.com/sourcegraph/deploy-sourcegraph) change: -* [ ] Sister [customer-replica](https://github.com/sourcegraph/deploy-sourcegraph-docker-customer-replica-1) change (if necessary, for any changes affecting pure-docker or configuration): * [ ] All images have a valid tag and SHA256 sum ### Test plan diff --git a/README.md b/README.md index a8739f6c8..c272c0fb6 100644 --- a/README.md +++ b/README.md @@ -29,16 +29,6 @@ We've made our deployment configurations open source to better serve our custome [Open an issue (in sourcegraph/sourcegraph)](https://github.com/sourcegraph/sourcegraph/issues/new?assignees=&labels=deploy-sourcegraph&template=deploy-sourcegraph.md&title=%5Bdeploy-sourcegraph%5D) or contact us (support@sourcegraph.com), we are happy to help! -## Pure-Docker Sourcegraph cluster deployment reference - -> ⚠️ **Deprecation Notice:** The pure-Docker deployment method is planned for deprecation. - -What if your organization wants a multi-machine deployment without using Kubernetes? -What if you use a different container management platform, for example? -Anyone using a container management platform other than Kubernetes (Netflix's [Titus](https://netflix.github.io/titus/), Apache's [Mesos](http://mesos.apache.org/documentation/latest/docker-containerizer/), etc.) can use our [Pure-Docker Sourcegraph cluster deployment reference](./pure-docker/README.md) to deploy Sourcegraph. - ---- - ### Contributing #### Releasing diff --git a/RELEASING.md b/RELEASING.md deleted file mode 100644 index 86c59d4b2..000000000 --- a/RELEASING.md +++ /dev/null @@ -1,71 +0,0 @@ -# Release guide - -**This is the guide for releasing the [Pure-Docker Sourcegraph deployment reference](./pure-docker/README.md).** -The docker-compose release is done entirely via the [Sourcegraph release tool](https://about.sourcegraph.com/handbook/engineering/distribution/tools/release). - -## Customer Replica - -We maintain a copy of pure-docker in a separate [repo](https://github.com/sourcegraph/deploy-sourcegraph-docker-customer-replica-1) for a [customer](https://github.com/sourcegraph/accounts/issues/565). In the past -this was maintained in this repo as a separate series of branches that were suffixed with -customer-replica. This was deprecated in favor of the separate repo after 4.4.1. The repo is included in our release automation so no additional manual steps are required after 4.4.1. This note is just sharing context for future releases and for anyone referencing -customer-replica branches. - -## Branching/tagging scheme - -Just like deploy-sourcegraph, we use version branches and version tags. - -- Tag examples: `v3.8.2`, `v3.9.2` -- Branch examples: `3.8`, `3.9` - -## Releasing a new version - -### Create the release branch - -> ⚠️ If you are using the Sourcegraph release tooling, this step will be done for you in the PR it creates. Learn more about the release process in [the handbook](https://about.sourcegraph.com/handbook/engineering/releases). In this case, do not do this step manually. - -For example if releasing `v3.17.2` then create this branch from latest `master`: - -``` -git checkout -B 3.17 -git push --set-upstream origin 3.17 -``` - -### Update the image tags - -> ⚠️ If you are using the Sourcegraph release tooling, this step will be done for you in the PR it creates. Learn more about the release process in [the handbook](https://about.sourcegraph.com/handbook/engineering/releases). In this case, do not do this step manually. - -In the latest release branch you created: - -1. Run `tools/update-docker-tags.sh $VERSION` -2. Confirm the diff shows the image tags being updated to the version you expect, and push directly to the release branch. - -### Smoke Test: ensure Pure-Docker starts from scratch - -> ⚠️ This test now runs in Buildkite, under the `pure-docker-test` step - you can validate [the results of the CI run](https://buildkite.com/sourcegraph/deploy-sourcegraph-docker) instead. -### Smoke test: ensure Docker Compose starts from scratch - -> ⚠️ This test now runs in Buildkite, under the `docker-compose-test` step - you can validate [the results of the CI run](https://buildkite.com/sourcegraph/deploy-sourcegraph-docker) instead. - -Refer to the [testing documentation](TESTING.md) for running tests from your local machine. - -### Smoke test: ensure Docker Compose upgrades work - -> ⚠️ This test now runs in Buildktie, in the `qa` pipeline under the `Sourcegraph Upgrade` step, you can validate [the results of the CI run](https://buildkite.com/sourcegraph) - -Refer to the [testing documentation](TESTING.md) for running tests from your local machine. - -### Tag the final release - -> ⚠️ If you are using the Sourcegraph release tooling, this will be done for you as part of the release steps. Learn more about the release process in [the handbook](https://about.sourcegraph.com/handbook/engineering/releases). In this case, do not do this step manually. - -For example: - -``` -git checkout 3.9 -git tag v3.9.2 -git push origin v3.9.2 -``` - -## Releasing pure-docker - -For pure-docker, we provide customers with an exact diff of changes to make. They do not run our deploy.sh scripts directly, instead they copy them or adapt them to their own deployment environment entirely. This means we must carefully communicate each change that is made. - -To reduce the chance for errors, we send an exact diff of changes. This diff needs to be as minimal and concise as possible, and e.g. not include changes to unrelated files like `.prettierignore` or `docker-compose/` to avoid any confusion. See https://docs.sourcegraph.com/admin/updates/pure_docker for examples of what these diffs look like. diff --git a/TESTING.md b/TESTING.md index 3705621d3..21513d33f 100644 --- a/TESTING.md +++ b/TESTING.md @@ -16,14 +16,14 @@ gcloud auth application-default login - `VAGRANT_GCP_PROJECT_ID`: Project to run on. (default: `sourcegraph-server`) - `VAGRANT_SSH_USER`: Your SSH user ID as specified in GCP metadata. (default: `ENV['USER']`) - `VAGRANT_SSH_KEY`: Path to your SSH Keys as specified in GCP metadata. (default: `~/.ssh/id_rsa`) - - `TEST_TYPE`: Deployment type to test, `pure-docker-test` or `docker-compose-test`. + - `TEST_TYPE`: Deployment type to test, `docker-compose-test`. ``` .buildkite/vagrant-run.sh docker-test ``` -This command will start a GCP instance, upload your local copy of the reposistory and run the relevant smoke test for each deployment type, [pure-docker-test](test/pure-docker/smoke-test.sh) or [docker-compose-test](test/docker-compose/smoke-test.sh). +This command will start a GCP instance, upload your local copy of the reposistory and run the relevant smoke test for the docker-compose deployment type. -To run any additional tests or commands, edit [servers.yaml](test/pure-docker/servers.yaml) and add the commands to the `shell_commands` list, eg: +To run any additional tests or commands, edit the servers.yaml and add the commands to the `shell_commands` list, eg: ``` shell_commands: - [...] diff --git a/batch-change/release.yaml b/batch-change/release.yaml index 61deea276..2534f0a07 100644 --- a/batch-change/release.yaml +++ b/batch-change/release.yaml @@ -34,33 +34,18 @@ internal: set -eu registry=us-docker.pkg.dev/sourcegraph-images/internal sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=us-docker.pkg.dev/sourcegraph-images/internal - sg ops update-images --registry ${registry} --kind pure-docker --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../pure-docker/ minor: - name: docker(compose):tags cmd: | set -eu registry=us-docker.pkg.dev/sourcegraph-images/internal sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=us-docker.pkg.dev/sourcegraph-images/internal - sg ops update-images --registry ${registry} --kind pure-docker --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../pure-docker/ major: - name: docker(compose):tags cmd: | set -eu registry=us-docker.pkg.dev/sourcegraph-images/internal sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=us-docker.pkg.dev/sourcegraph-images/internal - sg ops update-images --registry ${registry} --kind pure-docker --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../pure-docker/ finalize: steps: - name: "git:finalize" @@ -122,11 +107,6 @@ promoteToPublic: set -eu registry=index.docker.io/sourcegraph sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=index.docker.io/sourcegraph - sg ops update-images --registry ${registry} --kind pure-docker --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../pure-docker/ finalize: steps: - name: 'Promote on release registry' @@ -198,12 +178,6 @@ promoteToPublic: registry=index.docker.io/sourcegraph sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=index.docker.io/sourcegraph - sg ops update-images --registry ${registry} --kind pure-docker --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD ../pure-docker/ - - name: "git:branch" cmd: | set -eu diff --git a/pure-docker/README.md b/pure-docker/README.md deleted file mode 100644 index fe8c44e60..000000000 --- a/pure-docker/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Pure-Docker Sourcegraph cluster deployment reference - -> ⚠️ **Deprecation Notice:** The pure-Docker deployment method is planned for deprecation. - -## Deploying - -First clone the repository, then: - -```bash -./deploy.sh -``` - -Visit http://localhost:3080 to visit the running Sourcegraph instance! - -## Tearing down the deployment - -```bash -./teardown.sh -``` - -## System topology - -To understand the system topology: - -1. Look at `deploy.sh` to get an overview of services. -2. Every service (`deploy-*.sh`) has documentation inline indicating: - - What the service does / provides. - - What ports the service exposes. - - What other services it talks to (see environment variables). - -## Service system requirements - -Every service (`deploy-*.sh`) documents inline what the system requirements are (CPU/Memory/Disk allocation). For example, [the frontend service](https://github.com/sourcegraph/deploy-sourcegraph-docker/blob/f01b97a397138dd76e5f5ed45b2574b9a2e70cd1/deploy-frontend.sh#L6-L9). - -## Scaling / replicas - -To scale the cluster deployment, you will need to: - -1. Deploy more instances of `gitserver`, `indexed-search`, `searcher` and `symbols` services as desired. -2. [Configure the `frontend` and `frontend-internal` to communicate with the new instances.](https://github.com/sourcegraph/deploy-sourcegraph-docker/blob/f01b97a397138dd76e5f5ed45b2574b9a2e70cd1/deploy-frontend.sh#L31-L34) -3. You're done! You do not need to configure or restart any other services. - -## Metrics and Tracing - -This deployment comes with metrics and tracing built-in. See [metrics and tracing](metrics-and-tracing.md) for details. - -## Configuring HTTPS - -See https://docs.sourcegraph.com/admin/nginx#nginx-for-other-sourcegraph-clusters-e-g-pure-docker - -## Configuring SSH cloning - -1. Ensure your **Site admin** > **External services** code host configuration is configured to use SSH. For example, by setting the [`gitURLType`](https://docs.sourcegraph.com/admin/site_config/all#giturltype-string-enum) field to `"ssh"`. You may still need to configure an access token or other codehost authentication method in order for Sourcegraph to discover your repositories. - -Alternatively, you may use the `OTHER` codehost type under **External services**, which allows you to directly specify Git repository URLs for cloning. - -2. Provide your `gitserver` instances with your SSH / Git configuration (usually just `.ssh/id_rsa`, `.ssh/id_rsa.pub`, and `.ssh/known_hosts` -- but you can also provide other files like `.netrc`, `.gitconfig`, etc. if needed) by mounting it into the `sourcegraph` users home directory in the `gitserver` containers. For example, by adding the following flag: - -``` --v ~/my-sourcegraph-ssh-config/.ssh:/home/sourcegraph/.ssh -``` - -All future Git cloning operations will use the credentials configured there. - -If you wish, you can test that cloning with your configuration is working by performing the clone in a gitserver container shell, e.g. first acquire shell access: - -``` -$ docker exec -it gitserver-0 sh -``` - -Then try cloning the repository: - -``` -$ git clone ssh://git@myhost.com/my/repo /tmp/my-repo -``` -## Questions & Issues - -[Open an issue (in sourcegraph/sourcegraph)](https://github.com/sourcegraph/sourcegraph/issues/new?assignees=&labels=deploy-sourcegraph-docker&template=deploy-sourcegraph-docker.md&title=%5Bdeploy-sourcegraph-docker%5D) or contact us (support@sourcegraph.com), we are happy to help! diff --git a/pure-docker/deploy-blobstore.sh b/pure-docker/deploy-blobstore.sh deleted file mode 100755 index bafedb323..000000000 --- a/pure-docker/deploy-blobstore.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: generic S3-like blobstore for storing LSIF uploads. -# -# Disk: 128GB / persistent SSD -# Network: 1Gbps -# Liveness probe: HTTP GET http://blobstore:9000/ -# Ports exposed to other Sourcegraph services: 9000/TCP -# Ports exposed to public internet: none -# -VOLUME="$HOME/sourcegraph-docker/blobstore-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=blobstore \ - --network=sourcegraph \ - --restart=always \ - --cpus=1 \ - --memory=1g \ - -p 0.0.0.0:9000:9000 \ - -v $VOLUME:/data \ - index.docker.io/sourcegraph/blobstore:187572_2022-12-06_cbecc5321c7d@sha256:8e57384c78a3b31cbe31d41656dbcbb8ee7279d96630a33936a2098afabb1317 diff --git a/pure-docker/deploy-caddy.sh b/pure-docker/deploy-caddy.sh deleted file mode 100755 index 5bce63891..000000000 --- a/pure-docker/deploy-caddy.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Acts as a reverse proxy for all of the sourcegraph-frontend instances -# -# Disk: 1GB / persistent SSD -# Ports exposed to other Sourcegraph services: none -# Ports exposed to the public internet: 80 (HTTP) and 443 (HTTPS) -# -# Sourcegraph ships with a few builtin templates that cover common HTTP/HTTPS configurations: -# - HTTP only (default) -# - HTTPS with Let's Encrypt -# - HTTPS with custom certificates -# -# Follow the directions in the comments below to swap between these configurations. -# -# If none of these built-in configurations suit your needs, then you can create your own Caddyfile, see: -# https://caddyserver.com/docs/caddyfile - -VOLUME="$HOME/sourcegraph-docker/caddy-storage" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=caddy \ - --network=sourcegraph \ - --restart=always \ - --cpus="4" \ - --memory=4g \ - -e XDG_DATA_HOME="/caddy-storage/data" \ - -e XDG_CONFIG_HOME="/caddy-storage/config" \ - -e SRC_FRONTEND_ADDRESSES="sourcegraph-frontend-0:3080" \ - -p 0.0.0.0:80:80 \ - -p 0.0.0.0:443:443 \ - -v "$VOLUME:/caddy-storage" \ - --mount type=bind,source="$(pwd)"/../caddy/builtins/http.Caddyfile,target=/etc/caddy/Caddyfile \ - index.docker.io/sourcegraph/caddy:269106_2024-04-15_5.3-d8deee19f4ae@sha256:13b9ee03ca9feba90d83129922f96ee9c1b40064a048b73feac3a334e27c3aa1 diff --git a/pure-docker/deploy-cadvisor.sh b/pure-docker/deploy-cadvisor.sh deleted file mode 100755 index 7930ffc7d..000000000 --- a/pure-docker/deploy-cadvisor.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Publishes Prometheus metrics about Docker containers. -# -# Disk: none -# Network: 100mbps -# Liveness probe: none -# Ports exposed to other Sourcegraph services: 8080/TCP -# Ports exposed to the public internet: none -# -# Also add the following volume mount for container monitoring on MacOS: -# --volume='/var/run/docker.sock:/var/run/docker.sock:ro' -# -# You may remove the --privileged flag to 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. -# If you would like to bring your own infrastructure monitoring & alerting solution, -# you may want to remove the `cadvisor` container completely -sudo docker run --detach \ - --name=cadvisor \ - --network=sourcegraph \ - --restart=always \ - --cpus=1 \ - --memory=1g \ - --volume=/:/rootfs:ro \ - --volume=/var/run:/var/run:ro \ - --volume=/sys:/sys:ro \ - --volume=/var/lib/docker/:/var/lib/docker:ro \ - --volume=/dev/disk/:/dev/disk:ro \ - --privileged \ - --device=/dev/kmsg \ - index.docker.io/sourcegraph/cadvisor:187572_2022-12-06_cbecc5321c7d@sha256:755748f2f9b00d8f70bd65349e85235585bdf1a663e26198c8eaf91dfd5636e1 \ - --port=8080 - -echo "Deployed cadvisor" diff --git a/pure-docker/deploy-codeinsights-db.sh b/pure-docker/deploy-codeinsights-db.sh deleted file mode 100755 index 22628d77c..000000000 --- a/pure-docker/deploy-codeinsights-db.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: PostgreSQL database for code insights data. -# -# Disk: 128GB / persistent SSD -# Network: 1Gbps -# Liveness probe: 5432/TCP -# Ports exposed to other Sourcegraph services: 5432/TCP 9187/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/codeinsights-db-disk" -./ensure-volume.sh $VOLUME 999 - -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/postgresql-16-codeinsights:insiders - -# Sourcegraph requires PostgreSQL 12+. Generally newer versions are better, -# but anything 12 and higher is supported. - -echo "Deployed codeinsights-db service" diff --git a/pure-docker/deploy-codeintel-db.sh b/pure-docker/deploy-codeintel-db.sh deleted file mode 100755 index c5a550cce..000000000 --- a/pure-docker/deploy-codeintel-db.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: PostgreSQL database for code intelligence data. -# -# Disk: 128GB / persistent SSD -# Network: 1Gbps -# Liveness probe: 5432/TCP -# Ports exposed to other Sourcegraph services: 5432/TCP 9187/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/codeintel-db-disk" -./ensure-volume.sh $VOLUME 999 -docker run --detach \ - --name=codeintel-db \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=2g \ - -e PGDATA=/var/lib/postgresql/data/pgdata \ - -v $VOLUME:/var/lib/postgresql/data/ \ - index.docker.io/sourcegraph/postgresql-16:insiders - -# Sourcegraph requires PostgreSQL 12+. Generally newer versions are better, -# but anything 12 and higher is supported. - -echo "Deployed codeintel-db service" diff --git a/pure-docker/deploy-frontend-internal.sh b/pure-docker/deploy-frontend-internal.sh deleted file mode 100755 index c1596e98e..000000000 --- a/pure-docker/deploy-frontend-internal.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Serves the internal Sourcegraph frontend API. -# -# Disk: 128GB / non-persistent SSD -# Network: 100mbps -# Liveness probe: n/a -# Ports exposed to other Sourcegraph services: 3090/TCP 6060/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/sourcegraph-frontend-internal-0-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=sourcegraph-frontend-internal \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=8g \ - --health-cmd="wget -q 'http://127.0.0.1:3080/healthz' -O /dev/null || exit 1" \ - --health-interval=5s \ - --health-timeout=10s \ - --health-retries=3 \ - --health-start-period=300s \ - -e DEPLOY_TYPE=pure-docker \ - -e GOMAXPROCS=4 \ - -e PGHOST=pgsql \ - -e CODEINTEL_PGHOST=codeintel-db \ - -e CODEINSIGHTS_PGDATASOURCE=postgres://postgres:password@codeinsights-db:5432/postgres \ - -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 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 \ - -e PROMETHEUS_URL=http://prometheus:9090 \ - -e PRECISE_CODE_INTEL_UPLOAD_BACKEND=blobstore \ - -e PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT=http://blobstore:9000 \ - -v $VOLUME:/mnt/cache \ - index.docker.io/sourcegraph/frontend:187572_2022-12-06_cbecc5321c7d@sha256:73e64a8636e70ebbaf7f4a3300479529294f67e8cf644cdaea02435915aec869 - -echo "Deployed sourcegraph-frontend-internal service" diff --git a/pure-docker/deploy-frontend.sh b/pure-docker/deploy-frontend.sh deleted file mode 100755 index 77037aa29..000000000 --- a/pure-docker/deploy-frontend.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Serves the frontend of Sourcegraph via HTTP(S). -# -# Disk: 128GB / non-persistent SSD -# Network: 100mbps -# Liveness probe: HTTP GET http://sourcegraph-frontend:3080/healthz -# Ports exposed to other Sourcegraph services: 6060/TCP -# Ports exposed to the public internet: 3080 (HTTP) and/or 3443 (HTTPS) -# -VOLUME="$HOME/sourcegraph-docker/sourcegraph-frontend-$1-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=sourcegraph-frontend-$1 \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=8g \ - --health-cmd="wget -q 'http://127.0.0.1:3080/healthz' -O /dev/null || exit 1" \ - --health-interval=5s \ - --health-timeout=10s \ - --health-retries=5 \ - --health-start-period=300s \ - -e DEPLOY_TYPE=pure-docker \ - -e GOMAXPROCS=12 \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -e PGHOST=pgsql \ - -e CODEINTEL_PGHOST=codeintel-db \ - -e CODEINSIGHTS_PGDATASOURCE=postgres://postgres:password@codeinsights-db:5432/postgres \ - -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 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 \ - -e PROMETHEUS_URL=http://prometheus:9090 \ - -e PRECISE_CODE_INTEL_UPLOAD_BACKEND=blobstore \ - -e PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT=http://blobstore:9000 \ - -v $VOLUME:/mnt/cache \ - -p 0.0.0.0:$((3080 + $1)):3080 \ - index.docker.io/sourcegraph/frontend:187572_2022-12-06_cbecc5321c7d@sha256:73e64a8636e70ebbaf7f4a3300479529294f67e8cf644cdaea02435915aec869 - -# 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. - -echo "Deployed sourcegraph-frontend $1 service" diff --git a/pure-docker/deploy-gitserver.sh b/pure-docker/deploy-gitserver.sh deleted file mode 100755 index ba7429fde..000000000 --- a/pure-docker/deploy-gitserver.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Stores clones of repositories to perform Git operations. -# -# Disk: 200GB / persistent SSD -# Network: 100mbps -# Liveness probe: n/a -# Ports exposed to other Sourcegraph services: 3178/TCP 6060/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/gitserver-$1-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=gitserver-$1 \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=8g \ - --hostname=gitserver-$1 \ - -e GOMAXPROCS=4 \ - -e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -v $VOLUME:/data/repos \ - index.docker.io/sourcegraph/gitserver:187572_2022-12-06_cbecc5321c7d@sha256:87642b2f0cccbdcd661e470c8f7aa6c022ab03065a2c8ab565afc4b8829a4531 - -echo "Deployed gitserver $1 service" diff --git a/pure-docker/deploy-grafana.sh b/pure-docker/deploy-grafana.sh deleted file mode 100755 index a1ca16c17..000000000 --- a/pure-docker/deploy-grafana.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Dashboards and graphs for Prometheus metrics. -# -# Disk: 2GB / persistent SSD -# Network: 100mbps -# Liveness probe: n/a -# Ports exposed to other Sourcegraph services: none -# Ports exposed to the public internet: none (HTTP 3000 should be exposed to admins only) -# -VOLUME="$HOME/sourcegraph-docker/grafana-disk" -./ensure-volume.sh $VOLUME 472 -docker run --detach \ - --name=grafana \ - --network=sourcegraph \ - --restart=always \ - --cpus=1 \ - --memory=1g \ - -v $VOLUME:/var/lib/grafana \ - -v $(pwd)/../grafana/datasources:/sg_config_grafana/provisioning/datasources \ - -v $(pwd)/../grafana/dashboards:/sg_grafana_additional_dashboards \ - index.docker.io/sourcegraph/grafana:187572_2022-12-06_cbecc5321c7d@sha256:cf295a1dada50607a364390a54744dbc9142aa99b42c07f1bb623ca251639d2c - -# Add the following lines above if you wish to use an auth proxy with Grafana: -# -# -e GF_AUTH_PROXY_ENABLED=true \ -# -e GF_AUTH_PROXY_HEADER_NAME='X-Forwarded-User' \ -# -e GF_SERVER_ROOT_URL='https://grafana.example.com' \ diff --git a/pure-docker/deploy-migrator.sh b/pure-docker/deploy-migrator.sh deleted file mode 100755 index 3dd0de77b..000000000 --- a/pure-docker/deploy-migrator.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Performs database migrations -# -# Network: 100mbps -# Liveness probe: n/a -# Ports exposed to other Sourcegraph services: none -# Ports exposed to the public internet: none -# - -docker run --detach \ - --name=migrator \ - --network=sourcegraph \ - --restart=on-failure \ - --cpus=1 \ - --memory=1g \ - -e PGHOST=pgsql \ - -e PGUSER=sg \ - -e CODEINTEL_PGUSER=sg \ - -e CODEINTEL_PGHOST=codeintel-db \ - -e CODEINSIGHTS_PGDATASOURCE=postgres://postgres:password@codeinsights-db:5432/postgres \ - index.docker.io/sourcegraph/migrator:187572_2022-12-06_cbecc5321c7d@sha256:93fc175df594738a98a62f2057271824cdb674b0e63bedac9dc7cb0f04db76bb \ - up -db=all - -echo "Deployed migrator service" diff --git a/pure-docker/deploy-node-exporter.sh b/pure-docker/deploy-node-exporter.sh deleted file mode 100755 index f3a5cb658..000000000 --- a/pure-docker/deploy-node-exporter.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Publishes Prometheus metrics about the machine's hardware / operating system. -# -# Disk: none -# Ports exposed to other Sourcegraph services: 9100/TCP -# Ports exposed to the public internet: none -# -sudo docker run --detach \ - --name=node-exporter \ - --network=sourcegraph \ - --restart=always \ - --cpus=0.5 \ - --memory=1g \ - --pid='host' \ - --volume=/:/rootfs:ro \ - --volume=/proc:/host/proc:ro \ - --volume=/sys:/host/sys:ro \ - -p 0.0.0.0:9100:9100 \ - index.docker.io/sourcegraph/node-exporter:187572_2022-12-06_cbecc5321c7d@sha256:2d9dcdf0b2226f0c3d550a64d2667710265462350a3ba9ebe37d0302bc64af0f \ - '--path.procfs=/host/proc' \ - '--path.rootfs=/rootfs' \ - '--path.sysfs=/host/sys' \ - '--no-collector.wifi' \ - '--no-collector.hwmon' \ - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' - -echo "Deployed node-exporter" diff --git a/pure-docker/deploy-otel-collector.sh b/pure-docker/deploy-otel-collector.sh deleted file mode 100755 index 6fd7b09d6..000000000 --- a/pure-docker/deploy-otel-collector.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Ingests and exports OpenTelemetry data. -# -# Disk: none -# Ports exposed to other Sourcegraph services: 4317 (receiver), 55679 (zpages) -# Ports exposed to the public internet: none -# -docker run --detach \ - --name=otel-collector \ - --network=sourcegraph \ - --restart=always \ - --cpus="1" \ - --memory=1g \ - -e JAEGER_HOST=jaeger \ - -v $(pwd)/../otel-collector/config.yaml:/etc/otel-collector/config.yaml \ - index.docker.io/sourcegraph/opentelemetry-collector:187572_2022-12-06_cbecc5321c7d@sha256:113a84fcef33f06f7e529961d5eb64400488953b23ac07ea8a3d628db6789ef0 \ - --config /etc/otel-collector/configs/logging.yaml diff --git a/pure-docker/deploy-pgsql.sh b/pure-docker/deploy-pgsql.sh deleted file mode 100755 index cf7f670ac..000000000 --- a/pure-docker/deploy-pgsql.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: PostgreSQL database for various data. -# -# Disk: 128GB / persistent SSD -# Network: 100mbps -# Liveness probe: 5432/TCP -# Ports exposed to other Sourcegraph services: 5432/TCP 9187/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/pgsql-disk" -./ensure-volume.sh $VOLUME 999 -docker run --detach \ - --name=pgsql \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=2g \ - -e PGDATA=/var/lib/postgresql/data/pgdata \ - -v $VOLUME:/var/lib/postgresql/data/ \ - index.docker.io/sourcegraph/postgresql-16:insiders - -# Sourcegraph requires PostgreSQL 12+. Generally newer versions are better, -# but anything 12 and higher is supported. - -echo "Deployed pgsql service" diff --git a/pure-docker/deploy-precise-code-intel-worker.sh b/pure-docker/deploy-precise-code-intel-worker.sh deleted file mode 100755 index f93d40250..000000000 --- a/pure-docker/deploy-precise-code-intel-worker.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Handles conversion of uploaded precise code intelligence bundles. -# -# Ports exposed to other Sourcegraph services: 3188/TCP -# Ports exposed to the public internet: none -# -docker run --detach \ - --name=precise-code-intel-worker \ - --network=sourcegraph \ - --restart=always \ - --cpus=2 \ - --memory=4g \ - -e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -e PRECISE_CODE_INTEL_UPLOAD_BACKEND=blobstore \ - -e PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT=http://blobstore:9000 \ - index.docker.io/sourcegraph/precise-code-intel-worker:187572_2022-12-06_cbecc5321c7d@sha256:d1b1546d784fec8c90928a40e1b7eafc33202a53e4fcd501001d3f4a73e5c8ce - -echo "Deployed precise-code-intel-worker service" diff --git a/pure-docker/deploy-prometheus.sh b/pure-docker/deploy-prometheus.sh deleted file mode 100755 index e7a3065ca..000000000 --- a/pure-docker/deploy-prometheus.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Prometheus collects metrics and aggregates them into graphs. -# -# Disk: 200GB / persistent SSD -# Network: 100mbps -# Liveness probe: n/a -# Ports exposed to other Sourcegraph services: none -# Ports exposed to the public internet: none (HTTP 9090 should be exposed to admins only) -# -VOLUME="$HOME/sourcegraph-docker/prometheus-v2-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=prometheus \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=8g \ - -p 0.0.0.0:9090:9090 \ - -v $VOLUME:/prometheus \ - -v $(pwd)/../prometheus:/sg_prometheus_add_ons \ - -e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \ - index.docker.io/sourcegraph/prometheus:187572_2022-12-06_cbecc5321c7d@sha256:2113ccab80409e995ee7ed9a3d386051f4ca73186375a3a0d7e3d55c90fa2007 diff --git a/pure-docker/deploy-redis-cache.sh b/pure-docker/deploy-redis-cache.sh deleted file mode 100755 index 2a9e7698c..000000000 --- a/pure-docker/deploy-redis-cache.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Redis for storing short-lived caches. -# -# Disk: 128GB / persistent SSD -# Network: 100mbps -# Liveness probe: 6379/TCP -# Ports exposed to other Sourcegraph services: 6379/TCP 9121/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/redis-cache-disk" -./ensure-volume.sh $VOLUME 999 -docker run --detach \ - --name=redis-cache \ - --network=sourcegraph \ - --restart=always \ - --cpus=1 \ - --memory=6g \ - -v $VOLUME:/redis-data \ - index.docker.io/sourcegraph/redis-cache:187572_2022-12-06_cbecc5321c7d@sha256:bb62b6d761513b1651e8499532570068a4509d5d0cf5131f0dd8b8e2ef74c72d - -echo "Deployed redis-cache service" diff --git a/pure-docker/deploy-redis-store.sh b/pure-docker/deploy-redis-store.sh deleted file mode 100755 index c123e578a..000000000 --- a/pure-docker/deploy-redis-store.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Redis for storing semi-persistent data like user sessions. -# -# Disk: 128GB / persistent SSD -# Network: 100mbps -# Liveness probe: 6379/TCP -# Ports exposed to other Sourcegraph services: 6379/TCP 9121/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/redis-store-disk" -./ensure-volume.sh $VOLUME 999 -docker run --detach \ - --name=redis-store \ - --network=sourcegraph \ - --restart=always \ - --cpus=1 \ - --memory=6g \ - -v $VOLUME:/redis-data \ - index.docker.io/sourcegraph/redis-store:187572_2022-12-06_cbecc5321c7d@sha256:a3e4f611bcf1fe6f256a54b81f6ddb9fc2e45d7a038fa276b800b895eca09fe5 - -echo "Deployed redis-store service" diff --git a/pure-docker/deploy-searcher.sh b/pure-docker/deploy-searcher.sh deleted file mode 100755 index 0b229755c..000000000 --- a/pure-docker/deploy-searcher.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Backend for text search operations. -# -# Disk: 128GB / non-persistent SSD -# Network: 100mbps -# Liveness probe: HTTP GET http://searcher:3181/healthz -# Ports exposed to other Sourcegraph services: 3181/TCP 6060/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/searcher-$1-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=searcher-$1 \ - --network=sourcegraph \ - --restart=always \ - --cpus=2 \ - --memory=2g \ - -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/searcher:187572_2022-12-06_cbecc5321c7d@sha256:c0d7b580c31e956dc586e3947edd2afb850cf5954e83010236294c57478256da - -echo "Deployed searcher $1 service" diff --git a/pure-docker/deploy-syntactic-code-intel-worker.sh b/pure-docker/deploy-syntactic-code-intel-worker.sh deleted file mode 100755 index 2c199178a..000000000 --- a/pure-docker/deploy-syntactic-code-intel-worker.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: High level syntax analysis -# -# Ports exposed to other Sourcegraph services: 3288/TCP -# Ports exposed to the public internet: none -# -# NOTE: Keep in sync with https://github.com/sourcegraph/deploy-sourcegraph-docker/blob/main/docker-compose/docker-compose.yaml#L372 -# -docker run --detach \ - --name=syntactic-code-intel-worker \ - --network=sourcegraph \ - --restart=always \ - --cpus=2 \ - --memory=4g \ - -e 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' \ - -e 'PRECISE_CODE_INTEL_UPLOAD_BACKEND=blobstore' \ - -e 'PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT=http://blobstore:9000' \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -e 'SYNTACTIC_CODE_INTEL_WORKER_ADDR=:3288' \ - index.docker.io/sourcegraph/syntactic-code-intel-worker:6.1.1295@sha256:c6e2b097b8f16394e339588e208c43587f1fa6a35cb44e9759622c448ddc1445 - -echo "Deployed syntactic-code-intel-worker service" diff --git a/pure-docker/deploy-syntect-server.sh b/pure-docker/deploy-syntect-server.sh deleted file mode 100755 index e1229c43e..000000000 --- a/pure-docker/deploy-syntect-server.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Backend for syntax highlighting operations. -# -# Disk: none -# Network: 100mbps -# Liveness probe: HTTP GET http://syntect-server:9238/health -# Ports exposed to other Sourcegraph services: 9238/TCP 6060/TCP -# Ports exposed to the public internet: none -# -docker run --detach \ - --name=syntect-server \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=6g \ - index.docker.io/sourcegraph/syntax-highlighter:187572_2022-12-06_cbecc5321c7d@sha256:b88b20f56e942cc253109bb7f4b07746ebaecc2ff7393cdaf6415ffb8778fc45 - -echo "Deployed syntect-server service" diff --git a/pure-docker/deploy-worker.sh b/pure-docker/deploy-worker.sh deleted file mode 100755 index c4876b819..000000000 --- a/pure-docker/deploy-worker.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Manages background processes. -# -# Disk: 128GB / non-persistent SSD -# Network: 100mbps -# Liveness probe: n/a -# Ports exposed to other Sourcegraph services: 3189/TCP 6060/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/worker-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=worker \ - --network=sourcegraph \ - --restart=always \ - --cpus=4 \ - --memory=4g \ - -e GOMAXPROCS=1 \ - -e SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090 \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -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 PRECISE_CODE_INTEL_UPLOAD_BACKEND=blobstore \ - -e PRECISE_CODE_INTEL_UPLOAD_AWS_ENDPOINT=http://blobstore:9000 \ - -v $VOLUME:/mnt/cache \ - index.docker.io/sourcegraph/worker:187572_2022-12-06_cbecc5321c7d@sha256:0092211fee815b82d426ccf0a30999f8fb40749811e3a83c7570e576f028da74 - -echo "Deployed worker service" diff --git a/pure-docker/deploy-zoekt-indexserver.sh b/pure-docker/deploy-zoekt-indexserver.sh deleted file mode 100755 index 64f7d3f18..000000000 --- a/pure-docker/deploy-zoekt-indexserver.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Rename the old ~/sourcegraph-docker/zoekt-shared-disk -> ~/sourcegraph-docker/zoekt-$1-shared-disk -# if it exists. This ensures we don't have to rebuild the search index from scratch. -if [ -e ~/sourcegraph-docker/zoekt-shared-disk ]; then - mv ~/sourcegraph-docker/zoekt-shared-disk ~/sourcegraph-docker/zoekt-$1-shared-disk -fi - -# Description: Backend for indexed text search operations. -# -# Disk: 200GB / persistent SSD -# Network: 100mbps -# Liveness probe: n/a -# Ports exposed to other Sourcegraph services: 6072/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/zoekt-$1-shared-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=zoekt-indexserver-$1 \ - --hostname=zoekt-indexserver-$1 \ - --network=sourcegraph \ - --restart=always \ - --cpus=8 \ - --memory=16g \ - -e GOMAXPROCS=8 \ - -e HOSTNAME=zoekt-webserver-$1:6070 \ - -e SRC_FRONTEND_INTERNAL=http://sourcegraph-frontend-internal:3090 \ - -e 'OPENTELEMETRY_DISABLED=false' \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -v $VOLUME:/data/index \ - index.docker.io/sourcegraph/search-indexer:187572_2022-12-06_cbecc5321c7d@sha256:a3ae20e4130b4846e2c3078b9ba942854890348da37c8fa7ee385c081b7d1666 - -echo "Deployed zoekt-indexserver $1 service" diff --git a/pure-docker/deploy-zoekt-webserver.sh b/pure-docker/deploy-zoekt-webserver.sh deleted file mode 100755 index 393dae383..000000000 --- a/pure-docker/deploy-zoekt-webserver.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -set -e -source ./replicas.sh - -# Description: Backend for indexed text search operations. -# -# Disk: 200GB / persistent SSD -# Network: 100mbps -# Liveness probe: HTTP GET http://zoekt-webserver-$1:6070/healthz -# Ports exposed to other Sourcegraph services: 6070/TCP -# Ports exposed to the public internet: none -# -VOLUME="$HOME/sourcegraph-docker/zoekt-$1-shared-disk" -./ensure-volume.sh $VOLUME 100 -docker run --detach \ - --name=zoekt-webserver-$1 \ - --hostname=zoekt-webserver-$1 \ - --network=sourcegraph \ - --restart=always \ - --cpus=16 \ - --memory=100g \ - -e GOMAXPROCS=16 \ - -e HOSTNAME=zoekt-webserver-$1:6070 \ - -e 'OPENTELEMETRY_DISABLED=false' \ - -e 'OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317' \ - -v $VOLUME:/data/index \ - index.docker.io/sourcegraph/indexed-searcher:187572_2022-12-06_cbecc5321c7d@sha256:79bec59c17482e4039931ed083113bd8723d74c42b96c3c489062f6b33b806f0 - -echo "Deployed zoekt-webserver $1 service" diff --git a/pure-docker/deploy.sh b/pure-docker/deploy.sh deleted file mode 100755 index c544a1cd7..000000000 --- a/pure-docker/deploy.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash -set -e - -root_dir="$(dirname "${BASH_SOURCE[0]}")" -cd "$root_dir" - -source ./replicas.sh - -./teardown.sh - -docker network create sourcegraph &>/dev/null || true - -./deploy-node-exporter.sh -./deploy-cadvisor.sh -for i in $(seq 0 $(($NUM_GITSERVER - 1))); do ./deploy-gitserver.sh $i; done -./deploy-grafana.sh -./deploy-precise-code-intel-worker.sh -./deploy-syntactic-code-intel-worker.sh -./deploy-pgsql.sh -./deploy-codeintel-db.sh -./deploy-codeinsights-db.sh -./deploy-blobstore.sh -./deploy-prometheus.sh -./deploy-redis-cache.sh -./deploy-redis-store.sh -./deploy-worker.sh -./deploy-otel-collector.sh -for i in $(seq 0 $(($NUM_SEARCHER - 1))); do ./deploy-searcher.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 - -./deploy-migrator.sh -while [ "$(docker inspect migrator --format '{{.State.Status}}')" != "exited" ]; do - echo "waiting for migrator to complete" - sleep 5 -done - -# Redis must be started before these. -./deploy-frontend-internal.sh -# Wait for frontend-internal to run migrations before starting remaining frontend containers -while [ "$(docker inspect sourcegraph-frontend-internal --format '{{.State.Health.Status}}')" != "healthy" ]; do - echo "waiting for internal frontend to start" - sleep 5 -done - -for i in $(seq 0 $(($NUM_FRONTEND - 1))); do ./deploy-frontend.sh $i; done -./deploy-caddy.sh -wait diff --git a/pure-docker/ensure-volume.sh b/pure-docker/ensure-volume.sh deleted file mode 100755 index 2fa74d3ad..000000000 --- a/pure-docker/ensure-volume.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -set -euf -o pipefail - -VOLUME=$1 -USER_ID=$2 - -if [ ! -d $VOLUME ]; then - mkdir -p $VOLUME && sudo chown $USER_ID:$USER_ID $VOLUME && sudo chmod 777 $VOLUME -fi diff --git a/pure-docker/init-jaeger-cassandra-schema.sh b/pure-docker/init-jaeger-cassandra-schema.sh deleted file mode 100755 index f4feb4c47..000000000 --- a/pure-docker/init-jaeger-cassandra-schema.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Description: Initializes Jaeger's Cassandra database. Only needs to run once. -# Does not run persistently (exits after doing its work). -# -docker run --detach \ - --name=jaeger-cassandra-schema \ - --network=sourcegraph \ - -e CQLSH_HOST='jaeger-cassandra' \ - -e DATACENTER='sourcegraph' \ - -e KEYSPACE='jaeger_v1_sourcegraph' \ - -e MODE='prod' \ - jaegertracing/jaeger-cassandra-schema@sha256:ba0ffb1953c76705539360c2f83eafe32b977529c3399d1abeb69c94f29c45d0 - -echo "Deployed jaeger-cassandra-schema initializer" diff --git a/pure-docker/metrics-and-tracing.md b/pure-docker/metrics-and-tracing.md deleted file mode 100644 index 04621d3b3..000000000 --- a/pure-docker/metrics-and-tracing.md +++ /dev/null @@ -1,87 +0,0 @@ -# deploy-sourcegraph-docker metrics - -This deployment mode of Sourcegraph features metrics that are a staple in other cluster Sourcegraph deployments: - -- [Jaeger tracing](https://www.jaegertracing.io/), for getting exact details on specific requests. -- [Grafana](https://grafana.com/) and [Prometheus](https://prometheus.io), for dashboards with nice high-level insight into Sourcegraph ([it can also send alerts](http://docs.grafana.org/alerting/rules/), although we are not aware of anyone using it for that yet). - -### A brief note about security - -It is your responsibility to ensure that Jaeger, Grafana, and Prometheus are only accessible by admins. In specific, you will want a way for admins to access: - -- jaeger-query HTTP port 16686. -- grafana HTTP port 3000. -- prometheus HTTP port 9090. - -This is due to the fact that these services (in particular, Jaeger) record details about HTTP queries, which may contain sensitive information. - -# Jaeger tracing - -Jaeger tracing allows you to grab a detailed trace for any HTTP request that goes through Sourcegraph. It can provide us critical information like: - -- What operations occurred behind the scenes? -- How long did those operations take? -- What errors occurred while performing those operations? -- etc. - -![image](https://user-images.githubusercontent.com/3173176/55772329-91152680-5a40-11e9-82ea-e29def753266.png) - -To use Jaeger after running `deploy.sh`: - -1. Visit jaeger-query in a browser (e.g. at http://localhost:16686) and confirm there are no errors displayed on the home page (you should just see a stern-looking Gopher with a hat). - - If there are errors, you may need to wait a few minutes for Jaeger's Cassandra database to initialize if it is the first time you are running this. It can take around 5 minutes. - - Consult `docker ps | grep jaeger` until all containers have started. -2. In the Sourcegraph site configuration, set `"useJaeger": true`, then restart all Sourcegraph services. This will cause Sourcegraph's services to begin sending tracing information to Jaeger. It is safe (and highly recommended) to run this in production. - -### Acquiring traces - -Every HTTP response sent by Sourcegraph will have a header like `X-Trace: 5023c9288d9d4797`. This trace ID can be put into Jaeger to view the trace. - -# Grafana and Prometheus - -Grafana queries Prometheus to provide dashboards with high-level insight into Sourcegraph. (It can also provide alerting on specific metrics, if desired): - -![image](https://user-images.githubusercontent.com/3173176/55769416-9751d580-5a35-11e9-892d-198b02bb3663.png) - -To use Grafana and Prometheus after running `deploy.sh`: - -1. If running on a Linux host, you may need to `sudo chown -R 472:472 ~/sourcegraph-docker/grafana-disk` in order to correct the permissions of the Grafana disk so that it starts. -1. (Sourcegraph 3.8+) On a Linux host, you may need to `sudo chown -R 100:101 ~/sourcegraph-docker/prometheus-v2-disk` in order to correct the permissions of the Prometheus disk so that it starts. -1. If you have multiple replicas of searcher/gitserver/etc, open `prometheus/prometheus_targets.yml` in an editor and duplicate lines as needed so that Prometheus knows to scrape those services for metrics. Save the file, then `docker restart prometheus` to apply the changes. -1. Visit grafana in a browser (e.g. at http://localhost:3000) and sign in using the default credentials `admin` > `admin`. -1. Add Prometheus as a data source: **Gear icon** > **Data sources** > **Add data source** > **Prometheus** > enter the Prometheus URL `http://prometheus:9090`. -1. You can now visit any dashboards via: **Dashboard icon** > **Home** > **Home dropdown in top-left** > ****. - -### Sourcegraph standard dashboards - -The deployment comes with a set of standard dashboards for monitoring Sourcegraph: - -- **Overview** - high level overview of how Sourcegraph is performing -- **Containers** - insight into Docker containers themselves (memory, CPU, open file descriptors, etc). Requires additional configuratoin, see below. -- **HTTP** - insight into end-user HTTP requests (i.e. excluding interservice communication) -- **Searcher** - detailed insight into the searcher service -- **Gitserver** - detailed insight into the gitserver service - -The JSON for these dashboards is located in the `grafana/provisioning/sourcegraph` directory. It is intended that thes are maintained by Sourcegraph and will recieve regular updates (you will get updates on redeploy, no need to do anything special). - -If there are specific dashboards or metrics you'd like to see, please [file an issue](https://github.com/sourcegraph/sourcegraph/issues) to let us know! - -### Container metrics - -The `Containers` dashboard metrics come from Docker itself. In order to expose these metrics to Prometheus, you will need to: - -1. Flip the bit in the Docker config to expose its Prometheus metrics exporter: https://docs.docker.com/config/thirdparty/prometheus/#configure-docker -2. Uncomment the relevant `job_name: docker` line at the end of `prometheus/prometheus_targets.yml` for your OS. -3. `docker restart prometheus` to make the changes take effect. -4. To confirm the above worked, you can run a Prometheus query [like this](http://localhost:9090/graph?g0.range_input=1h&g0.expr=process_resident_memory_bytes&g0.tab=0) or visit the `Containers` dashboard in Grafana. - -## Minimal downtime steps - -Assuming you want to deploy all of the above with minimal downtime, the best approach is to: - -1. First, in the Sourcegraph site configuration, set `"useJaeger": true`. This is harmless to do even if not using Jaeger (will just spam logs with errors). -1. Flip the bit in the Docker config to expose its Prometheus metrics exporter: https://docs.docker.com/config/thirdparty/prometheus/#configure-docker -1. As part of flipping the bit above, restart Docker which inherently restarts all Sourcegraph containers thus causing the `useJaeger` setting to update. -1. Follow the rest of the steps in this document for configuring Jaeger/Grafana (this will require restarting Jaeger/Grafana, but will allow you to skip any step that would require restarting core Sourcegraph services). - -The above will cause minimal downtime such that when you go through step 4 you are only restarting Jaeger/Grafana services, not other core Sourcegraph services. diff --git a/pure-docker/replicas.sh b/pure-docker/replicas.sh deleted file mode 100755 index 23ca3ca91..000000000 --- a/pure-docker/replicas.sh +++ /dev/null @@ -1,7 +0,0 @@ -# Here you can specify the number of service replicas to deploy. -NUM_GITSERVER=1 -NUM_SEARCHER=1 -NUM_INDEXED_SEARCH=1 -NUM_FRONTEND=3 - -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 deleted file mode 100755 index 3b1e8cf81..000000000 --- a/pure-docker/teardown.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -set -e - -root_dir="$(dirname "${BASH_SOURCE[0]}")" -cd "$root_dir" - -source ./replicas.sh - -docker rm -f node-exporter &>/dev/null || true & -docker rm -f cadvisor &>/dev/null || true & -docker rm -f caddy &>/dev/null || true & -docker rm -f sourcegraph-frontend-internal &>/dev/null || true & -docker rm -f $(addresses "sourcegraph-frontend-" $NUM_FRONTEND "") &>/dev/null || true & -docker rm -f $(addresses "gitserver-" $NUM_GITSERVER "") &>/dev/null || true & -docker rm -f grafana &>/dev/null || true -docker rm -f jaeger &>/dev/null || true -docker rm -f precise-code-intel-worker &>/dev/null || true -docker rm -f syntactic-code-intel-worker &>/dev/null || true -docker rm -f pgsql &>/dev/null || true & -docker rm -f codeintel-db &>/dev/null || true & -docker rm -f codeinsights-db &>/dev/null || true & -docker rm -f blobstore &>/dev/null || true & -docker rm -f migrator &>/dev/null || true & -docker rm -f prometheus &>/dev/null || true -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 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 & -docker rm -f otel-collector &>/dev/null || true & - -docker network rm sourcegraph &>/dev/null || true & -wait diff --git a/release.yaml b/release.yaml index ac3a782a4..b043fe076 100644 --- a/release.yaml +++ b/release.yaml @@ -33,11 +33,6 @@ internal: set -eu registry=us-docker.pkg.dev/sourcegraph-images/internal sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=us-docker.pkg.dev/sourcegraph-images/internal - sg ops update-images --registry ${registry} --kind shell --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD pure-docker/ - name: "git:branch" cmd: | set -eu @@ -59,11 +54,6 @@ internal: set -eu registry=us-docker.pkg.dev/sourcegraph-images/internal sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=us-docker.pkg.dev/sourcegraph-images/internal - sg ops update-images --registry ${registry} --kind shell --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD pure-docker/ - name: "git:branch" cmd: | set -eu @@ -85,11 +75,6 @@ internal: set -eu registry=us-docker.pkg.dev/sourcegraph-images/internal sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=us-docker.pkg.dev/sourcegraph-images/internal - sg ops update-images --registry ${registry} --kind shell --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD pure-docker/ - name: "git:branch" cmd: | set -eu @@ -165,11 +150,6 @@ promoteToPublic: set -eu registry=index.docker.io/sourcegraph sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=index.docker.io/sourcegraph - sg ops update-images --registry ${registry} --kind shell --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD pure-docker/ - name: "git:branch" cmd: | set -eu @@ -262,12 +242,6 @@ promoteToPublic: registry=index.docker.io/sourcegraph sg ops update-images --registry ${registry} --kind compose --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD docker-compose/ - - name: docker(shell):tags - cmd: | - set -eu - registry=index.docker.io/sourcegraph - sg ops update-images --registry ${registry} --kind shell --pin-tag {{inputs.server.tag}} --docker-username $DOCKER_USERNAME --docker-password $DOCKER_PASSWORD pure-docker/ - - name: "git:branch" cmd: | set -eu diff --git a/test/smoke-test.sh b/test/smoke-test.sh index cbe78575e..079ccb6c0 100755 --- a/test/smoke-test.sh +++ b/test/smoke-test.sh @@ -14,11 +14,7 @@ configure_docker() { deploy_sourcegraph() { cd $(dirname "${BASH_SOURCE[0]}")/.. #Deploy sourcegraph - if [[ "$TEST_TYPE" == "pure-docker-test" ]]; then - ./test/volume-config.sh - timeout 600s ./pure-docker/deploy.sh - expect_containers="24" - elif [[ "$TEST_TYPE" == "docker-compose-test" ]]; then + if [[ "$TEST_TYPE" == "docker-compose-test" ]]; then docker-compose --file docker-compose/docker-compose.yaml up -d -t 600 expect_containers="25" fi diff --git a/test/volume-config.sh b/test/volume-config.sh deleted file mode 100755 index 020677b73..000000000 --- a/test/volume-config.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Create volume directories. -cd /deploy-sourcegraph-docker -echo -echo "creating deployment for volume directories" -echo -./pure-docker/deploy.sh -echo -echo "tearing down deployment for volume directories" -echo -./pure-docker/teardown.sh -# Set permissions on volume directories. -# -# IMPORTANT: If these change, or a new service is introduced, it must be explicitly called out in -# https://docs.sourcegraph.com/admin/updates/pure_docker similar to https://docs.sourcegraph.com/admin/updates/pure_docker#v3-12-5-v3-13-2-changes -echo -echo "forcing static permissions on volume directories" -echo -pushd ~/sourcegraph-docker -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 -chown -R 70:70 codeinsights-db-disk -popd -echo "Ready to deploy"