Deployment guide

Deploy your applications with Kamal on a VPS

Deploy on a VPS Cloud →

Deployment8 min read

Deploy your applications with Kamal on a VPS

Kamal (formerly MRSK), from the Rails/37signals ecosystem, deploys containerized applications on one or several VPS from your local machine, without a heavy orchestrator. It combines Docker build, push to a registry, zero-downtime deployment and automatic SSL reverse proxy in a single command: `kamal deploy`.

Why deploy with Kamal on a VPS rather than with Kubernetes?

Kubernetes is oversized for the majority of applications hosted on a single VPS or a small cluster. Kamal targets precisely this ground: it takes your Dockerfile, builds the image, sends it to your servers via SSH and switches traffic without interruption thanks to its built-in proxy (kamal-proxy). The entire configuration fits in a config/deploy.yml file versioned with your code: no control plane to maintain, no endless YAML. You keep the simplicity of a VPS with a professional deployment workflow.

What Kamal brings you

  • Zero-downtime deployments via health checks and progressive traffic switching
  • Build and push of the Docker image, then deployment on the servers, in a single command
  • Automatic Let's Encrypt SSL managed by kamal-proxy, without manual configuration
  • Instant rollback to the previous version with kamal rollback
  • Centralized and encrypted management of secrets and environment variables
  • Multi-server deployment (web, jobs, accessories such as Postgres or Redis) from a single file

Prerequisites

On the VPS side, Kamal only requires key-based SSH access and Docker (which it can even install via kamal setup on the first deployment). A VPS with 2 vCPU and 2 to 4 GB of RAM is suitable for a standard web application plus its database. On the local machine side, install Kamal (Ruby gem or Docker image), and prepare a container registry (Docker Hub, GitHub Container Registry, or a private registry) as well as a domain pointing to the VPS.

Deploy an application with Kamal

01

Initialize the configuration

In your project, run kamal init. This generates config/deploy.yml and .kamal/secrets. Fill in the service name, the image (votreuser/monapp), the list of servers (servers.web) with the VPS IP and the registry used.

02

Define the secrets and variables

Place the sensitive values in .kamal/secrets (never committed): KAMAL_REGISTRY_PASSWORD, RAILS_MASTER_KEY or your application keys. Reference them in deploy.yml under env.secret. Non-sensitive variables go under env.clear.

03

Enable the proxy and SSL

In the proxy section of deploy.yml, specify your host (app.yourdomain.com) and enable ssl: true. kamal-proxy will automatically obtain the Let's Encrypt certificate and terminate TLS in front of your container. Make sure the DNS already points to the VPS before the deployment.

04

Provision the server

Run kamal setup. Kamal connects via SSH, installs Docker if needed, logs in to the registry, starts kamal-proxy and then deploys the first version. This is the single bootstrap step: subsequent deployments will be faster.

05

Deploy and check

On each update, run kamal deploy. Kamal builds the image, pushes it, starts the new containers, waits for the health checks to pass, then switches the traffic and stops the old ones. Check the status with kamal app logs -f and kamal app details.

06

Manage accessories (database, cache)

Declare Postgres or Redis under the accessories key of deploy.yml, with their image, their port and their volumes. kamal accessory boot db starts the service. You thus keep the entire stack described in a single versioned file.

If a deployment introduces a regression, don't touch the code: run kamal rollback [VERSION] to instantly return to the previous image, still present on the VPS. Also consider using kamal app exec to run one-off tasks (migrations, console) directly in the running container, without opening a manual SSH session.

Drive your Kamal deployments on a ServOrbit Cloud VPS

Provision a Cloud VPS with the Deployment template and key-based SSH access: Kamal installs Docker on it and deploys your application with zero downtime from the very first command.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.