security: remove .env from tracking (contains secrets)
This commit is contained in:
52
start.sh
Normal file
52
start.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
echo "=========================================="
|
||||
echo " CryptoWallet API — Docker Deploy"
|
||||
echo "=========================================="
|
||||
|
||||
# 1. Docker check
|
||||
command -v docker >/dev/null 2>&1 || { echo "[ERROR] Docker not installed"; exit 1; }
|
||||
docker compose version >/dev/null 2>&1 || { echo "[ERROR] docker compose plugin missing"; exit 1; }
|
||||
|
||||
# 2. .env check
|
||||
if [ ! -f .env ]; then
|
||||
if [ -f .env.example ]; then
|
||||
cp .env.example .env
|
||||
echo "[INFO] .env создан из примера — заполни Vault креды и запусти снова"
|
||||
exit 1
|
||||
else
|
||||
echo "[ERROR] нет ни .env, ни .env.example"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 3. Build & start
|
||||
echo "[INFO] Building and starting containers..."
|
||||
docker compose up -d --build
|
||||
|
||||
# 4. Wait healthy
|
||||
echo "[INFO] Waiting for API to become healthy..."
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf http://localhost:3001/api/health >/dev/null 2>&1; then
|
||||
echo "[OK] API is healthy"
|
||||
break
|
||||
fi
|
||||
if [ "$i" = "30" ]; then
|
||||
echo "[ERROR] API not healthy after 60s. Logs:"
|
||||
docker compose logs --tail=50 api
|
||||
exit 1
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " Up!"
|
||||
echo " API: http://localhost:3001"
|
||||
echo " Health: http://localhost:3001/api/health"
|
||||
echo " Docs: http://localhost:3001/api/docs"
|
||||
echo " Logs: docker compose logs -f api"
|
||||
echo "=========================================="
|
||||
Reference in New Issue
Block a user