Procfile
Railpack automatically detects and uses Procfile
configuration files to
determine how your application should start. This is compatible with
Heroku-style Procfiles and provides a simple way to specify different process
types for your application.
Detection
Section titled “Detection”Railpack will automatically detect a Procfile
in your project root directory.
No additional configuration is required - if a Procfile
exists, Railpack will
use it to set the container start command.
Format
Section titled “Format”The Procfile
uses a YAML-style format where each line defines a process type
and its associated command:
web: gunicorn --bind 0.0.0.0:3333 main:appworker: celery worker -A myapp.celeryscheduler: celery beat -A myapp.celery
Process Type Priority
Section titled “Process Type Priority”Railpack prioritizes process types in the following order:
- web - Highest priority, typically used for HTTP servers
- worker - Second priority, typically used for background job processors
- Any other process type - If neither
web
norworker
are defined, Railpack will use the first available process type
This priority system ensures that web servers are preferred for containerized
deployments, while still supporting applications that only define worker
processes or custom process types like scheduler
, urgentWorker
, or api
.
Examples
Section titled “Examples”Web Application
Section titled “Web Application”web: node server.js
Background Worker
Section titled “Background Worker”worker: python worker.py
Multiple Process Types
Section titled “Multiple Process Types”web: gunicorn app:applicationworker: celery worker -A app.celeryscheduler: celery beat -A app.celery
In this example, Railpack will use the web
command as the container start
command.
Custom Process Types
Section titled “Custom Process Types”api: ./bin/api-serverurgentWorker: python urgent_tasks.py
If no web
or worker
process types are defined, Railpack will use the first
available process type (in this case, api
).
Integration with Other Configuration
Section titled “Integration with Other Configuration”The Procfile start command can be overridden by:
- Setting
RAILPACK_START_CMD
environment variable - Defining
deploy.startCommand
in your railpack.json config file
The priority order is:
RAILPACK_START_CMD
environment variable (highest priority)deploy.startCommand
in railpack.json- Procfile process types (web → worker → other)
- Provider-specific defaults (lowest priority)