Deployment
Deploy DevEnv Pro to production using Coolify or manual Docker setup
Deployment
Deploy DevEnv Pro to production using Coolify or manual Docker setup.
Deployment with Coolify
Coolify provides automatic deployment from GitHub with HTTPS via Traefik.
Prerequisites
- GitHub repository with your code
- VPS with Docker installed
- Coolify instance running on your VPS
- Domain configured with DNS pointing to your VPS
Step 1: Push to GitHub
git add .
git commit -m "Ready for Coolify deployment"
git push origin masterStep 2: Connect Repository in Coolify
- Open Coolify dashboard
- Click New Application
- Select Git (GitHub)
- Connect your repository
- Select branch:
master
Step 3: Configure Application
Basic Settings:
- Name:
mks-dev-environment - Repository:
MKS2508/mks-dev-environment - Branch:
master
Build Pack: Docker Compose
- Base Directory:
/dockerDocker Compose Location:/docker-compose.yaml
Step 4: Configure Domains
Add domains for each service:
| Service | Domain Example | Purpose |
|---|---|---|
| devenv | devenv.your-domain.com | Main desktop |
| guacamole | guacamole.your-domain.com | Web desktop |
Traefik will automatically:
- Generate SSL certificates (Let's Encrypt)
- Configure HTTPS routing
- Handle reverse proxy
Step 5: Environment Variables
Add secrets in Coolify:
| Variable | Value | Secret? |
|---|---|---|
CODE_SERVER_PASSWORD | Your password | ✅ |
RDP_PASSWORD | Your password | ✅ |
GUACAMOLE_DB_PASSWORD | Strong password | ✅ |
SSH_PUBLIC_KEY | Your public SSH key | ✅ |
GITHUB_TOKEN | GitHub PAT | ✅ |
Step 6: Deploy
Click Deploy and wait for:
- Build to complete
- Containers to start
- Health checks to pass
Example Coolify Domains
From the Coolify configuration:
devenv: https://lab1-helsinki.devenv-1.mks2508.systemsguacamole: https://lab1-helsinki.guaca1.mks2508.systems
Automatic Updates
Enable automatic updates in Coolify for continuous deployment from Git.
Production Tip: Set up a webhook in GitHub to trigger automatic deployments on push.
Manual Docker Deployment
Prerequisites
- VPS with Docker and Docker Compose installed
- Domain with DNS configured (optional)
- SSL certificates (optional)
Step 1: Clone Repository
# Clone repository
git clone https://github.com/MKS2508/mks-dev-environment.git
cd mks-dev-environment/docker
# Or download release tarball
wget https://github.com/MKS2508/mks-dev-environment/archive/refs/heads/master.tar.gz
tar -xzf master.tar.gz
cd mks-dev-environment/dockerStep 2: Configure Environment
cp .env.example .env
vim .env
# Edit passwords and configurationStep 3: Start Services
# Start all services
docker compose up -d
# Verify
docker compose psStep 4: Initialize Guacamole
cd guacamole
chmod +x init.sh
./init.shStep 5: Configure SSL (Optional)
For production, use Traefik or Nginx as reverse proxy:
Traefik Example:
labels:
- "traefik.enable=true"
- "traefik.http.routers.guacamole.rule=Host(`guacamole.your-domain.com`)"
- "traefik.http.routers.guacamole.tls=true"
- "traefik.http.services.guacamole.loadbalancer.server.port=8081"Nginx Example:
server {
listen 443 ssl;
server_name guacamole.your-domain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8081;
}
}Verification
Check Services
# Check all containers are running
docker compose ps
# Check service health
docker compose psTest Access Points
-
Guacamole:
- Open:
http://your-domain:8081/guacamole - Login with
guacadmin/guacadmin - Connect to "devenv-full RDP"
- Open:
-
Code-Server:
- Open:
http://your-domain:8443 - Login with password from
.env
- Open:
-
SSH:
ssh root@your-domain -p 2222 -
RDP:
- Connect to:
your-domain:3389 - Login with
root/ password from.env
- Connect to:
Health Checks
# devenv health
curl -f http://localhost:8443/healthz
# Guacamole health
curl -f http://localhost:8081/guacamole
# PostgreSQL health
docker exec mks-guacamole-postgres pg_isready -U guacamole_userLogs
View logs for troubleshooting:
# All services
docker compose logs -f
# Specific service
docker compose logs -f devenv
docker compose logs -f guacamole
# Container logs
docker logs -f mks-devenv-full
docker logs -f mks-guacamoleProduction Checklist
Before deploying to production:
⚠️ Security Checklist
- Change all default passwords
- Use strong SSH keys (disable password auth)
- Configure firewall (only open needed ports)
- Enable HTTPS (SSL certificates)
- Set up backups (volumes and database)
- Monitor resources (disk, memory, CPU)
- Configure log rotation
- Test disaster recovery
Troubleshooting Deployment
Container Won't Start
# Check container logs
docker compose logs <service>
# Check resource usage
docker stats
# Restart service
docker compose restart <service>Port Conflicts
If you get "port already allocated":
# Find what's using the port
sudo lsof -i :8081
# Stop conflicting service
sudo systemctl stop <service>
# Or change port in docker-compose.yamlCoolify Build Fails
Check build logs in Coolify dashboard. Common issues:
- Missing dependencies - Ensure Dockerfile has all required packages
- Timeout - Increase build timeout in Coolify settings
- Memory - Ensure enough RAM on build server
SSL Certificate Issues
If Let's Encrypt fails:
# Check Traefik logs
docker compose logs traefik
# Manual certificate generation
sudo certbot certonly --standalone -d your-domain.comUpdates and Maintenance
Updating
# Pull latest changes
git pull
# Rebuild and restart
docker compose up -d --buildBackup Strategy
# Automated backup script
#!/bin/bash
DATE=$(date +%Y%m%d)
docker run --rm -v mks-devenv-workspace:/data -v /backup:/backup alpine tar czf /backup/devenv-$DATE.tar.gz /data
# Keep last 7 days
find /backup -name "devenv-*.tar.gz" -mtime +7 -deleteMonitoring
Set up monitoring for:
- Container health
- Disk usage
- Memory usage
- CPU usage
- Response times
Recommended tools:
- Prometheus + Grafana
- Uptime Robot or StatusCake
- Log aggregation (Loki, Elasticsearch)