Deployment Guide
From localhost to production in one command
Deploying a RailsFast app is designed to be painless. Kamal 2 handles everything: building Docker images, pushing to your registry, and rolling out zero-downtime deploys.
Prerequisites
Before deploying, you'll need:
- A server (any VPS works: Hetzner, DigitalOcean, AWS, etc.)
- A domain name pointed to your server
- Docker installed locally
- Your
config/deploy.ymlconfigured
One-Command Deploy
# First time? Set up the server
kamal setup
# Every deploy after that
kamal deploy
That's it. Kamal builds your Docker image, pushes it to your container registry, and deploys it with zero downtime.
What Happens Under the Hood
When you run kamal deploy, here's what happens:
- Build — Docker builds your app image using the included
Dockerfile - Push — The image is pushed to your container registry (ECR, Docker Hub, etc.)
- Pull — Your server pulls the new image
- Boot — The new container starts and health checks pass
- Switch — Traffic is routed to the new container
- Cleanup — The old container is stopped and removed
Database Setup
RailsFast includes a PostgreSQL accessory in deploy.yml:
accessories:
postgres:
image: postgres:15
host: your-server-ip
env:
secret:
- POSTGRES_USER
- POSTGRES_PASSWORD
directories:
- data:/var/lib/postgresql/data
Automatic nightly backups are also configured out of the box.
SSL Certificates
Kamal's built-in Thruster proxy handles SSL automatically via Let's Encrypt. Just set your domain in deploy.yml:
proxy:
ssl: true
host: yourdomain.com
Environment Variables
Secrets are managed in .kamal/secrets and injected at deploy time. Never commit secrets to git — Kamal reads them from your local machine or a secrets manager.
Monitoring
After deploying, you can check on your app:
kamal app logs # View application logs
kamal app details # Container status
kamal audit # Deployment history
This Is a Demo
You're looking at a deployed RailsFast app right now. This exact deployment flow is what brought this demo to life. Get RailsFast and deploy your own.