sourcegraph/sg.config.yaml

510 lines
15 KiB
YAML
Raw Normal View History

env:
SRC_REPOS_DIR: $HOME/.sourcegraph/repos
SRC_LOG_LEVEL: info
SRC_LOG_FORMAT: condensed
SRC_GIT_SERVER_1: 127.0.0.1:3178
SRC_GIT_SERVERS: 127.0.0.1:3178
# Enable sharded indexed search mode:
INDEXED_SEARCH_SERVERS: localhost:3070 localhost:3071
DEPLOY_TYPE: dev
SRC_HTTP_ADDR: ":3082"
GITHUB_BASE_URL: http://127.0.0.1:3180
# I don't think we even need to set these?
SEARCHER_URL: http://127.0.0.1:3181
REPO_UPDATER_URL: http://127.0.0.1:3182
REDIS_ENDPOINT: 127.0.0.1:6379
QUERY_RUNNER_URL: http://localhost:3183
SYMBOLS_URL: http://localhost:3184
SRC_SYNTECT_SERVER: http://localhost:9238
SRC_FRONTEND_INTERNAL: localhost:3090
GRAFANA_SERVER_URL: http://localhost:3370
PROMETHEUS_URL: http://localhost:9090
JAEGER_SERVER_URL: http://localhost:16686
ZOEKT_HOST: localhost:3070
SRC_PROF_HTTP: "" # This needs to be empty?
OVERRIDE_AUTH_SECRET: sSsNGlI8fBDftBz0LDQNXEnP6lrWdt9g0fK6hoFvGQ
# Settings/config
SITE_CONFIG_FILE: ./dev/site-config.json
SITE_CONFIG_ALLOW_EDITS: true
GLOBAL_SETTINGS_FILE: ./dev/global-settings.json
GLOBAL_SETTINGS_ALLOW_EDITS: true
# Point codeintel to the `frontend` database in development
CODEINTEL_PGPORT: $PGPORT
CODEINTEL_PGHOST: $PGHOST
CODEINTEL_PGUSER: $PGUSER
CODEINTEL_PGPASSWORD: $PGPASSWORD
CODEINTEL_PGDATABASE: $PGDATABASE
CODEINTEL_PGSSLMODE: $PGSSLMODE
CODEINTEL_PGDATASOURCE: $PGDATASOURCE
CODEINTEL_PG_ALLOW_SINGLE_DB: true
# Required for `frontend` and `web` commands
SOURCEGRAPH_HTTPS_DOMAIN: sourcegraph.test
SOURCEGRAPH_HTTPS_PORT: 3443
# Required for `web` commands
NODE_OPTIONS: "--max_old_space_size=4096"
# Default `NODE_ENV` to `development`
NODE_ENV: development
# Code Insights uses a separate database, because it's easier to run TimescaleDB in
# Docker than install as a Postgres extension in dev environments.
CODEINSIGHTS_PGDATASOURCE: postgres://postgres:password@127.0.0.1:5435/postgres
DB_STARTUP_TIMEOUT: 120s # codeinsights-db needs more time to start in some instances.
DISABLE_CODE_INSIGHTS_HISTORICAL: true
DISABLE_CODE_INSIGHTS: true
commands:
frontend:
cmd: ulimit -n 10000 && .bin/frontend
install: go build -o .bin/frontend github.com/sourcegraph/sourcegraph/cmd/frontend
env:
CONFIGURATION_MODE: server
USE_ENHANCED_LANGUAGE_DETECTION: false
# frontend processes need this to be so that the paths to the assets are rendered correctly
WEBPACK_DEV_SERVER: 1
watch:
- internal
- cmd/frontend
enterprise-frontend:
cmd: |
ulimit -n 10000
# TODO: This should be fixed
export SOURCEGRAPH_LICENSE_GENERATION_KEY=$(cat ../dev-private/enterprise/dev/test-license-generation-key.pem)
.bin/enterprise-frontend
install: go build -o .bin/enterprise-frontend github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend
env:
CONFIGURATION_MODE: server
USE_ENHANCED_LANGUAGE_DETECTION: false
ENTERPRISE: 1
SITE_CONFIG_FILE: '../dev-private/enterprise/dev/site-config.json'
EXTSVC_CONFIG_FILE: '../dev-private/enterprise/dev/external-services-config.json'
# frontend processes need this to be so that the paths to the assets are rendered correctly
WEBPACK_DEV_SERVER: 1
watch:
- internal
- enterprise/internal
- cmd/frontend
- enterprise/cmd/frontend
gitserver:
cmd: .bin/gitserver
install: go build -o .bin/gitserver github.com/sourcegraph/sourcegraph/cmd/gitserver
env:
HOSTNAME: 127.0.0.1:3178
watch:
- internal
- cmd/gitserver
github-proxy:
cmd: .bin/github-proxy
install: go build -o .bin/github-proxy github.com/sourcegraph/sourcegraph/cmd/github-proxy
env:
HOSTNAME: 127.0.0.1:3178
watch:
- cmd/github-proxy
- internal/debugserver
- internal/env
- internal/logging
- internal/trace
- internal/tracer
repo-updater:
cmd: .bin/repo-updater
install: go build -o .bin/repo-updater github.com/sourcegraph/sourcegraph/cmd/repo-updater
watch:
- internal
- cmd/repo-updater
enterprise-repo-updater:
cmd: .bin/repo-updater
install: go build -o .bin/repo-updater github.com/sourcegraph/sourcegraph/enterprise/cmd/repo-updater
env:
HOSTNAME: $SRC_GIT_SERVER_1
ENTERPRISE: 1
watch:
- internal
- enterprise/internal
- cmd/repo-updater
- enterprise/cmd/repo-updater
query-runner:
cmd: .bin/query-runner
install: go build -o .bin/query-runner github.com/sourcegraph/sourcegraph/cmd/query-runner
watch:
- internal
- cmd/query-runner
symbols:
cmd: .bin/symbols
install: |
./dev/libsqlite3-pcre/build.sh &&
./cmd/symbols/build-ctags.sh &&
go build -o .bin/symbols github.com/sourcegraph/sourcegraph/cmd/symbols
env:
LIBSQLITE3_PCRE: ./dev/libsqlite3-pcre/build.sh libpath
CTAGS_COMMAND: cmd/symbols/universal-ctags-dev
CTAGS_PROCESSES: 2
watch:
- internal
- cmd/symbols
searcher:
cmd: .bin/searcher
install: go build -o .bin/searcher github.com/sourcegraph/sourcegraph/cmd/searcher
watch:
- internal
- cmd/searcher
caddy:
ignoreStdout: true
ignoreStderr: true
cmd: .bin/caddy run --watch --config=dev/Caddyfile
install: |
case "$(go env GOOS)" in
linux)
os="linux"
;;
darwin)
os="mac"
;;
esac
name="caddy_${CADDY_VERSION}_${os}_amd64"
target="$PWD/.bin/caddy"
url="https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/${name}.tar.gz"
if [ ! -f "${target}" ]; then
echo "downloading ${url}" 1>&2
curl -sS -L -f "${url}" | tar -xz --to-stdout "caddy" >"${target}.tmp"
mv "${target}.tmp" "${target}"
chmod +x ${target}
fi
env:
CADDY_VERSION: 2.3.0
web:
cmd: ./node_modules/.bin/gulp --silent --color dev
install: yarn --no-progress
enterprise-web:
cmd: ./node_modules/.bin/gulp --silent --color dev
install: yarn --no-progress
env:
ENTERPRISE: 1
web-standalone:
cmd: yarn workspace @sourcegraph/web serve:dev
install: yarn --no-progress
env:
WEBPACK_SERVE_INDEX: true
SOURCEGRAPH_API_URL: https://k8s.sgdev.org
enterprise-web-standalone:
cmd: yarn workspace @sourcegraph/web serve:dev
install: yarn --no-progress
env:
ENTERPRISE: 1
WEBPACK_SERVE_INDEX: true
SOURCEGRAPH_API_URL: https://k8s.sgdev.org
web-standalone-prod:
cmd: yarn workspace @sourcegraph/web serve:prod
install: yarn workspace @sourcegraph/web run build
env:
NODE_ENV: production
WEBPACK_SERVE_INDEX: true
SOURCEGRAPH_API_URL: https://k8s.sgdev.org
enterprise-web-standalone-prod:
cmd: yarn workspace @sourcegraph/web serve:prod
install: yarn workspace @sourcegraph/web run build
env:
ENTERPRISE: 1
NODE_ENV: production
WEBPACK_SERVE_INDEX: true
SOURCEGRAPH_API_URL: https://k8s.sgdev.org
docsite:
cmd: .bin/docsite_${VERSION} -config doc/docsite.json serve -http=localhost:5080
install: |
curl -sS -L -f \
"https://github.com/sourcegraph/docsite/releases/download/${VERSION}/docsite_${VERSION}_$(go env GOOS)_$(go env GOARCH)" \
-o .bin/docsite_${VERSION} && chmod +x .bin/docsite_${VERSION}
env:
VERSION: v1.7.0
syntect_server:
ignoreStdout: true
ignoreStderr: true
cmd: |
docker run --name=syntect_server --rm -p9238:9238 \
-e WORKERS=1 -e ROCKET_ADDRESS=0.0.0.0 \
sourcegraph/syntect_server:dd97058@sha256:d7163842f41388f41d19ce04833ac5f6d4e41d212869e7d2aea9c38ba6e77261
install: docker inspect syntect_server >/dev/null 2>&1 && docker rm -f syntect_server || true
env:
# This is not needed actually
INSECURE_DEV: 1
zoekt-indexserver-template: &zoekttemplate
cmd: |
.bin/zoekt-sourcegraph-indexserver \
-sourcegraph_url 'http://localhost:3090' \
-index "$HOME/.sourcegraph/zoekt/index-$ZOEKT_NUM" \
-hostname "localhost:$ZOEKT_HOSTNAME_PORT" \
-interval 1m \
-listen ":$ZOEKT_LISTEN_PORT" \
-cpu_fraction 0.25
install: |
mkdir -p .bin
export GOBIN="${PWD}/.bin"
export GO111MODULE=on
go install github.com/google/zoekt/cmd/zoekt-archive-index
go install github.com/google/zoekt/cmd/zoekt-git-index
go install github.com/google/zoekt/cmd/zoekt-sourcegraph-indexserver
env: &zoektenv
GOGC: 50
CTAGS_COMMAND: cmd/symbols/universal-ctags-dev
PATH: .bin:$PATH
zoekt-indexserver-0:
<<: *zoekttemplate
env:
<<: *zoektenv
ZOEKT_NUM: 0
ZOEKT_HOSTNAME_PORT: 3070
ZOEKT_LISTEN_PORT: 6072
zoekt-indexserver-1:
<<: *zoekttemplate
env:
<<: *zoektenv
ZOEKT_NUM: 1
ZOEKT_HOSTNAME_PORT: 3071
ZOEKT_LISTEN_PORT: 6073
zoekt-webserver-0:
cmd: |
.bin/zoekt-webserver \
-index "$HOME/.sourcegraph/zoekt/index-0" \
-pprof -rpc -listen ":3070"
install: |
mkdir -p .bin
env GOBIN="${PWD}/.bin" GO111MODULE=on go install github.com/google/zoekt/cmd/zoekt-webserver
env:
JAEGER_DISABLED: false
GOGC: 50
PATH: .bin:$PATH
zoekt-webserver-1:
cmd: |
.bin/zoekt-webserver \
-index "$HOME/.sourcegraph/zoekt/index-1" \
-pprof -rpc -listen ":3071"
install: |
mkdir -p .bin
env GOBIN="${PWD}/.bin" GO111MODULE=on go install github.com/google/zoekt/cmd/zoekt-webserver
env:
JAEGER_DISABLED: false
GOGC: 50
PATH: .bin:$PATH
precise-code-intel-worker:
cmd: .bin/precise-code-intel-worker
install: |
go build -o .bin/precise-code-intel-worker github.com/sourcegraph/sourcegraph/enterprise/cmd/precise-code-intel-worker
watch:
- internal
- cmd/enterprise/precise-code-intel-worker
- enterprise/internal
- lib/codeintel
executor-queue:
cmd: .bin/executor-queue
install: |
go build -o .bin/executor-queue github.com/sourcegraph/sourcegraph/enterprise/cmd/executor-queue
watch:
- internal
- cmd/enterprise/executor-queue
- enterprise/internal
- lib/codeintel
codeintel-executor:
cmd: .bin/codeintel-executor
install:
env:
EXECUTOR_QUEUE_NAME: codeintel
TMPDIR: $HOME/.sourcegraph/indexer-temp
minio:
cmd: |
docker inspect $CONTAINER >/dev/null 2>&1 && docker rm -f $CONTAINER
docker run --rm \
--name=$CONTAINER \
--cpus=1 \
--memory=1g \
-p 0.0.0.0:9000:9000 \
-e 'MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE' \
-e 'MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' \
-v "$MINIO_DISK":/data \
$IMAGE server /data >"$MINIO_LOG_FILE" 2>&1
install: |
mkdir -p $MINIO_LOGS
mkdir -p $MINIO_DISK
CACHE=true ./docker-images/minio/build.sh >$MINIO_LOG_FILE 2>&1
env:
MINIO_DISK: $HOME/.sourcegraph-dev/data/minio
MINIO_LOGS: $HOME/.sourcegraph-dev/logs/minio
MINIO_LOG_FILE: $HOME/.sourcegraph-dev/logs/minio/minio.log"
IMAGE: sourcegraph/minio
CONTAINER: minio
codeinsights-db:
cmd: |
docker inspect $CONTAINER >/dev/null 2>&1 && docker rm -f $CONTAINER
docker run --rm \
--name=${CONTAINER} \
--cpus=1 \
--memory=1g \
-e POSTGRES_PASSWORD=password \
-p 0.0.0.0:$PORT:5432 \
-v $DISK:/var/lib/postgresql/data \
$IMAGE >$LOG_FILE 2>&1
install: |
mkdir -p $LOGS
mkdir -p $DISK
CACHE=true ./docker-images/codeinsights-db/build.sh >$LOG_FILE 2>&1
env:
LOGS: $HOME/.sourcegraph-dev/logs/codeinsights-db
LOG_FILE: $HOME/.sourcegraph-dev/logs/codeinsights-db/codeinsights-db.log
DISK: $HOME/.sourcegraph-dev/data/codeinsights-db
IMAGE: sourcegraph/codeinsights-db:dev
CONTAINER: codeinsights-db
PORT: 5435
checks:
docker:
cmd: docker -v
failMessage: "Failed to run 'docker -v'. Please make sure Docker is running."
redis:
cmd: echo "PING" | nc localhost 6379
failMessage: "Failed to connect to Redis on port 6379. Please make sure Redis is running."
postgres:
cmd: psql -c 'SELECT 1;'
failMessage: "Failed to connect to Postgres database. Make sure environment variables are setup correctly so that psql can connect."
commandsets:
# TODO: Should we be able to define "env" vars _per set_?
default:
- frontend
- repo-updater
- gitserver
- searcher
- symbols
- query-runner
- web
- caddy
- docsite
- syntect_server
- github-proxy
- zoekt-indexserver-0
- zoekt-indexserver-1
- zoekt-webserver-0
- zoekt-webserver-1
enterprise:
- enterprise-frontend
- enterprise-repo-updater
- enterprise-web
- gitserver
- searcher
- symbols
- query-runner
- caddy
- docsite
- syntect_server
- github-proxy
- zoekt-indexserver-0
- zoekt-indexserver-1
- zoekt-webserver-0
- zoekt-webserver-1
enterprise-codeintel:
- enterprise-frontend
- enterprise-repo-updater
- enterprise-web
- gitserver
- searcher
- symbols
- query-runner
- caddy
- docsite
- syntect_server
- github-proxy
- zoekt-indexserver-0
- zoekt-indexserver-1
- zoekt-webserver-0
- zoekt-webserver-1
- minio
- executor-queue
- precise-code-intel-worker
- codeintel-executor
enterprise-codeinsights:
# Add the following overwrites to your sg.config.overwrite.yaml to get
# codeinsights working:
#
# env:
# DISABLE_CODE_INSIGHTS_HISTORICAL: false
# DISABLE_CODE_INSIGHTS: false
#
- enterprise-frontend
- enterprise-repo-updater
- enterprise-web
- gitserver
- searcher
- symbols
- query-runner
- caddy
- docsite
- syntect_server
- github-proxy
- zoekt-indexserver-0
- zoekt-indexserver-1
- zoekt-webserver-0
- zoekt-webserver-1
- codeinsights-db
tests:
# These can be run with `sg test [name]`
backend:
cmd: go test
defaultArgs: ./...
backend-integration:
cmd: cd dev/gqltest && go test -long -base-url $BASE_URL -email $EMAIL -username $USERNAME -password $PASSWORD ./gqltest
env:
# These are defaults. They can be overwritten by setting the env vars when
# running the command.
BASE_URL: "http://localhost:3080"
EMAIL: "joe@sourcegraph.com"
PASSWORD: "12345"
frontend:
cmd: yarn run jest --testPathIgnorePatterns end-to-end regression integration storybook
frontend-e2e:
cmd: yarn run mocha ./client/web/src/end-to-end/end-to-end.test.ts
env:
TS_NODE_PROJECT: client/web/src/end-to-end/tsconfig.json