-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-backend-postgres.sh
More file actions
40 lines (36 loc) · 1.89 KB
/
Copy pathrun-backend-postgres.sh
File metadata and controls
40 lines (36 loc) · 1.89 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
#!/usr/bin/env bash
# Usage: ./run-backend-postgres.sh [host] [port] [db] [user] [password] [api_port] [BIOMETRY_SYNC_INITIAL_DELAY] [BIOMETRY_SYNC_INTERVAL] [INNER_RECONNECT_BASE_SECONDS] [INNER_RECONNECT_MAX_SECONDS] [INNER_RECONNECT_DISABLE_AFTER] [INNER_RECONNECT_DISABLE_TIMEOUT_SECONDS]
# Provides a convenience script to run the backend with an explicit Postgres DB (matching frontend .env default)
set -euo pipefail
HOST=${1:-localhost}
PORT=${2:-5432}
DB=${3:-catraca_db}
USER=${4:-postgres}
PASS=${5:-postgres}
API_PORT=${6:-5005}
BIOMETRY_SYNC_INITIAL_DELAY=${7:-60}
BIOMETRY_SYNC_INTERVAL=${8:-300}
INNER_RECONNECT_BASE_SECONDS=${9:-10}
INNER_RECONNECT_MAX_SECONDS=${10:-300}
INNER_RECONNECT_DISABLE_AFTER=${11:-10}
INNER_RECONNECT_DISABLE_TIMEOUT_SECONDS=${12:-3600}
export DB_PROVIDER=POSTGRES
export DB_HOST="$HOST"
export DB_PORT="$PORT"
export DB_NAME="$DB"
export DB_USER="$USER"
export DB_PASSWORD="$PASS"
export BIOMETRY_SYNC_INITIAL_DELAY="$BIOMETRY_SYNC_INITIAL_DELAY"
export BIOMETRY_SYNC_INTERVAL="$BIOMETRY_SYNC_INTERVAL"
export INNER_RECONNECT_BASE_SECONDS="$INNER_RECONNECT_BASE_SECONDS"
export INNER_RECONNECT_MAX_SECONDS="$INNER_RECONNECT_MAX_SECONDS"
export INNER_RECONNECT_DISABLE_AFTER="$INNER_RECONNECT_DISABLE_AFTER"
export INNER_RECONNECT_DISABLE_TIMEOUT_SECONDS="$INNER_RECONNECT_DISABLE_TIMEOUT_SECONDS"
echo "Starting backend with postgres: host=$DB_HOST port=$DB_PORT db=$DB_NAME user=$DB_USER api_port=$API_PORT"
echo "Reconnect base=$INNER_RECONNECT_BASE_SECONDS s, max=$INNER_RECONNECT_MAX_SECONDS s, disableAfter=$INNER_RECONNECT_DISABLE_AFTER retries, disableTimeout=$INNER_RECONNECT_DISABLE_TIMEOUT_SECONDS s"
# If you want to run the jar that trusts embedded JRE, call the jar from target
if [ -f target/catraca-topdata.jar ]; then
java -jar target/catraca-topdata.jar --server.port=$API_PORT
else
echo "Shaded jar not found in target; please run 'mvn -DskipTests package' first"
fi