Deploy with CyberPanel
CyberPanel is a hosting control panel that uses OpenLiteSpeed (OLS) as its web server. This guide covers deploying OpenCodeHub on a CyberPanel server.
Prerequisites
Section titled “Prerequisites”- CyberPanel installed on a VPS
- Root SSH access
- Domain pointed to your server
- PostgreSQL or MySQL available
Step 1: Create Website in CyberPanel
Section titled “Step 1: Create Website in CyberPanel”- Login to CyberPanel admin panel
- Go to Websites → Create Website
- Configure:
- Domain:
git.yourdomain.com - Email: your email
- PHP: None (we’ll use Node.js)
- SSL: Issue SSL via Let’s Encrypt
- Domain:
Step 2: Install Node.js
Section titled “Step 2: Install Node.js”CyberPanel doesn’t include Node.js by default. Install via SSH:
# Connect via SSH as rootssh root@your-server-ip
# Install Node.js 20.xcurl -fsSL https://deb.nodesource.com/setup_20.x | bash -apt install -y nodejs
# Verifynode --version # Should be 20.xnpm --versionStep 3: Install PostgreSQL
Section titled “Step 3: Install PostgreSQL”# Install PostgreSQLapt install -y postgresql postgresql-contrib
# Create database and usersudo -u postgres psql << EOFCREATE DATABASE opencodehub;CREATE USER opencodehub WITH ENCRYPTED PASSWORD 'your-secure-password';GRANT ALL PRIVILEGES ON DATABASE opencodehub TO opencodehub;\c opencodehubGRANT ALL ON SCHEMA public TO opencodehub;EOFStep 4: Clone and Setup Application
Section titled “Step 4: Clone and Setup Application”# Create app directorymkdir -p /home/git.yourdomain.com/appcd /home/git.yourdomain.com/app
# Clone repositorygit clone https://github.com/swadhinbiswas/OpencodeHub.git .
# Install dependenciesnpm install
# Create environment filecat > .env << 'EOF'NODE_ENV=productionPORT=3000SITE_URL=https://git.yourdomain.com
# DatabaseDATABASE_DRIVER=postgresDATABASE_URL=postgresql://opencodehub:your-secure-password@localhost:5432/opencodehub
# Security (generate with: openssl rand -hex 32)JWT_SECRET=your-64-char-jwt-secretSESSION_SECRET=your-64-char-session-secretINTERNAL_HOOK_SECRET=your-64-char-hook-secret
# StorageSTORAGE_TYPE=localSTORAGE_PATH=./data/reposEOF
# Buildnpm run build
# Initialize databasenpm run db:push
# Create admin usernpm run scripts/seed-admin.tsStep 5: Configure OpenLiteSpeed
Section titled “Step 5: Configure OpenLiteSpeed”CyberPanel uses OpenLiteSpeed. We need to set up reverse proxy.
Create Proxy Configuration
Section titled “Create Proxy Configuration”- SSH into server
- Edit the vhost config:
nano /usr/local/lsws/conf/vhosts/git.yourdomain.com/vhconf.conf- Add or modify the config:
docRoot $VH_ROOT/public_htmlenableGzip 1
context / { type proxy handler localhost:3000 addDefaultCharset off}
rewrite { enable 1 autoLoadHtaccess 1}Alternative: Via CyberPanel UI
Section titled “Alternative: Via CyberPanel UI”- Go to Websites → List Websites
- Click on your website → vHost Conf
- Add the proxy context as shown above
- Click Save
Restart LiteSpeed
Section titled “Restart LiteSpeed”systemctl restart lswsStep 6: Setup Process Manager (PM2)
Section titled “Step 6: Setup Process Manager (PM2)”# Install PM2npm install -g pm2
# Start OpenCodeHubcd /home/git.yourdomain.com/apppm2 start dist/server/entry.mjs --name opencodehub
# Save process listpm2 save
# Setup startup scriptpm2 startup systemd# Run the command it outputsStep 7: Configure Firewall
Section titled “Step 7: Configure Firewall”CyberPanel uses firewalld:
# Allow necessary ports (if not already open)firewall-cmd --permanent --add-port=3000/tcpfirewall-cmd --reloadSSL Configuration
Section titled “SSL Configuration”CyberPanel can automatically issue SSL via Let’s Encrypt:
- Go to SSL → Manage SSL
- Select your website
- Click Issue SSL
The SSL will be automatically configured for OpenLiteSpeed.
OpenLiteSpeed Optimizations
Section titled “OpenLiteSpeed Optimizations”Increase Timeouts for Git Operations
Section titled “Increase Timeouts for Git Operations”Edit /usr/local/lsws/conf/vhosts/git.yourdomain.com/vhconf.conf:
context / { type proxy handler localhost:3000 addDefaultCharset off
# Extended timeouts for git operations extraparam { ProxyTimeout 600 }}Enable WebSocket Support
Section titled “Enable WebSocket Support”context /ws { type proxy handler localhost:3000 addDefaultCharset off
extraparam { WebSocket 1 }}Monitoring with CyberPanel
Section titled “Monitoring with CyberPanel”View Logs
Section titled “View Logs”- Go to Logs → Access Logs or Error Logs
- Select your website
PM2 Monitoring
Section titled “PM2 Monitoring”# View statuspm2 status
# View logspm2 logs opencodehub
# Monitor resourcespm2 monitTroubleshooting
Section titled “Troubleshooting”503 Bad Gateway
Section titled “503 Bad Gateway”- Check if Node.js app is running:
pm2 status - Verify port 3000 is listening:
netstat -tlnp | grep 3000 - Check LiteSpeed error logs:
/usr/local/lsws/logs/error.log
Application Crashes on Restart
Section titled “Application Crashes on Restart”# Check PM2 logspm2 logs opencodehub --lines 100
# Restart applicationpm2 restart opencodehubDatabase Connection Issues
Section titled “Database Connection Issues”# Test PostgreSQL connectionpsql -U opencodehub -h localhost -d opencodehubUpdating OpenCodeHub
Section titled “Updating OpenCodeHub”cd /home/git.yourdomain.com/app
# Pull latest changesgit pull origin main
# Install dependenciesnpm install
# Rebuildnpm run build
# Run migrationsnpm run db:push
# Restartpm2 restart opencodehubComparison: OpenLiteSpeed vs Nginx
Section titled “Comparison: OpenLiteSpeed vs Nginx”| Feature | OpenLiteSpeed | Nginx |
|---|---|---|
| Performance | Excellent | Excellent |
| .htaccess support | ✅ | ❌ |
| WebSocket | ✅ | ✅ |
| Configuration | GUI + files | Files only |
| Resource usage | Low | Very low |
Both work well for OpenCodeHub.