Pioneer Designs

deployer.sh

DevOps · 2026

One Bash script that turns a fresh Ubuntu or Debian VPS into a small self-hosted platform, then deploys any Docker Compose project to its own HTTPS domain with one command: ./deployer.sh app.example.com ~/projects/app, which ends with "app.example.com is online".

What it sets up

  • nginx (or caddy) as the only public web listener, with Gitea for git hosting and Portainer CE for managing containers, each on its own subdomain.
  • Optional extras from menus: a Stalwart mail server, a ufw firewall, a swapfile, and an hourly Docker cleanup. It can also switch to Coolify, Dokploy or CapRover, and parks the old stack with its data kept.
  • Everything lives under /opt/deployer, apart from a few cron files and one web-server include. State is kept on the box, so any desktop can pick up where another left off, and every step is safe to re-run.

How a deploy works

  1. Checks the project: a root docker-compose.yml that publishes exactly one port on 127.0.0.1, and a clean branch.
  2. Pushes the branch to Gitea, creating the private repo on first push.
  3. Copies the project's .env to the box as an env_file, so secrets never go through git.
  4. Creates or redeploys the Portainer stack from the Gitea repo, waits for the new commit to run and the app to answer locally, and warns about common mistakes such as a container user that can't write its data folder.
  5. Publishes the domain through nginx with a Let's Encrypt certificate, then checks the HTTPS site from outside.

--down takes a project offline again.

Certificates

Certificates are issued with certbot's webroot challenge into deployer's own directory, so the box's existing certbot setup is left alone. One cron file renews everything twice a day and retries missing certificates hourly, so a site whose DNS wasn't ready yet gets HTTPS on its own once it is.

It runs the live deploys for borp and frezr on a 1 GB VPS.

Topics: Bash, Docker, nginx, Gitea, Portainer, certbot