MKS DevEnv

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 master

Step 2: Connect Repository in Coolify

  1. Open Coolify dashboard
  2. Click New Application
  3. Select Git (GitHub)
  4. Connect your repository
  5. 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: /docker Docker Compose Location: /docker-compose.yaml

Step 4: Configure Domains

Add domains for each service:

ServiceDomain ExamplePurpose
devenvdevenv.your-domain.comMain desktop
guacamoleguacamole.your-domain.comWeb desktop

Traefik will automatically:

  • Generate SSL certificates (Let's Encrypt)
  • Configure HTTPS routing
  • Handle reverse proxy

Step 5: Environment Variables

Add secrets in Coolify:

VariableValueSecret?
CODE_SERVER_PASSWORDYour password
RDP_PASSWORDYour password
GUACAMOLE_DB_PASSWORDStrong password
SSH_PUBLIC_KEYYour public SSH key
GITHUB_TOKENGitHub 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:

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/docker

Step 2: Configure Environment

cp .env.example .env
vim .env
# Edit passwords and configuration

Step 3: Start Services

# Start all services
docker compose up -d

# Verify
docker compose ps

Step 4: Initialize Guacamole

cd guacamole
chmod +x init.sh
./init.sh

Step 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 ps

Test Access Points

  1. Guacamole:

    • Open: http://your-domain:8081/guacamole
    • Login with guacadmin / guacadmin
    • Connect to "devenv-full RDP"
  2. Code-Server:

    • Open: http://your-domain:8443
    • Login with password from .env
  3. SSH:

    ssh root@your-domain -p 2222
  4. RDP:

    • Connect to: your-domain:3389
    • Login with root / password from .env

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_user

Logs

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-guacamole

Production 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.yaml

Coolify Build Fails

Check build logs in Coolify dashboard. Common issues:

  1. Missing dependencies - Ensure Dockerfile has all required packages
  2. Timeout - Increase build timeout in Coolify settings
  3. 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.com

Updates and Maintenance

Updating

# Pull latest changes
git pull

# Rebuild and restart
docker compose up -d --build

Backup 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 -delete

Monitoring

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)

Actions

On this page