Deploy on CyberPanel
Difficulty: Easy-Intermediate | Time: 25-35 minutes | Method: Docker Compose (recommended) or LiteSpeed Node.js
CyberPanel is a modern, free, open-source hosting control panel powered by OpenLiteSpeed. It offers better performance than cPanel for modern applications and has native Docker support in the Enterprise version.
Prerequisites
Section titled “Prerequisites”- VPS with Ubuntu 22.04/24.04, AlmaLinux 8/9, or Rocky Linux 8/9
- Minimum 2 CPU cores, 4GB RAM, 40GB SSD
- Root or sudo access
- A domain/subdomain pointed to your server (e.g.,
git.yourdomain.com)
Step 1: Install CyberPanel
Section titled “Step 1: Install CyberPanel”If you haven’t installed CyberPanel yet:
# Run the installersh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)During installation:
- Select 1 for CyberPanel + OpenLiteSpeed
- Select 1 for Full installation
- Set MySQL password
- Choose whether to install PowerDNS, Postfix, Pure-FTPd (optional)
- Install Memcached/Redis (select Y for Redis - we’ll use it)
- Install Watchdog (recommended)
After installation, access CyberPanel at:
https://your-server-ip:8090Deployment Method A: Docker Compose (Recommended)
Section titled “Deployment Method A: Docker Compose (Recommended)”CyberPanel Enterprise and recent versions support Docker. This is the easiest and most complete method.
Step A.1: Enable Docker in CyberPanel
Section titled “Step A.1: Enable Docker in CyberPanel”- Log into CyberPanel
- Go to Docker → Install Docker
- Wait for installation to complete
- Go to Docker → Images → Pull Image
- Pull these images:
postgres:16-alpineredis:7-alpine
Step A.2: Create Docker Network
Section titled “Step A.2: Create Docker Network”# SSH into your serverssh root@your-server-ip
docker network create opencodehub-networkStep A.3: Create Persistent Volumes
Section titled “Step A.3: Create Persistent Volumes”mkdir -p /var/lib/opencodehub/{repos,storage,ssh,cache}Step A.4: Start PostgreSQL Container
Section titled “Step A.4: Start PostgreSQL Container”In CyberPanel:
- Go to Docker → Containers → Create Container
- Or use CLI:
docker run -d \ --name opencodehub-postgres \ --network opencodehub-network \ -e POSTGRES_USER=opencodehub \ -e POSTGRES_PASSWORD=$(openssl rand -hex 16) \ -e POSTGRES_DB=opencodehub \ -v opencodehub-postgres:/var/lib/postgresql/data \ -p 127.0.0.1:5432:5432 \ --restart unless-stopped \ postgres:16-alpineNote the password you set.
Step A.5: Start Redis Container
Section titled “Step A.5: Start Redis Container”docker run -d \ --name opencodehub-redis \ --network opencodehub-network \ -v opencodehub-redis:/data \ -p 127.0.0.1:6379:6379 \ --restart unless-stopped \ redis:7-alpine \ redis-server --appendonly yes --requirepass $(openssl rand -hex 16)Note the Redis password.
Step A.6: Deploy OpenCodeHub
Section titled “Step A.6: Deploy OpenCodeHub”Clone and Build
Section titled “Clone and Build”cd /var/lib/opencodehubgit clone https://github.com/swadhinbiswas/OpencodeHub.gitcd OpenCodeHub
# Create environment filecp .env.example .envnano .envConfigure .env:
# DatabaseDATABASE_DRIVER=postgresDATABASE_URL=postgresql://opencodehub:POSTGRES_PASSWORD@127.0.0.1:5432/opencodehub
# RedisREDIS_URL=redis://:REDIS_PASSWORD@127.0.0.1:6379
# Secrets (generate each with: openssl rand -hex 32)JWT_SECRET=SESSION_SECRET=INTERNAL_HOOK_SECRET=CRON_SECRET=RUNNER_SECRET=WORKFLOW_SECRET_ENCRYPTION_KEY=
# SiteSITE_URL=https://git.yourdomain.comNODE_ENV=production
# StorageSTORAGE_TYPE=localSTORAGE_PATH=/data/storageREPOS_PATH=/data/reposSSH_HOST_KEY_PATH=/data/ssh/host_key
# Skip Redis check during buildSKIP_REDIS_CHECK=1Build and Run
Section titled “Build and Run”# Build the Docker imagedocker build -t opencodehub:prod .
# Run the containerdocker run -d \ --name opencodehub \ --network opencodehub-network \ -p 127.0.0.1:4321:4321 \ -p 2222:2222 \ -v /var/lib/opencodehub/repos:/data/repos \ -v /var/lib/opencodehub/storage:/data/storage \ -v /var/lib/opencodehub/ssh:/data/ssh \ -v /var/lib/opencodehub/cache:/data/cache \ --env-file .env \ --restart unless-stopped \ opencodehub:prodStep A.7: Configure Reverse Proxy in CyberPanel
Section titled “Step A.7: Configure Reverse Proxy in CyberPanel”- In CyberPanel, go to Websites → Create Website
- Domain:
git.yourdomain.com - Package: Default
- Owner: admin
- PHP: Any (we’ll use proxy, not PHP)
- SSL: Select Issue SSL
- Click Create Website
Now configure the reverse proxy:
# SSH into servernano /usr/local/lsws/conf/vhosts/git.yourdomain.com/vhost.confAdd or modify the virtual host configuration:
<virtualHost> <name>git.yourdomain.com</name> <address>*</address> <port>80</port> <docRoot>/var/www/html</docRoot>
<rewrite> <enable>1</enable> <rules>RewriteEngine OnRewriteCond %{HTTPS} offRewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </rules> </rewrite></virtualHost>
<virtualHost> <name>git.yourdomain.com</name> <address>*</address> <port>443</port> <docRoot>/var/www/html</docRoot>
<ssl> <enable>1</enable> <certFile>/etc/letsencrypt/live/git.yourdomain.com/fullchain.pem</certFile> <keyFile>/etc/letsencrypt/live/git.yourdomain.com/privkey.pem</keyFile> </ssl>
<extProcessor> <name>opencodehub</name> <type>proxy</type> <address>127.0.0.1:4321</address> <maxConns>100</maxConns> <initTimeout>30</initTimeout> <retryTimeout>10</retryTimeout> <pcKeepAliveTimeout>5</pcKeepAliveTimeout> </extProcessor>
<context> <type>proxy</type> <uri>/</uri> <handler>opencodehub</handler> <addDefaultCharset>off</addDefaultCharset> </context>
<context> <type>proxy</type> <uri>/*.git/</uri> <handler>opencodehub</handler> <addDefaultCharset>off</addDefaultCharset> </context></virtualHost>Restart OpenLiteSpeed:
systemctl restart lswsDeployment Method B: LiteSpeed Node.js (No Docker)
Section titled “Deployment Method B: LiteSpeed Node.js (No Docker)”If you prefer not to use Docker, CyberPanel supports Node.js apps natively via LiteSpeed.
Step B.1: Install Node.js
Section titled “Step B.1: Install Node.js”# SSH as rootsource /etc/profileyum install -y nodejs npm # AlmaLinux/Rocky# ORapt install -y nodejs npm # Ubuntu
# Install Buncurl -fsSL https://bun.sh/install | bashStep B.2: Create Website in CyberPanel
Section titled “Step B.2: Create Website in CyberPanel”- Websites → Create Website
- Domain:
git.yourdomain.com - SSL: Issue Let’s Encrypt
- Click Create
Step B.3: Set Up PostgreSQL
Section titled “Step B.3: Set Up PostgreSQL”CyberPanel uses MariaDB by default. Install PostgreSQL:
# AlmaLinux/Rocky 9sudo dnf install -y postgresql16-server postgresql16-contribsudo /usr/pgsql-16/bin/postgresql-16-setup initdbsudo systemctl enable --now postgresql-16
# Create databasesudo -u postgres psql -c "CREATE USER opencodehub WITH PASSWORD 'strongpassword';"sudo -u postgres psql -c "CREATE DATABASE opencodehub OWNER opencodehub;"Step B.4: Deploy OpenCodeHub Code
Section titled “Step B.4: Deploy OpenCodeHub Code”cd /home/git.yourdomain.com/public_htmlgit clone https://github.com/swadhinbiswas/OpencodeHub.git .Step B.5: Configure Node.js App in CyberPanel
Section titled “Step B.5: Configure Node.js App in CyberPanel”- Go to Websites → List Websites
- Click Manage for
git.yourdomain.com - Go to Node.js → Setup Node.js App
- Configuration:
Application Name: opencodehubApplication Startup File: dist/server/entry.mjsApplication Path: /home/git.yourdomain.com/public_htmlApplication URL: git.yourdomain.com
- In Environment Variables, add all values from
.env - Click Create
Step B.6: Build and Start
Section titled “Step B.6: Build and Start”cd /home/git.yourdomain.com/public_htmlcp .env.example .env# Edit .env with your valuesnano .env
# Install dependenciesbun install
# Buildexport SKIP_REDIS_CHECK=1bun run build
# Initialize databasebun run db:push
# Create admin userbun run scripts/seed-admin.tsBack in CyberPanel:
- Go to Node.js → Manage Node.js Apps
- Click Start for your app
Step 2: Create Admin User (Docker Method)
Section titled “Step 2: Create Admin User (Docker Method)”# If using Dockerdocker exec -it opencodehub bun run scripts/seed-admin.tsEnter username, email, and password.
Step 3: Verify Installation
Section titled “Step 3: Verify Installation”# Check container is runningdocker ps
# Check logsdocker logs opencodehub
# Test healthcurl http://127.0.0.1:4321/api/healthVisit https://git.yourdomain.com in your browser.
Step 4: Configure Firewall
Section titled “Step 4: Configure Firewall”CyberPanel uses firewalld/ufw. Open necessary ports:
# For SSH Git accessfirewall-cmd --permanent --add-port=2222/tcpfirewall-cmd --reload
# For OpenCodeHub web (if not using reverse proxy)# Port 4321 should only be accessible locally (127.0.0.1) when behind proxyStep 5: Set Up CI/CD Runner (Docker Method)
Section titled “Step 5: Set Up CI/CD Runner (Docker Method)”If you deployed via Docker:
# Build runner imagedocker build -t opencodehub-runner -f Dockerfile.runner .
# Run runnerdocker run -d \ --name opencodehub-runner \ --network opencodehub-network \ --privileged \ -e SERVER_URL=https://git.yourdomain.com \ -e RUNNER_TOKEN=<get-from-admin-panel> \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /var/lib/opencodehub/runner-work:/work \ -v /var/lib/opencodehub/runner-cache:/cache \ --restart unless-stopped \ opencodehub-runnerGet the runner token from OpenCodeHub admin panel → Runners → Register Runner.
Step 6: SSL with Let’s Encrypt
Section titled “Step 6: SSL with Let’s Encrypt”In CyberPanel Dashboard:
Section titled “In CyberPanel Dashboard:”- Go to SSL → Manage SSL
- Select
git.yourdomain.com - Click Issue SSL
- CyberPanel will automatically configure OpenLiteSpeed with the certificate
Auto-Renewal:
Section titled “Auto-Renewal:”CyberPanel handles Let’s Encrypt auto-renewal automatically.
Maintenance
Section titled “Maintenance”Update OpenCodeHub
Section titled “Update OpenCodeHub”cd /var/lib/opencodehub/OpenCodeHubgit pull origin main
# Rebuilddocker build -t opencodehub:prod .
# Restart containerdocker stop opencodehubdocker rm opencodehub
# Re-run with same docker run command from Step A.6Or use Docker Compose for easier management:
# Create docker-compose.yml in /var/lib/opencodehubcat > docker-compose.yml << 'EOF'version: '3.8'
services: app: build: context: ./OpenCodeHub dockerfile: Dockerfile container_name: opencodehub restart: unless-stopped ports: - "127.0.0.1:4321:4321" - "2222:2222" env_file: ./OpenCodeHub/.env volumes: - ./repos:/data/repos - ./storage:/data/storage - ./ssh:/data/ssh - ./cache:/data/cache depends_on: - postgres - redis networks: - och-net
postgres: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_USER: opencodehub POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: opencodehub volumes: - ./postgres-data:/var/lib/postgresql/data networks: - och-net
redis: image: redis:7-alpine restart: unless-stopped command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD} volumes: - ./redis-data:/data networks: - och-net
runner: build: context: ./OpenCodeHub dockerfile: Dockerfile.runner container_name: opencodehub-runner restart: unless-stopped privileged: true environment: - SERVER_URL=https://git.yourdomain.com - RUNNER_TOKEN=${RUNNER_TOKEN} - DOCKER_HOST=unix:///var/run/docker.sock volumes: - /var/run/docker.sock:/var/run/docker.sock - ./runner-work:/work - ./runner-cache:/cache networks: - och-net
networks: och-net: driver: bridgeEOF
# Create .env for composecat > .env << 'EOF'POSTGRES_PASSWORD=your-postgres-passwordREDIS_PASSWORD=your-redis-passwordRUNNER_TOKEN=your-runner-tokenEOF
# Deploydocker-compose up -d --build
# Updatecd /var/lib/opencodehubdocker-compose pulldocker-compose up -d --buildBackup
Section titled “Backup”# Databasedocker exec opencodehub-postgres pg_dump -U opencodehub opencodehub > backup-$(date +%Y%m%d).sql
# Filestar czf och-backup-$(date +%Y%m%d).tar.gz /var/lib/opencodehub/repos /var/lib/opencodehub/storageSet up a cron job in CyberPanel → Cron Jobs:
0 2 * * * cd /var/lib/opencodehub && docker exec opencodehub-postgres pg_dump -U opencodehub opencodehub > backups/backup-$(date +\%Y\%m\%d).sqlTroubleshooting
Section titled “Troubleshooting”| Problem | Solution |
|---|---|
| 502 Bad Gateway | Check if OpenCodeHub container is running: docker ps. Check logs: docker logs opencodehub. |
| SSL not working | Re-issue SSL in CyberPanel → SSL → Manage SSL. Ensure DNS points to server. |
| Database connection error | Verify PostgreSQL container is running. Check .env DATABASE_URL uses correct password. |
| Git SSH not working | Ensure port 2222 is open in firewall. Verify SSH host key is generated in /data/ssh. |
| Build fails | Check Docker has enough disk space: docker system df. Free space with docker system prune. |
| Node.js app won’t start (Method B) | Check LiteSpeed error logs in CyberPanel → Logs. Verify dist/server/entry.mjs exists after build. |
| Permission denied on files | Fix ownership: chown -R 1000:1000 /var/lib/opencodehub/* (Docker runs as user 1000/bun). |
Performance Tuning
Section titled “Performance Tuning”CyberPanel + OpenLiteSpeed is already optimized, but you can tune further:
Enable LSCache
Section titled “Enable LSCache”- Go to Websites → List Websites → Manage
- LiteSpeed Cache → Enable
- This caches static assets and improves load times
Database Optimization
Section titled “Database Optimization”# In PostgreSQL containerdocker exec -it opencodehub-postgres psql -U opencodehub -d opencodehub
# Run VACUUMVACUUM ANALYZE;Set up a weekly cron:
0 3 * * 0 docker exec opencodehub-postgres psql -U opencodehub -d opencodehub -c "VACUUM ANALYZE;"