Skip to content

Ocyss/srs-auth / .agents/skills/srs-develop

srs-develop

Verified

Develop, modify, debug, review, maintain, and explain the SRS and Oryx codebases and the SRS Docker image toolchain. Use for planned changes to the next-generation SRS Go proxy, SRS browser player, ossrs/dev-docker images, or Oryx Go backend, React dashboard, integrated runtime, packaging, installers, releases, and tests; bug maintenance; issue and pull-request triage; pull-request review; and Learn Code questions. The C++ SRS server is in maintenance mode, and planned Go origin and edge development is not yet supported. NOT for end-user support, usage questions, or configuration help — use srs-support for those.

FileKindSize
SKILL.mdskill md8.2 KB
references/develop-code.mdmarkdown15.1 KB
references/fix-a-bug.mdmarkdown6.6 KB
references/integration-tests.mdmarkdown2.9 KB
references/learn-code.mdmarkdown3.3 KB
references/oryx-issues.mdmarkdown218 B
references/oryx-local-development.mdmarkdown11.9 KB
references/review-a-pr.mdmarkdown3.5 KB
references/scan-issues.mdmarkdown993 B
references/scan-prs.mdmarkdown1.4 KB
references/srs-issues.mdmarkdown58.5 KB
references/version-and-changelog.mdmarkdown2.3 KB
scripts/browser-page-url-test.jsscript2.7 KB
scripts/gb28181-api-timeout-test.shscript5.3 KB
scripts/gb28181-create-session.shscript2.1 KB
scripts/gb28181-publish-stream.shscript3.9 KB
scripts/gb28181-tcp-disconnect-test.shscript4.3 KB
scripts/oryx-api-smoke-test.shscript4.2 KB
scripts/oryx-camera-test.shscript12.2 KB
scripts/oryx-forward-test.shscript10.9 KB
scripts/oryx-live-room-test.shscript10.2 KB
scripts/oryx-live-streaming-test.shscript12.6 KB
scripts/oryx-record-test.shscript10.4 KB
scripts/oryx-run-tests.shscript2.3 KB
scripts/oryx-stack-start.shscript5.2 KB
scripts/oryx-stack-stop.shscript1.8 KB
scripts/oryx-transcode-test.shscript9.8 KB
scripts/oryx-vlive-test.shscript12.0 KB
scripts/proxy-e2e-bearer-auth-test.shscript12.0 KB
scripts/proxy-e2e-cluster-test.shscript10.4 KB
scripts/proxy-e2e-edge-test.shscript10.6 KB
scripts/proxy-e2e-redis-test.shscript11.7 KB
scripts/proxy-e2e-srt-test.shscript9.5 KB
scripts/proxy-e2e-test.shscript5.7 KB
scripts/proxy-e2e-transmux-test.shscript7.3 KB
scripts/proxy-e2e-whip-test.shscript11.5 KB
scripts/proxy-utest.shscript1.5 KB
scripts/setup-ffmpeg-with-whip.shscript7.5 KB

scripts/oryx-stack-start.sh

View on GitHub
#!/bin/bash
# Clean restart of local SRS, the Oryx backend, and the React dashboard.
# Redis is started only if unavailable and is never stopped. Run lifecycle
# commands sequentially; tests can then share the running stack.

SCRIPT_DIR="$(cd -P "$(dirname "$0")" && pwd)"
# Walk up from SCRIPT_DIR looking for go.mod, the SRS repo root. This avoids
# brittle "../../../.." counting when the skills directory is reached via a
# symlink (which changes the symbolic vs. physical depth).
WORKSPACE="$SCRIPT_DIR"
while [[ "$WORKSPACE" != "/" && ! -f "$WORKSPACE/go.mod" ]]; do
  WORKSPACE="$(dirname "$WORKSPACE")"
done
if [[ ! -f "$WORKSPACE/go.mod" ]]; then
  echo "Error: go.mod not found walking up from: $SCRIPT_DIR" >&2
  exit 1
fi

ORYX_DIR="$WORKSPACE/oryx"
PLATFORM_DIR="$ORYX_DIR/platform"
UI_DIR="$ORYX_DIR/ui"
SRS_BINARY="$WORKSPACE/trunk/objs/srs"
SRS_CONF="containers/conf/srs.release-local.conf"
ENDPOINT="${ORYX_ENDPOINT:-http://localhost:2022}"
SRS_API="${SRS_API_ENDPOINT:-http://localhost:1985}"
UI_ENDPOINT="${ORYX_UI_ENDPOINT:-http://localhost:3000}"
STATE_FILE="${ORYX_STACK_STATE_FILE:-/tmp/oryx-stack-state.env}"

wait_for_http() {
  local url="$1" max="$2" waited=0
  while ! curl -sS -m 2 -o /dev/null "$url" 2>/dev/null; do
    waited=$((waited + 1))
    if [[ "$waited" -ge "$max" ]]; then
      return 1
    fi
    sleep 1
  done
  return 0
}

