24 lines
728 B
Bash
Executable File
24 lines
728 B
Bash
Executable File
#!/usr/bin/env bash
|
||
# 啟動 demo-worker:領取管理員產生的 demo 測試任務並跑到 succeeded
|
||
set -euo pipefail
|
||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||
BACKEND="$ROOT/apps/backend"
|
||
# shellcheck source=../scripts/_common.sh
|
||
source "$(cd "$(dirname "$0")" && pwd)/_common.sh" 2>/dev/null || true
|
||
|
||
if [[ -f "$ROOT/deploy/scripts/_common.sh" ]]; then
|
||
# shellcheck disable=SC1091
|
||
source "$ROOT/deploy/scripts/_common.sh"
|
||
load_env 2>/dev/null || true
|
||
fi
|
||
|
||
cd "$BACKEND"
|
||
if [[ ! -x bin/worker ]]; then
|
||
echo "[demo-worker] building…"
|
||
go build -o bin/worker ./cmd/worker
|
||
fi
|
||
|
||
export WORKER_ID="${WORKER_ID:-demo-worker-1}"
|
||
echo "[demo-worker] starting WORKER_ID=$WORKER_ID"
|
||
exec ./bin/worker -f etc/gateway.yaml
|