A Procfile
is used to orchestrate your application, especially if you have multiple components that make up your application and work in tandem. The file is structured in the following format:
<process type>: <command>
(The brackets are not included.)
The available process types are:
web
: the process that can receive traffic on a portinit
: runs before the web process is startedworker
: continuously running, does not receive traffic on a portweb
process, so you often don’t need a
Procfile
at all.If your app needs command-line arguments to start, you can put those into the Procfile:
web: your-app-on-runway server --some-argument=123
All of the processes share the same image (that is build by Runway’s builder) and configuration supplied via runway app config set
, but they run in independent environments and cannot share local memory.
The process type worker
can access the web
process via HTTP on the loopback interface and the port on which the web
process listens. So for example, your Golang application without a custom port can be reached via this from the worker
process:
curl http://localhost:5000
In addition, you can access the environment of web
and worker
via:
runway app exec -p <process-type> sh
Build your application either by utilizing a CLI library (as outlined in the guide to faster builds) or following the cmd
pattern (outlined in the monorepo guide).
Add a Procfile
to your application and configure the process types appropriately:
web: your-app-on-runway -daemon
worker: your-app-on-runway -worker
Individual binaries (cmd/server
, cmd/worker
) work like this:
web: server
worker: worker
runway app config set BP_GO_TARGETS=./cmd/server:./cmd/worker
[build]
[[build.env]]
name = "BP_GO_TARGETS"
value = "./cmd/server:./cmd/worker"