forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-server-image.sh
More file actions
executable file
·41 lines (36 loc) · 1.13 KB
/
run-server-image.sh
File metadata and controls
executable file
·41 lines (36 loc) · 1.13 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
#!/usr/bin/env bash
# This runs a published or local server image for testing and development purposes.
IMAGE=${IMAGE:-sourcegraph/server:${TAG:-insiders}}
URL=${URL:-"http://localhost:7080"}
DATA=${DATA:-"/tmp/sourcegraph-data"}
echo "--- Checking for existing Sourcegraph instance at $URL"
if curl --output /dev/null --silent --head --fail "$URL"; then
echo "❌ Can't run a new Sourcegraph instance on $URL because another instance is already running."
echo "❌ The last time this happened, there was a runaway integration test run on the same Buildkite agent and the fix was to delete the pod and rebuild."
exit 1
fi
# shellcheck disable=SC2153
case "$CLEAN" in
"true")
clean=y
;;
"false")
clean=n
;;
*)
echo -n "Do you want to delete $DATA and start clean? [Y/n] "
read -r clean
;;
esac
if [ "$clean" != "n" ] && [ "$clean" != "N" ]; then
echo "--- Deleting $DATA"
rm -rf "$DATA"
fi
echo "--- Starting server ${IMAGE}"
docker run "$@" \
--publish 7080:7080 \
-e SRC_LOG_LEVEL=dbug \
-e DEBUG=t \
--volume "$DATA/config:/etc/sourcegraph" \
--volume "$DATA/data:/var/opt/sourcegraph" \
"$IMAGE"