Repository navigation
Expand file tree
/
Copy pathcore_service.sh
More file actions
executable file
·65 lines (59 loc) · 2.33 KB
/
Copy pathcore_service.sh
File metadata and controls
executable file
·65 lines (59 loc) · 2.33 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
#!/bin/sh
# This startup script is meant to be invoked from within a Docker container
# started by docker-compose_dss.yaml, not on a local system.
DEBUG_ON=${1:-0}
# POSIX compliant test to check if with-yugabyte profile is enabled.
if [ "${COMPOSE_PROFILES#*"with-yugabyte"}" != "${COMPOSE_PROFILES}" ]; then
echo "Using Yugabyte"
DATASTORE_CONNECTION="-datastore_host local-dss-ybdb -datastore_user yugabyte --datastore_port 5433"
else
if [ "${COMPOSE_PROFILES#*"with-raft"}" != "${COMPOSE_PROFILES}" ]; then
echo "Using raft"
DATASTORE_CONNECTION="-store_type raft -raft_node_id=1 -raft_peers=1=http://127.0.0.1:9011 -raft_datadir /raftdata -raft_insecure"
else
echo "Using CockroachDB"
DATASTORE_CONNECTION="-datastore_host local-dss-crdb"
fi
fi
if [ "${COMPOSE_PROFILES#*"with-monitoring"}" != "${COMPOSE_PROFILES}" ]; then
echo "Monitoring: enabled"
MONITORING_FLAGS="-enable_metrics -enable_tracing"
else
echo "Monitoring: disabled"
MONITORING_FLAGS=""
fi
if [ "$DEBUG_ON" = "1" ]; then
echo "Debug Mode: on"
# Linter is disabled to properly unwrap connection and monitoring arguments.
# shellcheck disable=SC2086
dlv --headless --listen=:4000 --api-version=2 --accept-multiclient exec --continue /usr/bin/core-service -- ${DATASTORE_CONNECTION} \
${MONITORING_FLAGS} \
-public_key_files /var/test-certs/auth2.pem \
-log_format console \
-dump_requests \
-addr :8082 \
-accepted_jwt_audiences localhost,host.docker.internal,local-dss-core-service,dss_sandbox-local-dss-core-service-1,core-service \
-enable_scd \
-allow_http_base_urls \
-locality local_dev \
-public_endpoint http://127.0.0.1:8082 \
${CORE_SERVICE_EXTRA_FLAGS}
else
echo "Debug Mode: off"
# Use exec so docker-compose's SIGTERM is forwarded to the binary
# Linter is disabled to properly unwrap connection and monitoring arguments.
# shellcheck disable=SC2086
exec /usr/bin/core-service \
${DATASTORE_CONNECTION} \
${MONITORING_FLAGS} \
-public_key_files /var/test-certs/auth2.pem \
-log_format console \
-dump_requests \
-addr :8082 \
-accepted_jwt_audiences localhost,host.docker.internal,local-dss-core-service,dss_sandbox-local-dss-core-service-1,core-service \
-enable_scd \
-allow_http_base_urls \
-locality local_dev \
-public_endpoint http://127.0.0.1:8082 \
${CORE_SERVICE_EXTRA_FLAGS}
fi