Server Roles Reference
Server roles determine which processes run on each server. Roles map directly to process types defined in your application’s Procfile.
How Roles Work
If your Procfile contains:
web: bundle exec puma -C config/puma.rb --port $PORT
worker: bundle exec rake solid_queue:start
clock: bundle exec clockwork config/clock.rb
Then:
- A server with the
web
role runs the Puma web server - A server with the
worker
role runs background job processing - A server with the
clock
role runs scheduled tasks - You can assign multiple roles to one server (e.g.,
web,worker
)
Role Types
Infrastructure Roles - Handle infrastructure tasks, no application code deployed:
- load balancer: Routes traffic to application servers
- build: Dedicated server for building Docker images
- db/database: Database server
- service: Generic infrastructure service
Application Roles - Run your application processes:
- web: Web application processes
- worker: Background jobs
- clock: Scheduled tasks
- Any custom role matching your Procfile processes
Key Rules
- Servers with only infrastructure roles won’t receive application code
- Servers need at least one application role to receive deployments
- You can combine multiple roles on a single server
- Role names must match process names in your Procfile
Recommendations
Database Servers: Use dedicated servers for databases. Databases are stateful - losing a database server means losing data. Don’t combine database roles with other roles.
Application Servers: These are stateless and can be safely replaced. Feel free to combine roles for cost optimization.
Build Servers: Use dedicated build servers to prevent Docker builds from impacting application performance.
Load Balancers: Consider dedicated load balancers for production environments to ensure reliable traffic distribution.