thread-master/deploy/scripts/start-demo-worker.sh

24 lines
728 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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