-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
30 lines (24 loc) · 812 Bytes
/
run.sh
File metadata and controls
30 lines (24 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f ".env" ]; then
cat > .env <<'EOF'
POSTGRES_USER=notes_user
POSTGRES_PASSWORD=notes_pass
POSTGRES_DB=notes_db
API_PORT=4000
WEB_PORT=8080
EOF
echo "Created default .env file"
fi
echo "🚀 Starting stack (waiting for healthchecks)…"
docker compose up -d --build --wait
URL="http://localhost:${WEB_PORT:-8080}"
echo "🌐 Opening frontend at $URL"
if command -v xdg-open >/dev/null; then xdg-open "$URL";
elif command -v open >/dev/null; then open "$URL";
elif command -v start >/dev/null; then start "$URL";
else echo "Please open $URL manually"; fi
echo "📜 Tailing logs (Ctrl+C to stop)…"
echo "📚 API docs available at http://localhost:${API_PORT:-4000}/docs"
trap "echo '🛑 Stopping stack…'; docker compose down" INT
docker compose logs -f