-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-start.sh
More file actions
executable file
·111 lines (101 loc) · 3.03 KB
/
Copy pathdocker-start.sh
File metadata and controls
executable file
·111 lines (101 loc) · 3.03 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
#!/bin/bash
# Countly MCP Server - Quick Start Script
# This script helps you set up and run the Countly MCP Server with Docker
set -e
echo "🚀 Countly MCP Server - 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 first: https://docs.docker.com/get-docker/"
exit 1
fi
# Check if docker-compose is available
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null 2>&1; then
echo "❌ Error: Docker Compose is not installed"
echo "Please install Docker Compose: https://docs.docker.com/compose/install/"
exit 1
fi
# Determine docker-compose command
if docker compose version &> /dev/null 2>&1; then
DOCKER_COMPOSE="docker compose"
else
DOCKER_COMPOSE="docker-compose"
fi
# Check if .env exists
if [ ! -f .env ]; then
echo "📝 Creating .env file from .env.example..."
cp .env.example .env
echo "✅ .env file created"
echo ""
echo "⚠️ Please edit .env and set your COUNTLY_SERVER_URL"
echo " Example: COUNTLY_SERVER_URL=https://your-countly-instance.com"
echo ""
fi
# Check if token file exists
if [ ! -f countly_token.txt ]; then
echo "🔑 Token file not found"
echo ""
read -p "Enter your Countly auth token: " TOKEN
echo "$TOKEN" > countly_token.txt
chmod 600 countly_token.txt
echo "✅ Token file created: countly_token.txt"
echo ""
fi
# Ask user what to do
echo "What would you like to do?"
echo "1) Build and start the server"
echo "2) Start the server (using existing image)"
echo "3) Stop the server"
echo "4) View logs"
echo "5) Rebuild the server"
echo ""
read -p "Enter your choice (1-5): " CHOICE
case $CHOICE in
1)
echo ""
echo "🔨 Building and starting Countly MCP Server..."
$DOCKER_COMPOSE up -d --build
echo ""
echo "✅ Server is running!"
echo " Health check: http://localhost:3000/health"
echo " MCP endpoint: http://localhost:3000/mcp"
echo ""
echo "View logs with: $DOCKER_COMPOSE logs -f"
;;
2)
echo ""
echo "▶️ Starting Countly MCP Server..."
$DOCKER_COMPOSE up -d
echo ""
echo "✅ Server is running!"
echo " Health check: http://localhost:3000/health"
echo " MCP endpoint: http://localhost:3000/mcp"
;;
3)
echo ""
echo "⏹️ Stopping Countly MCP Server..."
$DOCKER_COMPOSE down
echo "✅ Server stopped"
;;
4)
echo ""
echo "📋 Server logs (Ctrl+C to exit):"
echo ""
$DOCKER_COMPOSE logs -f
;;
5)
echo ""
echo "🔨 Rebuilding Countly MCP Server..."
$DOCKER_COMPOSE down
$DOCKER_COMPOSE build --no-cache
$DOCKER_COMPOSE up -d
echo ""
echo "✅ Server rebuilt and running!"
;;
*)
echo "❌ Invalid choice"
exit 1
;;
esac