The "Zero-Service" Monolith: How to run your entire app on a single server port
For years, I believed that a professional Rails app needed a small army of services to survive in production. You couldn't just run Rails. You needed Nginx to handle SSL and assets, Redis to handle background jobs and caching, and maybe a separate load balancer.
As a solo developer, managing all these pieces is exhausting. Every new service is another thing that can crash, another version to update, and another port to secure.
With Rails 8, we are entering the era of the "Zero-Service" Monolith. The goal is simple: your entire application should live inside a single Docker container and communicate with the world through one single port. No Redis, no Nginx, no headaches.
Here is how to collapse your stack into a single, powerful unit.
STEP 1: The "Solid" Trilogy (Deleting Redis)
In the past, Redis was mandatory for two things: background jobs (Sidekiq) and caching.
Rails 8 replaces Redis with the "Solid" gems. These tools use your existing database (Postgres, MySQL, or SQLite) to do the work that Redis used to do.
- Solid Queue: Handles your background jobs.
- Solid Cache: Handles your HTML fragment caching.
- Solid Cable: Handles your real-time WebSockets.
By switching to these, you can literally uninstall Redis from your server. Your background jobs now have the same "ACID" guarantees as your data, and you have one less service to monitor.
STEP 2: Thruster (Deleting Nginx)
Puma (the Rails web server) is great at running Ruby, but it isn't great at serving images or handling SSL certificates. That is why we always put Nginx in front of it.
Rails 8 includes a new tool called Thruster. It is a tiny, incredibly fast proxy written in Go that wraps around your Rails app.
Thruster handles:
- HTTP/2: Speeds up loading for your users.
- SSL (HTTPS): It manages your Let's Encrypt certificates automatically.
- Asset Compression: It Gzips your CSS and JS files so they download faster.
Because Thruster is bundled into the Rails Docker image, you don't need to install or configure Nginx on your server anymore. You just point your domain to the container, and Thruster handles the rest.
STEP 3: The Single-Port Configuration
When you use Kamal 2 to deploy your Rails 8 app, it packages everything into one container.
In your deploy.yml, you no longer have to define "Sidecars" for Nginx or link to a Redis container. You just define your web server.
# config/deploy.yml
service: my-app
image: yourname/my-app
servers:
web:
- 123.45.67.89
proxy:
ssl: true
host: myapp.com
# Everything enters through port 80/443 and goes straight
# to Thruster inside the container.
When this container starts up, it boots Thruster, which boots Puma, which starts the background job workers. Every part of your app is now living in the same memory space, on the same timeline.
STEP 4: SQLite for the Win (Optional)
If you want to go for the "Ultimate Zero-Service" setup for a micro-SaaS or a side project, you can even skip the external Database server by using SQLite.
With the recent improvements in Rails 8, SQLite is production-ready for many use cases. If you use SQLite, your "database" is just a file inside your container. Combined with Litestream for backups, your entire "Cloud Empire" is now literally just one single Docker process running on a $5 VPS.
Why this is a game changer for you
- Mental Bandwidth: You only have to think about one thing. Is the container running? If yes, the whole app is working.
- Cheaper Hosting: You don't need a server with 16GB of RAM to run 5 different services. A small, cheap server is plenty.
- Faster Onboarding: When you hire a freelancer or use an AI to help you, they don't have to spend two hours setting up a complex local environment. They just run the app.
Summary
The "Zero-Service" Monolith isn't about being lazy; it's about being efficient. As a solo developer, every minute you spend configuring a Redis config file is a minute you aren't building features for your customers.
Rails 8 and Kamal 2 have made it possible to own your infrastructure without being a DevOps expert. One container, one port, one successful business.
Top comments (0)