No description
Find a file
2026-06-01 23:37:05 +03:00
templates first commit 2026-06-01 23:37:05 +03:00
01-trial-dockerfile.md first commit 2026-06-01 23:37:05 +03:00
02-vps-setup.md first commit 2026-06-01 23:37:05 +03:00
03-manager-app.md first commit 2026-06-01 23:37:05 +03:00
04-docker-publish-script.md first commit 2026-06-01 23:37:05 +03:00
05-rbac-and-templates.md first commit 2026-06-01 23:37:05 +03:00
06-aks-scaling.md first commit 2026-06-01 23:37:05 +03:00
potatobrained-aks.md first commit 2026-06-01 23:37:05 +03:00
potatobrained-vps.md first commit 2026-06-01 23:37:05 +03:00
README.md first commit 2026-06-01 23:37:05 +03:00

🚀 1-Click Demo — Replicable Guide

Turn any Spring Boot web app into a "1-Click Demo" SaaS trial system.

Users sign up → click "Start Trial" → get a live, isolated instance with its own subdomain and SSL certificate. Fully automated.


⚠️ Placeholders

Throughout this guide, the following placeholders are used. Replace them with your actual values:

Placeholder Description Example
{{APP_NAME}} Your app name (lowercase, no spaces) factoryplatform
{{APP_DISPLAY_NAME}} Your app's display name Factory Platform
{{MANAGER_PORT}} Manager spring boot app port 8885
{{APP_PORT}} The port for containers 8080
{{DOMAIN}} Your base domain numankaraaslan.com
{{DOCKERHUB_USER}} Your Docker Hub username numankaraaslan
{{DOCKER_REPO}} Docker Hub repository name for trial image factory-trial
{{VPS_IP}} Your VPS public IP address 178.105.213.245
{{MANAGER_VPS_IP}} Your Manager app VPS IP (may be the same) 4.231.171.39
{{YOUR_EMAIL}} Your email for Let's Encrypt numan4634@gmail.com
{{DB_NAME_MANAGER}} Database name for manager app factoryplatform-manager
{{DB_PASSWORD_MANAGER}} Database password for manager app 123456789
{{DB_NAME}} Database name inside the container factoryplatform
{{DB_PASSWORD}} Database password inside the container trial
{{SPRING_PROFILE}} Spring profile for trial mode trial

Note

For multi-module Spring Boot projects (like a reactor POM with shared modules), the Dockerfile.trial must be placed at the repo root so that the Docker build context can access all modules. The build command then uses -pl your-service -am to build only the target module and its dependencies.


Architecture

┌─────────────────────────────┐         ┌───────────────────────────────────┐
│  Manager VPS                │         │  Trial VPS (K3s)                  │
│  ┌───────────────────────┐  │         │  ┌─────────────────────────────┐  │
│  │ Manager App            │  │ K8s API │  │ Traefik (ports 80/443)      │  │
│  │ (Spring Boot + DB)     │──────────>│  │ cert-manager (Let's Encrypt) │  │
│  │                        │  │ :6443   │  │                             │  │
│  │ Sign up → Start Trial  │  │         │  │ Trial Pods:                 │  │
│  │   → Creates K8s Pod    │  │         │  │   demo42.example.com        │  │
│  │   → Creates Service    │  │         │  │   demo99.example.com        │  │
│  │   → Creates Ingress    │  │         │  │   ...                       │  │
│  └───────────────────────┘  │         │  └─────────────────────────────┘  │
└─────────────────────────────┘         └───────────────────────────────────┘

How it works:

  1. User signs up on the Manager web app
  2. Clicks "Start Free Trial"
  3. Manager app uses Kubernetes Java Client to create: Deployment + Service + Ingress
  4. K3s Traefik routes traffic, cert-manager issues SSL
  5. User gets a live instance at demo42.{{DOMAIN}} within ~60 seconds
  6. Trial expires after {{TTL_HOURS}} — Manager deletes the K8s resources

Guide Structure

# File What it covers
1 01-trial-dockerfile.md Bundling your Spring Boot app + PostgreSQL into a self-contained Docker image
2 02-vps-setup.md VPS + K3s + cert-manager + wildcard DNS + firewall
3 03-manager-app.md The Manager app — K8s provisioning with Java Client
4 04-docker-publish-script.md VPS-based Docker build/push script
5 05-rbac-and-templates.md ServiceAccount, RBAC, K8s YAML templates
6 06-aks-scaling.md Scaling to Azure AKS (managed Kubernetes)

🥔 Potatobrained Guides (real-world cheat sheets)

File What it covers
potatobrained-vps.md Step-by-step VPS/K3s setup with real commands and credentials
potatobrained-aks.md Step-by-step AKS setup with real commands and credentials

⚠️ The potatobrained files contain real tokens and certificates. Do not push to a public repo.

Template files

File Description
templates/Dockerfile.trial Generic trial Dockerfile
templates/supervisord.conf supervisord config
templates/init-db.sh Database init script
templates/docker-publish.sh VPS Docker build/push script
templates/trial-k8s-setup.yaml Namespace + quota + RBAC + secrets

Cost

Resource Monthly Cost
VPS (Hetzner CX22, 4GB RAM) ~€4
K3s €0 (open source)
cert-manager + Let's Encrypt €0
Docker Hub (1 private repo) €0 (free tier)
Total ~€4/month

Scaling Path

Start cheap, scale when needed:

€4/month VPS (K3s)  →  AKS / EKS / GKE (managed Kubernetes)

Migration = change 3 config values in the Manager app:

  • k8s.api-server
  • k8s.token
  • k8s.ca-cert

Same code, bigger infrastructure.