| | #!/usr/bin/env bash |
| | set -euo pipefail |
| |
|
| | |
| | |
| |
|
| | DBOPS_ROOT="${DBOPS_ROOT:-/data/adaptai/platform/dbops}" |
| | SECRETS_DIR="${SECRETS_DIR:-/data/adaptai/secrets/dataops}" |
| |
|
| | CONF_DIR="$DBOPS_ROOT/configs/janusgraph" |
| | RUNTIME_DIR="$DBOPS_ROOT/run/janusgraph" |
| | mkdir -p "$RUNTIME_DIR" |
| |
|
| | TEMPLATE="$CONF_DIR/janusgraph-cql.properties" |
| | OUT="$RUNTIME_DIR/janusgraph-cql.runtime.properties" |
| |
|
| | |
| | if [[ -f "$SECRETS_DIR/.env" ]]; then |
| | while IFS='=' read -r k v; do |
| | [[ -z "$k" ]] && continue |
| | [[ "$k" =~ ^ |
| | [[ -z "$v" ]] && continue |
| | if [[ -z "${!k-}" ]]; then export "$k"="$v"; fi |
| | done < <(grep -v '^#' "$SECRETS_DIR/.env" | sed '/^$/d') |
| | fi |
| |
|
| | if [[ -z "${SCYLLA_USER:-}" || -z "${SCYLLA_PASS:-}" ]]; then |
| | echo "[janus] Missing SCYLLA_USER or SCYLLA_PASS in $SECRETS_DIR/.env" >&2 |
| | exit 1 |
| | fi |
| |
|
| | |
| | awk '{print}' "$TEMPLATE" \ |
| | | sed "s#\${SCYLLA_USER}#${SCYLLA_USER}#g" \ |
| | | sed "s#\${SCYLLA_PASS}#${SCYLLA_PASS}#g" \ |
| | > "$OUT" |
| |
|
| | echo "[janus] Rendered: $OUT" |
| |
|
| | |
| | GREMLIN_YAML="$CONF_DIR/gremlin-server.yaml" |
| | if [[ -n "${START_GREMLIN:-1}" && "${START_GREMLIN}" != "0" ]]; then |
| | echo "[janus] Starting Gremlin Server on port configured in $GREMLIN_YAML" |
| | |
| | if command -v gremlin-server.sh >/dev/null 2>&1; then |
| | exec gremlin-server.sh start "$GREMLIN_YAML" |
| | elif [[ -x "$DBOPS_ROOT/bin/gremlin-server.sh" ]]; then |
| | exec "$DBOPS_ROOT/bin/gremlin-server.sh" start "$GREMLIN_YAML" |
| | else |
| | echo "[janus] gremlin-server.sh not found; start it with the above config manually." >&2 |
| | exit 2 |
| | fi |
| | fi |
| |
|
| |
|