Deployer: Self-Hosted CI/CD for Swift Server Apps

GitHub repository: click here.

I built a self-hosted CI/CD tool specifically for Swift server apps powered by the Vapor framework. When you git push new code to your app's repository, Deployer intercepts this using webhooks. It then builds your app (swift build) and restarts it on your server.

A reactive live dashboard provides real time build output streams and deployment status changes, as well as start and stop buttons for your app and run buttons for the commits pushed on main. You can either use manual mode where deployments only start by pressing the run button in the panel, or automatic mode, where deployments happen instantly once new code is pushed. Only one build can run at a time; the last commit wins when multiple are pushed concurrently.

Most Swift server deploy setups I’ve tried ended up being a mix of shell scripts, GitHub Actions, and manual SSH steps. I wanted something simpler that allows for quick interation and production testing while being fully self-hosted. Deployer handles initial server setup through an automated and interactive CLI command, so it’s suitable even for developers that are new to server-side Swift.

Tech Stack

Setup

To bootstrap on a fresh Ubuntu VPS, run (as root):

bash <(curl -sSL https://mottzi.codes/deployer/setup.sh)
  1. Installs Swift (via Swiftly).

  2. Configures Nginx reverse proxy

  3. Issues TLS certificates (using Let's encrypt).

  4. Sets up the GitHub webhook and deploy key.

  5. Brings your app online.

Control

You manage Deployer via deployerctl, for example:

sudo deployerctl start  # starts deployer and app 
sudo deployerctl status app
sudo deployerctl stop deployer
sudo deployerctl update # updates deployer itself

I'm interested in your thoughts and feedback. This release is pretty bear bones feature wise. It may have some rough edges, especially the front-end. You are very welcome to contribute, if you choose so.

7 Likes

Is it mandatory to use sudo command?

Yes, sudo is currently enforced. You must use sudo deployer setup to install the environment, and sudo deployerctl <cmd> (update, restart, etc.) to manage it. Initial setup requires root because it installs packages, creates users, and configures system components like nginx and systemd.

That said, after setup the deployer and your app run as an unprivileged service user (e.g. vapor). Even when invoked via sudo, deployerctl immediately drops privileges and executes all runtime operations as that user.

Technically, the service user can manage its own services via systemctl --user, but deployerctl is currently designed as an operator-only control surface and enforces root. I think I'll revisit this and make non-root usage possible for commands where it’s technically feasible.

1 Like