wait_for_redis() {
  local max="$1" waited=0
  while [[ "$(redis-cli ping 2>/dev/null)" != "PONG" ]]; do
    waited=$((waited + 1))
    if [[ "$waited" -ge "$max" ]]; then
      return 1
    fi
    sleep 1
  done
  return 0
}

echo "=== Oryx Stack Start ==="

# Cleanup always targets the standard local development ports. Do not use
# remote/custom readiness endpoints to accidentally accept a different stack.
if [[ "$ENDPOINT" != "http://localhost:2022" ||
      "$SRS_API" != "http://localhost:1985" ||
      "$UI_ENDPOINT" != "http://localhost:3000" ]]; then
  echo "FAIL: clean startup supports only the default local stack endpoints." >&2
  exit 1
fi

# Check prerequisites before disrupting an existing stack.
if [[ ! -f "$SRS_BINARY" || ! -d "$UI_DIR/node_modules" ]]; then
  echo "FAIL: build trunk/objs/srs and install oryx/ui dependencies first." >&2
  exit 1
fi
for tool in go npm curl redis-cli lsof; do
  command -v "$tool" >/dev/null || { echo "FAIL: missing $tool" >&2; exit 1; }
done
bash "$SCRIPT_DIR/oryx-stack-stop.sh" || exit 1

SRS_PID=""
BACKEND_PID=""
UI_PID=""

save_state() {
  local temporary
  temporary=$(mktemp "${STATE_FILE}.XXXXXX") || return 1
  if ! printf 'SRS_STARTED_PID="%s"\nBACKEND_STARTED_PID="%s"\nUI_STARTED_PID="%s"\n' \
      "$SRS_PID" "$BACKEND_PID" "$UI_PID" > "$temporary" ||
      ! mv -f "$temporary" "$STATE_FILE"; then
    rm -f "$temporary"
    return 1
  fi
}

# Check persistence before starting anything, and save partial startup on
# failure too, so an unsuccessful readiness check cannot orphan tracking.
save_state || exit 1
trap 'save_state || { echo "FAIL: cannot save $STATE_FILE" >&2; exit 1; }' EXIT

if [[ "$(redis-cli ping 2>/dev/null)" != "PONG" ]]; then
  echo "Redis not reachable, starting via 'brew services start redis'..."
  if ! command -v brew &>/dev/null; then
    echo "FAIL: redis is not running and 'brew' is not available to start it." >&2
    exit 1
  fi
  brew services start redis >/dev/null
  if ! wait_for_redis 15; then
    echo "FAIL: redis did not become ready within 15s." >&2
    exit 1
  fi
  echo "Redis: started."
else
  echo "Redis: already running, leaving it alone."
fi

{
  if [[ ! -f "$SRS_BINARY" ]]; then
    echo "FAIL: SRS binary not found at $SRS_BINARY." >&2
    echo "Build it first: cd $WORKSPACE/trunk && ./configure && make" >&2
    exit 1
  fi
  echo "Starting local SRS..."
  (cd "$PLATFORM_DIR" && exec "$SRS_BINARY" -c "$SRS_CONF") >/tmp/oryx-stack-srs.log 2>&1 &
  SRS_PID=$!
  disown "$SRS_PID" 2>/dev/null || true
  if ! wait_for_http "$SRS_API/api/v1/versions" 15; then
    echo "FAIL: SRS did not become ready within 15s. Logs:" >&2
    cat /tmp/oryx-stack-srs.log >&2
    exit 1
  fi
  echo "SRS: started (pid $SRS_PID)."
}

{
  echo "Starting Oryx backend with 'go run .'..."
  (cd "$PLATFORM_DIR" && exec env AUTO_SELF_SIGNED_CERTIFICATE=off go run .) >/tmp/oryx-stack-backend.log 2>&1 &
  BACKEND_PID=$!
  disown "$BACKEND_PID" 2>/dev/null || true
  if ! wait_for_http "$ENDPOINT/terraform/v1/mgmt/versions" 60; then
    echo "FAIL: Oryx backend did not become ready within 60s. Logs:" >&2
    cat /tmp/oryx-stack-backend.log >&2
    exit 1
  fi
  echo "Oryx backend: started (pid $BACKEND_PID)."
}

{
  if [[ ! -d "$UI_DIR/node_modules" ]]; then
    echo "FAIL: UI dependencies not installed at $UI_DIR/node_modules." >&2
    echo "Install them first: cd $UI_DIR && npm install" >&2
    exit 1
  fi
  echo "Starting React dashboard with 'npm start'..."
  (cd "$UI_DIR" && exec npm start) >/tmp/oryx-stack-ui.log 2>&1 &
  UI_PID=$!
  disown "$UI_PID" 2>/dev/null || true
  if ! wait_for_http "$UI_ENDPOINT" 90; then
    echo "FAIL: React dashboard did not become ready within 90s. Logs:" >&2
    cat /tmp/oryx-stack-ui.log >&2
    exit 1
  fi
  echo "React dashboard: started (pid $UI_PID)."
}

save_state || exit 1

echo ""
echo "State recorded in $STATE_FILE"
echo "=== Oryx Stack Start done ==="
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 321kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 321kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 321kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall