-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·103 lines (90 loc) · 2.83 KB
/
deploy.sh
File metadata and controls
executable file
·103 lines (90 loc) · 2.83 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
#!/bin/bash
echo "========================================"
echo " ROGUE.AI CTF Challenge - Deployment"
echo "========================================"
echo ""
# Check if running with appropriate privileges
if [ "$EUID" -ne 0 ] && ! groups | grep -q docker; then
echo "⚠️ Warning: This script requires either:"
echo " - Running with sudo: sudo ./deploy.sh"
echo " - User in docker group: sudo usermod -aG docker $USER"
echo ""
echo "Current user: $(whoami)"
echo "Current groups: $(groups)"
exit 1
fi
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Error: Docker is not installed"
echo "Please install Docker first: https://docs.docker.com/get-docker/"
exit 1
fi
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null; then
echo "❌ Error: Docker Compose is not installed"
echo "Please install Docker Compose first: https://docs.docker.com/compose/install/"
exit 1
fi
echo "✓ Docker found"
echo "✓ Docker Compose found"
echo ""
# Stop any existing containers
echo "Stopping any existing containers..."
docker-compose down 2>/dev/null
# Build and start the challenge
echo ""
echo "Building and starting the CTF challenge..."
echo "This may take a few minutes on first run..."
echo ""
# Hide build output and show progress indicator
(
docker-compose up -d --build > /tmp/ctf-build.log 2>&1
) &
BUILD_PID=$!
# Show spinner while building
spin='-\|/'
i=0
while kill -0 $BUILD_PID 2>/dev/null; do
i=$(( (i+1) %4 ))
printf "\r[${spin:$i:1}] Building container... "
sleep 0.1
done
wait $BUILD_PID
BUILD_EXIT=$?
printf "\r✓ Build complete! \n"
if [ $BUILD_EXIT -ne 0 ]; then
echo ""
echo "❌ Build failed. Showing last 20 lines of build log:"
tail -20 /tmp/ctf-build.log
exit 1
fi
# Wait for services to start
echo ""
echo "Waiting for services to initialize..."
sleep 5
# Check if container is running
if [ "$(docker ps -q -f name=rogue-ai-artemis)" ]; then
echo ""
echo "========================================"
echo " ✅ CTF Challenge Successfully Deployed!"
echo "========================================"
echo ""
echo "🌐 Web Interface: http://localhost:5000"
echo "🔐 SSH Access: ssh ctfuser@localhost -p 2222"
echo ""
echo "📋 First steps:"
echo " 1. Open http://localhost:5000 in your browser"
echo " 2. Look for the first flag on the main page"
echo " 3. Try to login (hint: SQL injection or default creds)"
echo ""
echo "📚 Full player guide: see PLAYER_GUIDE.md"
echo ""
echo "🛑 To stop the challenge: docker-compose down"
echo "📊 View logs: docker-compose logs -f"
echo ""
else
echo ""
echo "❌ Error: Container failed to start"
echo "Check logs with: docker-compose logs"
exit 1
fi