Procfile: definition and meaning
A Procfile is a text file named Procfile that declares an app’s process types, one per line, as a type name, a colon, and the command that runs it. Heroku defines the format, and local runners such as Foreman read it too.
A Procfile is a text file that lists the processes an app runs, one per line. Each line has a process type, a colon, and the command that starts it. Heroku defines the format, and local runners such as Foreman read the same file.
Format
The file is named Procfile, with a capital P and no extension, and it sits in the root directory of the app. Each line has this shape:
<process type>: <command>A small example:
web: node server.js
worker: node jobs/queue.js
release: node scripts/migrate.jsOn Heroku, web is the only process type that can receive HTTP traffic from the platform’s routers, so a web process has to listen on the port Heroku gives it in the PORT environment variable. The release type is also special: it names a command that Heroku runs in a one-off dyno for a new release, and the app’s dynos do not boot for that release until the command succeeds. Other names, such as worker, have no special meaning and are free labels for background processes.
Using one locally
Outside Heroku, a Procfile is a list of things to start together. Foreman, for example, runs one instance of each process type in the file and interleaves their output on standard output. That makes it a convenient way to describe an app with a web server, a queue worker, and an asset watcher without opening three terminal tabs. A runner may accept a different file name. Foreman takes one with its -f option:
foreman start -f Procfile.devDo not assume a local runner copies all of Heroku’s behaviour. Heroku’s own heroku local command, for instance, does not run the release process type.
A common confusion
A Procfile is a convention, not a standard. Heroku defines the format and the meaning of its special names, and every other tool decides for itself what to accept. Whether the name web matters depends on the tool reading the file. Locally, any process type can be the one that serves requests, whatever it is called.
A Procfile also says only what to run. It does not install dependencies or build assets, and a file called Procfile.dev is invisible to any tool that looks for Procfile.
In Rig
Rig reads a file named exactly Procfile in the project root. Procfile.dev and other names are not read.
- Each line must match
name: command, where the name uses letters, digits, underscores, and hyphens. Rig skips blank lines and lines that start with#. Continuation lines are not supported. - Every process type becomes a script you can pick for the project. Rig marks a process type as recommended when it looks like a server.
- Rig runs the command with
/bin/sh -c, or withcmd.exe /d /s /con Windows. - If the project has a port set, Rig appends
--port Nto the command and exportsPORT,VITE_PORT,HOST_PORT, andnpm_config_port. A command that does not accept--portstill receives it, so check how your command handles the extra argument. - Environment variables come from the project’s active env profile.
Related terms
- Glossary
Process manager
A process manager starts programs, tracks them, captures their output, and decides what happens when they exit: restart, stay stopped, or report the failure.
- Glossary
Sidecar process
A sidecar is a helper that runs beside a main application and supports it. In Kubernetes it is a container in the same Pod.
Sources
- Heroku Dev Center: The Procfile
- Heroku Dev Center: Release Phase
- Heroku Dev Center: Runtime Principles
- Heroku Changelog: Heroku local no longer runs the release process type
- foreman(1): manage Procfile-based applications
- Rig documentation: Procfile projects (parser behaviour confirmed in Rig’s source code)
See how Rig fits in
Rig is a Mac app that starts, stops, and watches the processes in a project from one window. The knowledge base explains each part in plain language.