Many Apps on One VPS (Docker Compose + Caddy)

    1

    Many apps, one VPS: Caddy + Docker Compose with automatic HTTPS, per-app isolation, hardening, backups and one-command deploys.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Many Apps on One VPS (Docker Compose + Caddy)

    Example session with this skill installed

    I already run app1 and app2 on my VPS with Docker Compose and Caddy. Show exactly what to add to deploy a Node app "app3" at app3.example.com that uses its own Postgres database.

    • Read your context and instructions
    • Compiled the many apps on

    Here's the exact diff for app3, following the layout in your skill (one shared Postgres, with a separate database, role and network for each app). I've assumed app3 listens on port 3000, exposes `/health`, and has a Dockerfile in `sites/app3/`. ## 1. DNS Add an A record for `app3.example.com` that points to the VPS IP. ## 2. `Caddyfile`: add a block ``` app3.example.com { encode zstd gzip reverse_proxy app3:3000 } ``` ## 3. `compose.yml`: four edits **a) Caddy joins app3's network:** ```yaml caddy: networks: [app1_net, app2_net, app3_net] ``` **b) Postgres joins it too:** ```yaml postgres: networks: [app1_net, app2_net, app3_net] ``` **c) Add the service.** Put it next to app1 and app2: ```yaml app3: build: ./sites/app3 <<: *hardening environment: NODE_ENV: production PORT: "3000" DATABASE_URL: "${APP3_DATABASE_URL}" deploy: { resources: { limits: { memory: 512m } } } healthcheck: test: ["CMD", "node", "-e", "fetch('http://localhost:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"] interval: 30s timeout: 5s retries: 3 start_period: 20s networks: [app3_net] ``` **d) Declare the network:** ```yaml networks: { app1_net: {}, app2_net: {}, app3_net: {} } ``` The `read_only` and `tmpfs: /tmp` settings come from the hardening anchor. If app3 writes anywhere else, add a tmpfs or a volume for that path. ## 4. `.env` (chmod 600) ``` APP3_DB_PASSWORD=<generate: openssl rand -hex 24> APP3_DATABASE_URL=postgres://app3:<same password>@postgres:5432/app3 ``` `.env` is also the Postgres `env_file`, so it can see these values. Only app3 receives `APP3_DATABASE_URL`. ## 5. Create the database and role Postgres init scripts only run on an empty data directory, so create these by hand on the running instance: ```bash cd /opt/apps docker compose exec postgres psql -U "$POSTGRES_USER" -d postgres <<'SQL' CREATE ROLE app3 LOGIN PASSWORD 'PASTE_APP3_DB_PASSWORD'; CREATE DATABASE app3 OWNER app3; REVOKE CONNECT ON DATABASE app3 FROM PUBLIC; GRANT CONNECT ON DATABASE app3 TO app3; SQL ``` Replace `$POSTGRES_USER` with the value from `.env` if your shell doesn't have it set. To confirm app1 and app2 are locked out of app3's database, also run `REVOKE CONNECT ... FROM PUBLIC` on their databases if you haven't already. ## 6. Deploy ```bash ./deploy.sh app3 docker compose up -d caddy # picks up the new network docker compose exec caddy caddy reload --config /etc/caddy/Caddyfile curl -fsS https://app3.example.com/health docker compose logs -f app3 ``` ## 7. Backups Add a nightly `pg_dump -Fc app3` to your backup job, and copy it off the server. If you want a separate Postgres container for app3 rather than another database in the shared one, say so. It would cost about 100–200 MB of RAM and I'd give you a variant of the compose block above. _Real output from a Claude Code session with this skill installed._

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Stop paying for individual PaaS instances and moving side projects between sleeping free tiers. This skill provides a blueprint for running multiple web applications on a single Linux VPS using a hardened, isolated architecture. It focuses on cost efficiency and security through containerization and automatic HTTPS management. ## What it does - **Multi-app isolation** puts each app on its own Docker network and database role, so one compromised app has no direct path to the others. - **Automatic HTTPS** via Caddy integration, handling certificate acquisition and renewal for every subdomain without manual intervention. - **Resource management** through Docker Compose memory limits to prevent memory leaks from crashing the entire server. - **Security hardening** with no-new-privileges, dropped capabilities, read-only filesystems, and UFW/SSH best practices. - **Database multi-tenancy** allows a single Postgres instance to serve multiple apps while enforcing strict cross-database access Revocation. ## How it works 1. **Server Baseline** sets up Ubuntu with SSH keys, swap files, and firewall rules that block everything except web traffic and SSH. 2. **Infrastructure Layout** organizes the directory structure for compose files, Caddyfiles, site source code, and secrets. 3. **Hardening Anchors** apply a standard security profile across all services to drop capabilities and prevent privilege escalation. 4. **Deployment Workflow** uses a Bash script to rsync code and rebuild specific services without taking down the rest of the stack. ## Frameworks & tools Linux (Ubuntu LTS), Docker, Docker Compose, Caddy, Postgres, Redis, and UFW. ## Why this beats prompting it yourself Most generic prompts fail to account for Docker bypassing UFW, leaving databases exposed to the public internet. This skill provides the specific network isolation and hardening anchors required to run a multi-tenant server safely. ## Use cases - Consolidate several sleeping free-tier hobby apps into one small VPS (2 vCPU / 8 GB runs a handful comfortably). - Launch a new internal tool or demo on a dedicated subdomain with instant SSL. - Audit an existing small server to add healthchecks and automated backups. ## Known limitations Requires manual DNS A record configuration for each subdomain. Postgres and Redis require custom capability adjustments to start under hardened profiles.

    Requires manual DNS A record setup. Postgres needs specific capability adjustments to run under hardened profiles. Docker's network bypass of UFW requires strict port mapping discipline.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 16 days ago

    • Free with an Agensi account

    Requires

    Docker + Docker Compose
    Caddy 2
    A Linux VPS with SSH access

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    Allowed Hosts

    app1.example.com
    Listed16 days ago

    What's inside

    Frequently Asked Questions

    This skill addresses the 'Docker bypasses UFW' risk (only Caddy publishes ports), so private databases are not exposed to the internet, while consolidating multiple apps onto a single affordable server.

    Any agent that supports the SKILL.md standard (Claude Code, Codex CLI, Cursor and others). It is pure instructions; the agent needs to edit files and, if you let it, run commands over SSH.

    A SKILL.md with the server baseline, folder layout, Caddyfile and Compose examples (with a hardening anchor), per-app database isolation, a deploy script, backup advice and a checklist for adding an app. It is free.

    Yes. Each service gets a memory limit (deploy.resources.limits.memory), so one leaking app is killed and restarted instead of taking the server down. CPU limits are not covered by the skill but can be added the same way.

    While it works with any web app, you will need to manually point your DNS A records to the VPS IP address for each subdomain you wish to host.

    The skill is designed for Ubuntu LTS but is generally compatible with any Debian-based Linux distribution that supports Docker and UFW.

    New in DevOps & Cloud