forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·130 lines (109 loc) · 4.36 KB
/
start.sh
File metadata and controls
executable file
·130 lines (109 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
# set to true if unset so set -u won't break us
: ${SOURCEGRAPH_COMBINE_CONFIG:=false}
set -euf -o pipefail
unset CDPATH
cd "$(dirname "${BASH_SOURCE[0]}")/.." # cd to repo root dir
if [ -f .env ]; then
set -o allexport
source .env
set +o allexport
fi
export GO111MODULE=on
go run ./internal/version/minversion
# Verify postgresql config.
hash psql 2>/dev/null || {
# "brew install [email protected]" does not put psql on the $PATH by default;
# try to fix this automatically if we can.
hash brew 2>/dev/null && {
export PATH="$(brew --prefix)/opt/[email protected]/bin:$PATH"
fi
}
}
if ! psql -wc '\x' >/dev/null; then
echo "FAIL: postgreSQL config invalid or missing OR postgreSQL is still starting up."
echo "You probably need, at least, PGUSER and PGPASSWORD set in the environment."
exit 1
fi
export LIGHTSTEP_INCLUDE_SENSITIVE=true
export PGSSLMODE=disable
# Default to "info" level debugging, and "condensed" log format (nice for human readers)
export SRC_LOG_LEVEL=${SRC_LOG_LEVEL:-info}
export SRC_LOG_FORMAT=${SRC_LOG_FORMAT:-condensed}
export GITHUB_BASE_URL=${GITHUB_BASE_URL:-http://127.0.0.1:3180}
export SRC_REPOS_DIR=$HOME/.sourcegraph/repos
export LSIF_STORAGE_ROOT=$HOME/.sourcegraph/lsif-storage
export INSECURE_DEV=1
export SRC_GIT_SERVERS=127.0.0.1:3178
export GOLANGSERVER_SRC_GIT_SERVERS=host.docker.internal:3178
export SEARCHER_URL=http://127.0.0.1:3181
export REPLACER_URL=http://127.0.0.1:3185
export REPO_UPDATER_URL=http://127.0.0.1:3182
export REDIS_ENDPOINT=127.0.0.1:6379
export QUERY_RUNNER_URL=http://localhost:3183
export SYMBOLS_URL=http://localhost:3184
export LSIF_SERVER_URL=http://localhost:3186
export SRC_SYNTECT_SERVER=http://localhost:9238
export SRC_FRONTEND_INTERNAL=localhost:3090
export SRC_PROF_HTTP=
export SRC_PROF_SERVICES=$(cat dev/src-prof-services.json)
export OVERRIDE_AUTH_SECRET=sSsNGlI8fBDftBz0LDQNXEnP6lrWdt9g0fK6hoFvGQ
export DEPLOY_TYPE=dev
export CTAGS_COMMAND="${CTAGS_COMMAND:=cmd/symbols/universal-ctags-dev}"
export ZOEKT_HOST=localhost:3070
export USE_ENHANCED_LANGUAGE_DETECTION=${USE_ENHANCED_LANGUAGE_DETECTION:-1}
export GRAFANA_SERVER_URL=http://localhost:3370
# Enable sharded indexed search mode
[ -n "${DISABLE_SEARCH_SHARDING-}" ] || export INDEXED_SEARCH_SERVERS="localhost:3070 localhost:3071"
# webpack-dev-server is a proxy running on port 3080 that (1) serves assets, waiting to respond
# until they are (re)built and (2) otherwise proxies to nginx running on port 3081 (which proxies to
# Sourcegraph running on port 3082). That is why Sourcegraph listens on 3081 despite the externalURL
# having port 3080.
export SRC_HTTP_ADDR=":3082"
export WEBPACK_DEV_SERVER=1
export CRITICAL_CONFIG_FILE=${CRITICAL_CONFIG_FILE:-./dev/critical-config.json}
export SITE_CONFIG_FILE=${SITE_CONFIG_FILE:-./dev/site-config.json}
export GLOBAL_SETTINGS_FILE=${GLOBAL_SETTINGS_FILE:-./dev/global-settings.json}
export SITE_CONFIG_ALLOW_EDITS=true
export GLOBAL_SETTINGS_ALLOW_EDITS=true
# WebApp
export NODE_ENV=development
export NODE_OPTIONS="--max_old_space_size=4096"
# Make sure chokidar-cli is installed in the background
printf >&2 "Concurrently installing Yarn and Go dependencies...\n\n"
yarn_pid=''
[ -n "${OFFLINE-}" ] || {
yarn --no-progress &
yarn_pid="$!"
}
if ! ./dev/go-install.sh; then
# let Yarn finish, otherwise we get Yarn diagnostics AFTER the
# actual reason we're failing.
wait
echo >&2 "WARNING: go-install.sh failed, some builds may have failed."
exit 1
fi
# Wait for yarn if it is still running
if [[ -n "$yarn_pid" ]]; then
wait "$yarn_pid"
fi
# Increase ulimit (not needed on Windows/WSL)
type ulimit > /dev/null && ulimit -n 10000 || true
# Put .bin:node_modules/.bin onto the $PATH
export PATH="$PWD/.bin:$PWD/node_modules/.bin:$PATH"
# Management console webapp
[ -n "${OFFLINE-}" ] || {
pushd ./cmd/management-console/web && yarn --no-progress && popd
}
# LSIF server
[ -n "${OFFLINE-}" ] || {
pushd ./lsif && yarn --no-progress && popd
}
# Build once to make sure editor codeintel works
# This is fast if no changes were made.
# Don't fail if it errors as this is only for codeintel, not for the build.
yarn run build-ts || true
printf >&2 "\nStarting all binaries...\n\n"
export GOREMAN="goreman --set-ports=false --exit-on-error -f dev/Procfile"
exec $GOREMAN start