-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·72 lines (62 loc) · 2.33 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·72 lines (62 loc) · 2.33 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
#!/bin/bash
set -e
echo "=========================================================="
echo "🚀 Welcome to the OpenCodeHub 1-Click Installer! 🚀"
echo "=========================================================="
echo ""
echo "This script will deploy OpenCodeHub on your VPS or NAS."
echo "It automatically configures storage, networking, and caching"
echo "into a single './data' directory for easy backups."
echo ""
# Check for docker and docker-compose
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed! Please install Docker first."
exit 1
fi
if ! docker compose version &> /dev/null && ! docker-compose --version &> /dev/null; then
echo "❌ Docker Compose is not installed! Please install Docker Compose first."
exit 1
fi
COMPOSE_CMD="docker compose"
if ! docker compose version &> /dev/null; then
COMPOSE_CMD="docker-compose"
fi
echo "✅ Docker and Docker Compose found."
# Create data directories
echo "📁 Creating consolidated local data directories..."
mkdir -p data/opencodehub
mkdir -p data/postgres
mkdir -p data/redis
mkdir -p data/runner/work
mkdir -p data/runner/cache
# Generate secure secrets if .env doesn't exist
if [ ! -f .env ]; then
echo "🔐 Generating secure secrets for your new instance..."
JWT_SECRET=$(openssl rand -base64 32)
WORKFLOW_SECRET=$(openssl rand -hex 32)
cat > .env <<EOF
# Auto-generated by OpenCodeHub install.sh
JWT_SECRET=${JWT_SECRET}
WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET}
# Replace this with your actual domain or Tailscale IP when ready
SITE_URL=http://localhost:4321
EOF
echo "✅ .env file created."
else
echo "✅ .env file already exists, skipping secret generation."
fi
echo "🐳 Pulling latest images and starting OpenCodeHub..."
$COMPOSE_CMD pull
$COMPOSE_CMD up -d
echo ""
echo "=========================================================="
echo "🎉 OpenCodeHub has been successfully deployed! 🎉"
echo "=========================================================="
echo "All your data (database, repos, cache, ssh keys) is safely"
echo "stored in the './data' directory right here."
echo ""
echo "To back up your entire server, just zip the './data' folder!"
echo ""
echo "Web Interface: http://localhost:4321"
echo "SSH Git: ssh://git@localhost:2222"
echo "=========================================================="