-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·134 lines (114 loc) · 2.58 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·134 lines (114 loc) · 2.58 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
# GeekHack Reimagined - Development Script
# Usage: ./dev.sh [start|stop|restart|logs|status]
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
print_status() {
echo -e "${GREEN}==>${NC} $1"
}
print_warning() {
echo -e "${YELLOW}==>${NC} $1"
}
print_error() {
echo -e "${RED}==>${NC} $1"
}
start() {
print_status "Starting GeekHack Reimagined..."
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
print_error "Docker is not running. Please start Docker first."
exit 1
fi
# Start all services
docker compose up -d
print_status "Waiting for services to be healthy..."
sleep 3
# Show status
docker compose ps
echo ""
print_status "Services started successfully!"
echo ""
echo " Frontend: http://localhost:3000"
echo " Backend: http://localhost:8080/api"
echo ""
echo " View logs: ./dev.sh logs"
echo " Stop: ./dev.sh stop"
}
stop() {
print_status "Stopping GeekHack Reimagined..."
docker compose down
print_status "All services stopped."
}
restart() {
stop
echo ""
start
}
logs() {
SERVICE=${2:-""}
if [ -n "$SERVICE" ]; then
docker compose logs -f "$SERVICE"
else
docker compose logs -f
fi
}
status() {
print_status "Service Status:"
docker compose ps
}
clean() {
print_warning "This will remove all containers and volumes (data will be lost)."
read -p "Are you sure? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
docker compose down -v
print_status "All containers and volumes removed."
else
print_status "Cancelled."
fi
}
usage() {
echo "GeekHack Reimagined - Development Script"
echo ""
echo "Usage: ./dev.sh <command>"
echo ""
echo "Commands:"
echo " start Start all services (PostgreSQL, Redis, Backend, Frontend)"
echo " stop Stop all services"
echo " restart Restart all services"
echo " logs View logs (optionally: ./dev.sh logs backend)"
echo " status Show service status"
echo " clean Stop and remove all containers and volumes"
echo ""
}
# Main
case "${1:-}" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
logs)
logs "$@"
;;
status)
status
;;
clean)
clean
;;
*)
usage
exit 1
;;
esac