BangSo/scripts/start-docker-lan.sh

49 lines
1.2 KiB
Bash
Raw Normal View History

2026-09-01 16:51:19 +00:00
#!/usr/bin/env bash
set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_dir"
if ! command -v docker >/dev/null 2>&1; then
echo "Missing required command: docker" >&2
exit 1
fi
if [[ ! -f .env ]]; then
echo "Missing .env. Run the local setup first." >&2
exit 1
fi
if ! docker info >/dev/null 2>&1; then
echo "Docker is not running. Start Docker Desktop or OrbStack and try again." >&2
exit 1
fi
lan_ip="${RAKAZO_LAN_IP:-}"
if [[ -z "$lan_ip" ]] && command -v ipconfig >/dev/null 2>&1; then
for interface_name in en0 en1; do
lan_ip="$(ipconfig getifaddr "$interface_name" 2>/dev/null || true)"
[[ -n "$lan_ip" ]] && break
done
fi
if [[ -z "$lan_ip" ]]; then
echo "Could not detect a LAN IPv4 address. Set RAKAZO_LAN_IP and try again." >&2
exit 1
fi
export RAKAZO_LAN_HOST="$lan_ip"
export RAKAZO_LAN_ORIGIN="http://${lan_ip}:5173"
compose_files=(
--env-file .env
-f infra/compose/docker-compose.yml
-f infra/compose/docker-compose.lan.yml
)
docker compose "${compose_files[@]}" config --quiet
docker compose "${compose_files[@]}" up --build -d --wait
2026-09-01 17:03:28 +00:00
echo "BangSo Bot is available on this Mac at http://127.0.0.1:5173"
echo "BangSo Bot is available on your LAN at ${RAKAZO_LAN_ORIGIN}"