Skip to content

Commit 845754e

Browse files
committed
doc(process types): Eliminate repition and generally polish
1 parent fdc67fb commit 845754e

1 file changed

Lines changed: 56 additions & 48 deletions

File tree

Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
# Process Types and the Procfile
22

3-
A Procfile is a mechanism for declaring what commands are run by your application’s containers on
4-
the Deis platform. It follows the [process model][]. You can use a Procfile to declare various
5-
process types, such as multiple types of workers, a singleton process like a clock, or a consumer
6-
of the Twitter streaming API.
3+
Deis Workflow observes the [process model][]. As part of this model, a Procfile may be used as a
4+
mechanism for declaring the commands that should be run by your application’s containers. You can
5+
use a Procfile to declare multiple processes for different types of application workers-- for
6+
example, an application server, a job execution timer, or a consumer of the Twitter streaming API.
77

8-
## Process Types as Templates
8+
Multiple process types can be scaled independently of one another.
99

10-
A Procfile is a text file named `Procfile` placed in the root of your application that lists the
11-
process types in an application. Each process type is a declaration of a command that is executed
12-
when a container of that process type is started.
10+
## Default Process Types
1311

14-
All the language and frameworks using [Heroku's Buildpacks](using-buildpacks.md) declare a
15-
`web` process type, which starts the application server. Rails 3 has the following process type:
12+
In the absence of a Procfile, a single, default process type is assumed for each application.
13+
14+
All applications built using [Heroku's Buildpacks][buildpacks] implicitly declare a
15+
`web` process type, which starts the application server. Rails 4, for example, has the following
16+
process type:
1617

1718
web: bundle exec rails server -p $PORT
1819

19-
All applications using [Dockerfile deployments](using-dockerfiles.md) have an implied `cmd`
20-
process type, which spawns the default process of a Docker image:
20+
All applications utilizing [Dockerfile deployments][dockerfile] have an implied `cmd`
21+
process type, which spawns the default process of a Docker image as specified by the
22+
`Dockerfile`'s `CMD` directive:
2123

2224
$ cat Dockerfile
2325
FROM centos:latest
@@ -26,69 +28,75 @@ process type, which spawns the default process of a Docker image:
2628
CMD python -m SimpleHTTPServer 5000
2729
EXPOSE 5000
2830

29-
For applications using [Docker image deployments](using-docker-images.md), a `cmd` process
31+
For applications utilizing [Docker image deployments][docker image], a `cmd` process
3032
type is also implied and spawns the default process of the image.
3133

3234

3335
## Declaring Process Types
3436

35-
Process types are declared via a file named `Procfile`, placed in the root of your app. Its
36-
format is one process type per line, with each line containing:
37+
Developers utilizing [Heroku's Buildpacks][buildpacks] or [Dockerfile deployments][dockerfile] and
38+
wishing to override the implied, default process types, or declare additional process
39+
types may do so by including a file named `Procfile` in the root of their application's source
40+
tree.
41+
42+
Developers utilizing [Docker image deployments][docker image] may accomplish this with a
43+
`Procfile` in their working directory or by referencing a `Procfile` using the `--procfile` option
44+
of the `deis pull` command. For example:
45+
46+
$ deis pull deis/example-go:latest --procfile="cmd: /app/bin/boot"
47+
48+
The format of a `Procfile` is one process type per line, with each line containing:
3749

3850
<process type>: <command>
3951

4052
The syntax is defined as:
4153

42-
`<process type>` – an alphanumeric string, is a name for your command, such as web, worker, urgentworker, clock, etc.
54+
`<process type>` – an alphanumeric string, is a name for your command, such as web, worker,
55+
urgentworker, clock, etc.
4356

4457
`<command>` – a command line to launch the process, such as `rake jobs:work`.
4558

4659
!!! note
47-
The web and cmd process types are special as they’re the only process types that will receive
48-
HTTP traffic from Deis’s routers. Other process types can be named arbitrarily.
60+
The `web` and `cmd` process types are special as they’re the only process types that will
61+
receive HTTP traffic from Workflow’s routers. Other process types can be named arbitrarily.
4962

5063

51-
## Deploying to Deis
64+
## Scaling Processes
5265

53-
A `Procfile` is not necessary to deploy most languages supported by Deis. The platform
54-
automatically detects the language and supplies a default `web` process type to boot the server.
66+
Once an application has been deployed, its process types can be scaled independently of one
67+
another. For example, consider the following `Procfile`:
5568

56-
Creating an explicit Procfile is recommended for greater control and flexibility over your app.
57-
58-
For Deis to use your Procfile, add the Procfile to the root of your application, then push to Deis:
59-
60-
$ git add .
61-
$ git commit -m "Procfile"
62-
$ git push deis master
63-
...
64-
-----> Procfile declares process types: web, worker
65-
Compiled slug size is 10.4MB
69+
web: bundle exec rails server -p $PORT
70+
worker: bundle exec rake resque:work
6671

67-
Launching... done, v2
72+
Given the `Procfile` above, the `web` process could be scaled out:
6873

69-
-----> unisex-huntress deployed to Deis
70-
http://unisex-huntress.example.com
74+
$ deis scale web=5
7175

72-
For Docker image deployments, a Procfile in the current directory or specified by
73-
`deis pull --procfile` will define the default process types for the application.
76+
And the `worker` process could be left alone, or scaled out independently, to whatever extent is
77+
required:
78+
79+
$ deis scale worker=3
7480

75-
Use `deis scale web=3` to increase `web` processes to 3, for example. Scaling a
76-
process type directly changes the number of [Containers][container]
77-
running that process.
81+
Scaling a process type directly changes the number of [Containers][container] running that process.
7882

7983

8084
## Web vs Cmd Process Types
8185

82-
When deploying to Deis using a Heroku Buildpack, Deis boots the `web` process type to boot the
83-
application server. When you deploy an application that has a Dockerfile or uses [Docker
84-
images](using-docker-images.md), Deis boots the `cmd` process type. Both act similarly in that they
85-
are exposed to the router as web applications. However, The `cmd` process type is special because
86-
it is equivalent to running the [container][] without any additional arguments. Every other
87-
process type is equivalent to running the relevant command that is provided in the Procfile.
86+
When deploying to Deis Workflow using a Heroku Buildpack, Workflow boots the `web` process type to
87+
boot the application server. When you deploy an application that has a Dockerfile or uses [Docker
88+
images](using-docker-images.md), Workflow boots the `cmd` process type. Both act similarly in that
89+
they are exposed to the router as web applications. However, the `cmd` process type is special
90+
because, if left undefined, it is equivalent to running the [container][] without any additional
91+
arguments. (i.e. The process specified by the Dockerfile or Docker image's `CMD` directive will
92+
be used.)
8893

89-
When migrating from Heroku Buildpacks to a Docker-based deployment, Deis will not convert `web`
90-
process types to `cmd`. To do this, you'll have to manually scale down the old process type and
91-
scale the new process type up.
94+
If migrating an application from Heroku Buildpacks to a Docker-based deployment, Workflow will not
95+
automatically convert the `web` process type to `cmd`. To do this, you'll have to manually scale
96+
down the old process type and scale the new process type up.
9297

9398
[container]: ../reference-guide/terms.md#container
9499
[process model]: https://devcenter.heroku.com/articles/process-model
100+
[buildpacks]: using-buildpacks.md
101+
[dockerfile]: using-dockerfiles.md
102+
[docker image]: using-docker-images.md

0 commit comments

Comments
 (0)