-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
84 lines (70 loc) · 2.06 KB
/
start.sh
File metadata and controls
84 lines (70 loc) · 2.06 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
echo "========================================"
echo " WeatherNote Backend Quick Start"
echo "========================================"
echo ""
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "[ERROR] Docker is not installed!"
echo "Please install Docker from: https://docs.docker.com/get-docker/"
exit 1
fi
echo "[INFO] Docker is installed"
echo ""
# Check if docker-compose is available
if ! command -v docker-compose &> /dev/null; then
echo "[ERROR] docker-compose is not available!"
echo "Please install docker-compose"
exit 1
fi
echo "[INFO] docker-compose is available"
echo ""
# Navigate to script directory
cd "$(dirname "$0")"
# Check if .env exists, if not copy from example
if [ ! -f .env ]; then
echo "[INFO] Creating .env file from .env.example"
cp .env.example .env
echo "[SUCCESS] .env file created. You can edit it if needed."
echo ""
else
echo "[INFO] .env file already exists"
echo ""
fi
echo "[INFO] Starting services with Docker Compose..."
echo ""
# Start services
docker-compose up -d
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to start services"
exit 1
fi
echo ""
echo "========================================"
echo " Services Started Successfully!"
echo "========================================"
echo ""
echo "Redis: http://localhost:6379"
echo "Backend API: http://localhost:8080"
echo "Health Check: http://localhost:8080/health"
echo ""
echo "To view logs:"
echo " docker-compose logs -f"
echo ""
echo "To stop services:"
echo " docker-compose down"
echo ""
# Wait 3 seconds for services to start
sleep 3
# Test health endpoint
echo "[INFO] Testing health endpoint..."
if curl -s http://localhost:8080/health > /dev/null 2>&1; then
echo "[SUCCESS] Backend is healthy!"
echo ""
echo "Test API:"
echo ' curl "http://localhost:8080/api/v1/weather?lat=40.7&lon=-74.0"'
else
echo "[WARNING] Health check failed. Services may still be starting..."
echo "Wait a few seconds and try: curl http://localhost:8080/health"
fi
echo ""