Production Infrastructure Guide

VPS & Production Server Deployment

FineTuneMyAI uses a decoupled architecture: your VPS serves as the sovereign control plane, while your local Apple Silicon Macs or Linux RTX workstations act as zero-data-leak compute nodes.

Control Plane vs. Compute Sovereignty

You do not need expensive cloud GPUs on your VPS. The VPS runs the Next.js control plane, model registry metadata, and MariaDB database. Compute-heavy LoRA/QLoRA training and high-throughput inference run on your paired physical workstations via the secure pairing protocol.

1. Server Specifications

Minimum CPU
1 vCPU (x86/ARM)
2+ vCPUs recommended
Memory
2 GB RAM + 2 GB Swap
Prevents build OOM
Operating System
Ubuntu 22.04 / 24.04
Debian 12 / Rocky 9 also supported

2. Method A: Turnkey Docker Compose (Recommended)

Fastest Setup

Docker Compose orchestrates MariaDB 11.4 and the Next.js production web container with automated database initialization, migration, and health checks.

# 1. Install Docker Engine if not installed
curl -fsSL https://get.docker.com | sh
# 2. Clone repository
git clone https://github.com/kyrondataTech/fineTuneMyAi.git /var/www/finetunemyai
cd /var/www/finetunemyai/gemini
# 3. Launch isolated production containers
docker compose -f docker-compose.prod.yml up -d --build

3. Method B: Native Systemd Service

Run natively on the host using Node.js 20 LTS and systemd for minimal overhead and automatic background recovery.

# 1. Install Node.js 20 LTS and build application
npm ci --prefer-offline
npm run build
npm run db:setup
# 2. Enable & start systemd service
sudo cp scripts/vps/finetunemyai.service /etc/systemd/system/
sudo systemctl daemon-reload && sudo systemctl enable --now finetunemyai

4. Method C: Automated Deployment Script

Our interactive deployer checks system resources, configures swap to prevent OOM errors, generates cryptographically secure JWT secrets, and runs health verification.

bash scripts/vps/deploy.sh

5. Nginx Reverse Proxy & Free SSL

FineTuneMyAI includes pre-configured Nginx reverse proxy templates supporting Server-Sent Events (SSE) streaming for real-time inference and training progress, plus 500MB payload support for dataset uploads.

# 1. Install Nginx and Certbot
sudo apt install -y nginx certbot python3-certbot-nginx
# 2. Install site configuration
sudo cp vps/nginx/finetunemyai.conf /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/finetunemyai.conf /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
# 3. Request free Let's Encrypt SSL certificate
sudo certbot --nginx -d your-domain.com

6. Verification & Health Monitoring

The control plane exposes a lightweight health endpoint at /api/health compatible with Uptime Kuma, AWS Target Groups, and Docker healthchecks:

$ curl http://127.0.0.1:3050/api/health
{"status":"healthy","service":"finetunemyai-control-plane","database":{"engine":"mariadb","status":"connected"}}