#!/usr/bin/env bash
set -euo pipefail

# shellcheck source=common.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common.sh"

ensure_env_file
ensure_paths_defined
require_docker

if ! docker network inspect "$SYS_DEBUG_NETWORK_NAME" >/dev/null 2>&1; then
  echo "[ERR] Network $SYS_DEBUG_NETWORK_NAME not found. Run scripts/network-create.sh first." >&2
  exit 1
fi

log "Starting debug stack on project $SYS_DEBUG_PROJECT_NAME"
compose up -d

log "Services started: master:32300 es:9200 kibana:5601 node-a:2020 node-b:2021"
