diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command new file mode 100755 index 0000000..db3fc9c --- /dev/null +++ b/.buildkite/hooks/pre-command @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -eu +cd $BUILDKITE_BUILD_CHECKOUT_PATH + +echo "Installing asdf dependencies as defined in '$BUILDKITE_BUILD_CHECKOUT_PATH/.tool-versions':" +asdf install \ No newline at end of file diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml new file mode 100644 index 0000000..9f8ab0b --- /dev/null +++ b/.buildkite/pipeline.yaml @@ -0,0 +1,6 @@ +$schema: 'http://json.schemastore.org/buildkite' +steps: + - label: ':docker:' + command: .buildkite/validate-docker-compose.sh + - label: ':lipstick:' + command: .buildkite/prettier-check.sh diff --git a/.buildkite/prettier-check.sh b/.buildkite/prettier-check.sh new file mode 100755 index 0000000..18d4bbc --- /dev/null +++ b/.buildkite/prettier-check.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +cd "$(dirname "${BASH_SOURCE[0]}")/.." +set -euxo pipefail + +yarn +yarn run prettier-check diff --git a/.buildkite/validate-docker-compose.sh b/.buildkite/validate-docker-compose.sh new file mode 100755 index 0000000..3c7bac4 --- /dev/null +++ b/.buildkite/validate-docker-compose.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +cd "$(dirname "${BASH_SOURCE[0]}")/.." +set -euxo pipefail + +cd docker-compose +docker-compose -f docker-compose.yaml config -q diff --git a/.gitignore b/.gitignore index 7a6353d..efe34e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .envrc + +node_modules/ \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..c92af7f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +13.5.0 \ No newline at end of file diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..cd98548 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +yarn 1.19.2 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..823ca03 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", +} diff --git a/docker-compose/.env b/docker-compose/.env new file mode 100644 index 0000000..7280785 --- /dev/null +++ b/docker-compose/.env @@ -0,0 +1,7 @@ +# This file contains default values for some environment variables that are used +# in docker-compose.yaml +# See https://docs.docker.com/compose/environment-variables/ for more information. + +# The root storage location for various caches, gitserver, redis, postgres, etc. +# Override this value to change where Sourcegraph stores this data. +DATA_ROOT=~/sourcegraph-docker \ No newline at end of file diff --git a/docker-compose/README.md b/docker-compose/README.md new file mode 100644 index 0000000..6a61029 --- /dev/null +++ b/docker-compose/README.md @@ -0,0 +1,35 @@ +# Sourcegraph for docker-compose + +This folder contains a Sourcegraph docker-compose deployment. + +**NOTE:** This is early access and slated for release in Sourcegraph v3.12; the missing components today are primarily documentation. Please contact us (support@sourcegraph.com) if you are looking at using this in production so we can assist you. + +## Deploying + +Simply clone the repository and `docker-compose up -d` to deploy Sourcegraph: + +```sh +git clone https://github.com/sourcegraph/deploy-sourcegraph-docker +cd deploy-sourcegraph-docker/docker-compose/ +docker-compose up -d +``` + +Sourcegraph will then run in the background and across server restarts. + +Notes: + +- The `docker-compose.yml` file currently depends on configuration files which live in the repository, as such you must have the repository cloned onto your server. +- Data for all services will be stored in `$DATA_ROOT` (which defaults to `~/sourcegraph-docker`). +- Use `docker ps` to inspect the Sourcegraph containers, and `docker-compose down` to teardown the deployment. + +## Upgrading + +When a new version of Sourcegraph is released, you will simply checkout that version in this repository and redeploy: + +```sh +cd deploy-sourcegraph-docker/docker-compose +git pull +git checkout v3.10.4 +docker-compose down +docker-compose up -d +``` diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml new file mode 100644 index 0000000..bfa2ec0 --- /dev/null +++ b/docker-compose/docker-compose.yaml @@ -0,0 +1,563 @@ +version: '2.4' +services: + # Description: Acts as a reverse proxy for all of the sourcegraph-frontend instances + # + # Disk: none + # Ports exposed to other Sourcegraph services: none + # Ports exposed to the public internet: 7080 (HTTP) and/or 7443 (HTTPS) + # + # Note: nginx/nginx/sourcegraph_backend.conf lists all of the sourcegraph-frontend + # network addresses that Nginx should proxy. nginx/nginx/sourcegraph_backend.conf + # needs to be updated with new addresses when scaling the number of soucegraph-frontend + # replicas. + nginx: + container_name: nginx + image: 'index.docker.io/library/nginx:1.17.7@sha256:8aa7f6a9585d908a63e5e418dc5d14ae7467d2e36e1ab4f0d8f9d059a3d071ce' + cpus: 1 + mem_limit: '1g' + volumes: + - '../nginx:/etc/nginx' + ports: + - '0.0.0.0:7080:7080' + networks: + - sourcegraph + restart: always + + # Description: Serves the frontend of Sourcegraph via HTTP(S). + # + # Disk: 128GB / non-persistent SSD + # 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 + # 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. + sourcegraph-frontend-0: + container_name: sourcegraph-frontend-0 + image: 'index.docker.io/sourcegraph/frontend:3.10.4@sha256:5791fb16a1a2828f14c227160104eba3a251c876359e0cb33c48f832e3d2a53f' + cpus: 4 + mem_limit: '8g' + environment: + - GOMAXPROCS=12 + - JAEGER_AGENT_HOST=jaeger-agent + - PGHOST=pgsql + - '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' + - 'REPO_UPDATER_URL=http://repo-updater:3182' + - 'REPLACER_URL=http://replacer:3185' + - 'LSIF_SERVER_URL=http://lsif-server:3186' + - 'GRAFANA_SERVER_URL=http://grafana:3370' + healthcheck: + test: "wget -q 'http://127.0.0.1:3080/healthz' -O /dev/null || exit 1" + interval: 5s + timeout: 10s + retries: 3 + start_period: 300s + volumes: + - '${DATA_ROOT}/sourcegraph-frontend-0-disk:/mnt/cache' + networks: + - sourcegraph + restart: always + + # Description: Serves the internal Sourcegraph frontend API. + # + # Disk: 128GB / non-persistent SSD + # Ports exposed to other Sourcegraph services: 3090/TCP 6060/TCP + # Ports exposed to the public internet: none + # + sourcegraph-frontend-internal: + container_name: sourcegraph-frontend-internal + image: 'index.docker.io/sourcegraph/frontend:3.10.4@sha256:5791fb16a1a2828f14c227160104eba3a251c876359e0cb33c48f832e3d2a53f' + cpus: 4 + mem_limit: '8g' + environment: + - GOMAXPROCS=4 + - PGHOST=pgsql + - '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' + - 'REPO_UPDATER_URL=http://repo-updater:3182' + - 'REPLACER_URL=http://replacer:3185' + - 'LSIF_SERVER_URL=http://lsif-server:3186' + - 'GRAFANA_SERVER_URL=http://grafana:3000' + volumes: + - '${DATA_ROOT}/sourcegraph-frontend-internal-0-disk:/mnt/cache' + networks: + - sourcegraph + restart: always + + # Description: Stores clones of repositories to perform Git operations. + # + # Disk: 200GB / persistent SSD + # Ports exposed to other Sourcegraph services: 3178/TCP 6060/TCP + # Ports exposed to the public internet: none + # + gitserver-0: + container_name: gitserver-0 + image: 'index.docker.io/sourcegraph/gitserver:3.10.4@sha256:d8373d3635dae86b70acd889b93b93fb56651b87b69fd0bfe03247ec4b87ba86' + cpus: 4 + mem_limit: '8g' + environment: + - GOMAXPROCS=4 + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + - JAEGER_AGENT_HOST=jaeger-agent + volumes: + - '${DATA_ROOT}/gitserver-0-disk:/data/repos' + networks: + - sourcegraph + restart: always + + # 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 + # + zoekt-indexserver-0: + container_name: zoekt-indexserver-0 + image: 'index.docker.io/sourcegraph/zoekt-indexserver:0.0.20191031121923-5bd7e84@sha256:43eac5fddcc32f84f097e1466918ec9ac2fe54fe34649b8399de93963d9e4916' + cpus: 8 + mem_limit: '16g' + environment: + - GOMAXPROCS=8 + - 'HOSTNAME=zoekt-webserver-0:6070' + - 'SRC_FRONTEND_INTERNAL=http://sourcegraph-frontend-internal:3090' + volumes: + - '${DATA_ROOT}/zoekt-0-shared-disk:/data/index' + networks: + - sourcegraph + restart: always + hostname: zoekt-indexserver-0 + # Description: Backend for indexed text search operations. + # + # Disk: 200GB / persistent SSD + # Ports exposed to other Sourcegraph services: 6070/TCP + # Ports exposed to the public internet: none + # + zoekt-webserver-0: + container_name: zoekt-webserver-0 + image: 'index.docker.io/sourcegraph/zoekt-webserver:0.0.20191031121751-5bd7e84@sha256:1afbfb746a3d43a7532693093d2f993dac5b5536037b31d3ab305ceef5687380' + cpus: 8 + mem_limit: '50g' + environment: + - GOMAXPROCS=8 + - 'HOSTNAME=zoekt-webserver-0:6070' + healthcheck: + test: "wget -q 'http://127.0.0.1:6070/healthz' -O /dev/null || exit 1" + interval: 1s + timeout: 10s + retries: 1 + volumes: + - '${DATA_ROOT}/zoekt-0-shared-disk:/data/index' + networks: + - sourcegraph + restart: always + hostname: zoekt-webserver-0 + + # Description: Backend for text search operations. + # + # Disk: 128GB / non-persistent SSD + # Ports exposed to other Sourcegraph services: 3181/TCP 6060/TCP + # Ports exposed to the public internet: none + # + searcher-0: + container_name: searcher-0 + image: 'index.docker.io/sourcegraph/searcher:3.10.4@sha256:fb741ec01e0a762da633a701621ce251cc50161e08916f60b4aad92d76c0932f' + cpus: 2 + mem_limit: '2g' + environment: + - GOMAXPROCS=2 + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + - JAEGER_AGENT_HOST=jaeger-agent + healthcheck: + test: "wget -q 'http://127.0.0.1:3181/healthz' -O /dev/null || exit 1" + interval: 1s + timeout: 10s + retries: 1 + volumes: + - '${DATA_ROOT}/searcher-0-disk:/mnt/cache' + networks: + - sourcegraph + restart: always + + # Description: Rate-limiting proxy for the GitHub API. + # + # CPU: 1 + # Memory: 1GB + # Disk: 1GB / non-persistent SSD (only for read-only config file) + # Ports exposed to other Sourcegraph services: 3180/TCP 6060/TCP + # Ports exposed to the public internet: none + # + github-proxy: + container_name: github-proxy + image: 'index.docker.io/sourcegraph/github-proxy:3.10.4@sha256:562596fa07a1842e37777cc2f14c6beefa561306f40bf66dbf4d10257fa14646' + cpus: 1 + mem_limit: '1g' + environment: + - GOMAXPROCS=1 + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + - JAEGER_AGENT_HOST=jaeger-agent + networks: + - sourcegraph + restart: always + + # Description: LSIF HTTP server for code intelligence. + # + # Disk: 200GB / persistent SSD + # Ports exposed to other Sourcegraph services: 3186/TCP (server) 3187/TCP (worker) + # Ports exposed to the public internet: none + # + lsif-server: + container_name: lsif-server + image: 'index.docker.io/sourcegraph/lsif-server:3.10.4@sha256:28184888ee456759fca19deefebfca4ecd24ca0f99daa6072645615a8a70d54c' + cpus: 2 + mem_limit: '2g' + environment: + - GOMAXPROCS=2 + - LSIF_STORAGE_ROOT=/lsif-storage + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + healthcheck: + test: "wget -q 'http://127.0.0.1:3186/ping' -O /dev/null || exit 1" + interval: 5s + timeout: 5s + retries: 1 + start_period: 60s + volumes: + - '${DATA_ROOT}/lsif-server-disk:/lsif-storage' + networks: + - sourcegraph + restart: always + + # Description: Saved search query runner / notification service. + # + # Disk: 1GB / non-persistent SSD (only for read-only config file) + # Network: 100mbps + # Liveness probe: n/a + # Ports exposed to other Sourcegraph services: 3183/TCP 6060/TCP + # Ports exposed to the public internet: none + # + query-runner: + container_name: query-runner + image: 'index.docker.io/sourcegraph/query-runner:3.10.4@sha256:da864a7ca1593ef5fb8c7d93ef768ec9cf5de5a77dd67d471b3459899233db0d' + cpus: 1 + mem_limit: '1g' + environment: + - GOMAXPROCS=1 + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + - JAEGER_AGENT_HOST=jaeger-agent + networks: + - sourcegraph + restart: always + + # Description: Backend for replace operations. + # + # Disk: 128GB / non-persistent SSD + # Ports exposed to other Sourcegraph services: 3185/TCP 6060/TCP + # Ports exposed to the public internet: none + # + replacer: + container_name: replacer + image: 'index.docker.io/sourcegraph/replacer:3.10.4@sha256:e0641c60987765cce3e1670562f6f98834600763bf1f10c3e379b28154b6d772' + cpus: 1 + mem_limit: '512m' + environment: + - GOMAXPROCS=1 + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + healthcheck: + test: "wget -q 'http://127.0.0.1:3185/healthz' -O /dev/null || exit 1" + interval: 1s + timeout: 10s + retries: 1 + volumes: + - '${DATA_ROOT}/replacer-disk:/mnt/cache' + networks: + - sourcegraph + restart: always + + # Description: Handles repository metadata (not Git data) lookups and updates from external code hosts and other similar services. + # + # Disk: 128GB / non-persistent SSD + # Ports exposed to other Sourcegraph services: 3182/TCP 6060/TCP + # Ports exposed to the public internet: none + # + repo-updater: + container_name: repo-updater + image: 'index.docker.io/sourcegraph/repo-updater:3.10.4@sha256:f50c26acd5259a19ef984e04edbf6aac66a3d09e20f73162e4feeb656f4ec181' + cpus: 4 + mem_limit: '4g' + environment: + - GOMAXPROCS=1 + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + - JAEGER_AGENT_HOST=jaeger-agent + - 'GITHUB_BASE_URL=http://github-proxy:3180' + volumes: + - '${DATA_ROOT}/repo-updater-disk:/mnt/cache' + networks: + - sourcegraph + restart: always + + # Description: Backend for syntax highlighting operations. + # + # Disk: none + # Ports exposed to other Sourcegraph services: 9238/TCP 6060/TCP + # Ports exposed to the public internet: none + # + syntect-server: + container_name: syntect-server + image: 'index.docker.io/sourcegraph/syntect_server:2b5a3fb@sha256:ef5529cafdc68d5a21edea472ee8ad966878b173044aa5c3db93bc3d84765b1f' + cpus: 4 + mem_limit: '6g' + healthcheck: + test: "wget -q 'http://127.0.0.1:9238/health' -O /dev/null || exit 1" + interval: 1s + timeout: 5s + retries: 1 + start_period: 5s + networks: + - 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:3.10.4@sha256:7ef128b652fe554de4ae38bb4ee592568b315c84b122a577980042d89cd6e40f' + cpus: 2 + mem_limit: '4g' + environment: + - GOMAXPROCS=2 + - 'SRC_FRONTEND_INTERNAL=sourcegraph-frontend-internal:3090' + - JAEGER_AGENT_HOST=jaeger-agent + healthcheck: + test: "wget -q 'http://127.0.0.1:3184/healthz' -O /dev/null || exit 1" + interval: 5s + timeout: 5s + retries: 1 + start_period: 60s + volumes: + - '${DATA_ROOT}/symbols-0-disk:/mnt/cache' + networks: + - sourcegraph + restart: always + + # Description: Prometheus collects metrics and aggregates them into graphs. + # + # Disk: 200GB / persistent SSD + # Ports exposed to other Sourcegraph services: none + # Ports exposed to the public internet: none (HTTP 9090 should be exposed to admins only) + # + prometheus: + container_name: prometheus + image: 'index.docker.io/sourcegraph/prometheus:10.0.4@sha256:03af446c1c1d49e6ac395c06a29a207e8c7b59e6aa1fcf156c0bff63ad88d829' + cpus: 4 + mem_limit: '8g' + volumes: + - '${DATA_ROOT}/prometheus-v2-disk:/prometheus' + - '../prometheus:/sg_prometheus_add_ons' + ports: + - '0.0.0.0:9090:9090' + networks: + - sourcegraph + restart: always + + # Description: Dashboards and graphs for Prometheus metrics. + # + # Disk: 100GB / persistent SSD + # Ports exposed to other Sourcegraph services: none + # Ports exposed to the public internet: none (HTTP 3000 should be exposed to admins only) + # + # Add the following environment variables if you wish to use an auth proxy with Grafana: + # + # 'GF_AUTH_PROXY_ENABLED=true' + # 'GF_AUTH_PROXY_HEADER_NAME='X-Forwarded-User' + # 'GF_SERVER_ROOT_URL='https://grafana.example.com' + grafana: + container_name: grafana + image: 'index.docker.io/sourcegraph/grafana:10.0.7@sha256:c171332bccb1e01a54411f669b31e7c46d2a5568eac075bf05e4be0229ec262a' + cpus: 1 + mem_limit: '1g' + volumes: + - '${DATA_ROOT}/grafana-disk:/var/lib/grafana' + - '../grafana/datasources:/sg_config_grafana/provisioning/datasources' + - '../grafana/dashboards:/sg_grafana_additional_dashboards' + ports: + - '0.0.0.0:3370:3370' + networks: + - sourcegraph + restart: always + + # Description: Publishes Prometheus metrics about Docker containers. + # + # Disk: none + # Ports exposed to other Sourcegraph services: 8080/TCP + # Ports exposed to the public internet: none + # + cadvisor: + container_name: cadvisor + image: 'google/cadvisor:v0.33.0' + cpus: 1 + mem_limit: '1g' + volumes: + - '/:/rootfs:ro' + - '/var/run:/var/run:ro' + - '/sys:/sys:ro' + - '/var/lib/docker/:/var/lib/docker:ro' + - '/dev/disk/:/dev/disk:ro' + networks: + - sourcegraph + restart: always + + # # Description: Jaeger agent which is local to the host machine (containers on + # # the machine send trace information to it and it relays to the collector). + # # + # # Disk: none + # # Ports exposed to other Sourcegraph services: 5775/UDP 6831/UDP 6832/UDP (on the same host machine) + # # Ports exposed to the public internet: none + # # + # jaeger-agent: + # container_name: jaeger-agent + # image: 'index.docker.io/jaegertracing/jaeger-agent@sha256:7ad33c19fd66307f2a3c07c95eb07c335ddce1b487f6b6128faa75d042c496cb' + # cpus: 1 + # mem_limit: '1g' + # environment: + # - "COLLECTOR_HOST_PORT='jaeger-collector:14267'" + # networks: + # - sourcegraph + # restart: always + + # # Description: Jaeger's Cassandra database for storing traces. + # # + # # Disk: 128GB / persistent SSD + # # Ports exposed to other Sourcegraph services: 9042/TCP + # # Ports exposed to the public internet: none + # # + # jaeger-cassandra: + # container_name: jaeger-cassandra + # image: 'index.docker.io/library/cassandra:3.11.4@sha256:9f1d47fd23261c49f226546fe0134e6d4ad0570b7ea3a169c521005cb8369a32' + # cpus: 4 + # mem_limit: '8g' + # environment: + # - 'HEAP_NEWSIZE=1G' + # - 'MAX_HEAP_SIZE=6G' + # - 'CASSANDRA_DC=sourcegraph' + # - 'CASSANDRA_RACK=rack1' + # - 'CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch' + # volumes: + # - '${DATA_ROOT}/jaeger-cassandra-disk/:/var/lib/cassandra' + # networks: + # - sourcegraph + # restart: always + + # # Description: Receives traces from Jaeger agents. + # # + # # Disk: none + # # Ports exposed to other Sourcegraph services: 14267/TCP + # # Ports exposed to the public internet: none + # # + # jaeger-collector: + # container_name: jaeger-collector + # image: 'index.docker.io/jaegertracing/jaeger-collector:1.11@sha256:0b6d28bb52410f7b50c0f0fc16d7ee391e2e3eca47b713ac88d0891ca8a63cb9' + # cpus: 1 + # mem_limit: '1g' + # environment: + # - SPAN_STORAGE_TYPE=cassandra + # - CASSANDRA_SERVERS=jaeger-cassandra + # - CASSANDRA_KEYSPACE=jaeger_v1_sourcegraph + # networks: + # - sourcegraph + # restart: always + + # # Description: Jaeger frontend for querying traces. + # # + # # Disk: none + # # Ports exposed to other Sourcegraph services: none + # # Ports exposed to the public internet: none (HTTP 16686 should be exposed to admins only) + # # + # jaeger-query: + # container_name: jaeger-query + # image: 'index.docker.io/jaegertracing/jaeger-query:1.11@sha256:cddc521d0166c868931282685a863368ae2c14c4de0c1be38e388ece3080439e' + # cpus: 1 + # mem_limit: '1g' + # environment: + # - SPAN_STORAGE_TYPE=cassandra + # - CASSANDRA_SERVERS=jaeger-cassandra + # - CASSANDRA_KEYSPACE=jaeger_v1_sourcegraph + # - CASSANDRA_LOCAL_DC=sourcegraph + # ports: + # - '0.0.0.0:16686:16686' + # networks: + # - sourcegraph + # restart: always + + # Description: PostgreSQL database for various data. + # + # Disk: 128GB / persistent SSD + # Ports exposed to other Sourcegraph services: 5432/TCP 9187/TCP + # Ports exposed to the public internet: none + # + pgsql: + container_name: pgsql + image: 'index.docker.io/sourcegraph/postgres-11.4:19-11-14_b084311b@sha256:072481559d559cfd9a53ad77c3688b5cf583117457fd452ae238a20405923297' + cpus: 4 + mem_limit: '2g' + healthcheck: + test: '/liveness.sh' + interval: 10s + timeout: 1s + retries: 3 + start_period: 15s + volumes: + - '${DATA_ROOT}/pgsql-disk:/data/pgdata' + networks: + - sourcegraph + restart: always + + # Description: Redis for storing short-lived caches. + # + # Disk: 128GB / persistent SSD + # Ports exposed to other Sourcegraph services: 6379/TCP 9121/TCP + # Ports exposed to the public internet: none + # + redis-cache: + container_name: redis-cache + image: index.docker.io/sourcegraph/redis-cache:19-04-16_6891de82@sha256:4cbfac8af0abb673899250d4fd859cc477d6426de519e9deb71e454e18322499 + cpus: 1 + mem_limit: '6g' + volumes: + - '${DATA_ROOT}/redis-cache-disk:/redis-data' + networks: + - sourcegraph + restart: always + # Description: Redis for storing semi-persistent data like user sessions. + # + # Disk: 128GB / persistent SSD + # Ports exposed to other Sourcegraph services: 6379/TCP 9121/TCP + # Ports exposed to the public internet: none + # + redis-store: + container_name: redis-store + image: 'index.docker.io/sourcegraph/redis-store:19-04-16_6891de821@sha256:56426d601ce1f6d63088fea1cefa61f69a2e809c7d90fc1d157cca63cf81b277' + cpus: 1 + mem_limit: '6g' + volumes: + - '${DATA_ROOT}/redis-store-disk:/redis-data' + networks: + - sourcegraph + restart: always + +networks: + sourcegraph: diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..d8a4ed5 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,53 @@ +# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/master/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 new file mode 100644 index 0000000..c230f6d --- /dev/null +++ b/nginx/nginx/sourcegraph_backend.conf @@ -0,0 +1,8 @@ +# @sourcegraph: This file was adapted from https://github.com/sourcegraph/sourcegraph/blob/master/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 new file mode 100644 index 0000000..826aee7 --- /dev/null +++ b/nginx/nginx/sourcegraph_http.conf @@ -0,0 +1,9 @@ +# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/master/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 new file mode 100644 index 0000000..a5ccdf7 --- /dev/null +++ b/nginx/nginx/sourcegraph_main.conf @@ -0,0 +1,8 @@ +# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/master/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 new file mode 100644 index 0000000..bf3c78a --- /dev/null +++ b/nginx/nginx/sourcegraph_server.conf @@ -0,0 +1,5 @@ +# @sourcegraph: This file should be kept in sync with https://github.com/sourcegraph/sourcegraph/blob/master/cmd/server/shared/assets/nginx/sourcegraph_server.conf +# +# Do not modify. + +# Intentionally blank diff --git a/package.json b/package.json new file mode 100644 index 0000000..7c18c65 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "scripts": { + "prettier": "prettier '**/{*.{js?(on),ts?(x),graphql,md,scss},.*.js?(on)}' --write --list-different --config prettier.config.js", + "prettier-check": "yarn -s run prettier --write=false" + }, + "devDependencies": { + "@sourcegraph/prettierrc": "3.0.1", + "prettier": "1.19.1" + } +} diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..575c1e9 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1 @@ +module.exports = require('@sourcegraph/prettierrc') diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..a1b49f2 --- /dev/null +++ b/renovate.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json.schemastore.org/renovate", + "extends": ["config:base"], + "prHourlyLimit": 0, + "packageRules": [ + { + "packagePatterns": ["^index.docker.io/sourcegraph/"], + "groupName": "Sourcegraph Docker images", + "versionScheme": "semver", + "ignoreUnstable": false, + "semanticCommits": false, + "automerge": false + } + ], + "masterIssue": true, + "pinDigests": true +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..dd69e14 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,13 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@sourcegraph/prettierrc@3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sourcegraph/prettierrc/-/prettierrc-3.0.1.tgz#e1db0046dca3c5e770d0f2ac68bbd794fee37138" + integrity sha512-Xyfsk2zLbtJXjgzPC5Q91AdoZ9YECB7Z5pyUCoYb36zqClBRkN2F/VoT+04pLqBf9xsr9uKfJoaf/WGGngLlVg== + +prettier@1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==