Skip to content

Commit c57fd46

Browse files
author
Matthew Fisher
committed
docs(using_deis): Process Types and the Procfile
This document explains to users how they can use a Procfile to specify process types for an application.
1 parent 0cc01d3 commit c57fd46

4 files changed

Lines changed: 92 additions & 17 deletions

File tree

docs/using_deis/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Using Deis
1515
install-client
1616
register-user
1717
deploy-application
18+
process-types
1819
using-buildpacks
1920
using-dockerfiles
2021
using-docker-images

docs/using_deis/process-types.rst

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
:title: Process Types and the Procfile
2+
:description: First steps for using the 12 factor process model with Deis.
3+
4+
.. _process-types:
5+
6+
Process Types and the Procfile
7+
==============================
8+
9+
A Procfile is a mechanism for declaring what commands are run by your application’s containers on
10+
the Deis platform. It follows the `process model`_. You can use a Procfile to declare various
11+
process types, such as multiple types of workers, a singleton process like a clock, or a consumer
12+
of the Twitter streaming API.
13+
14+
Process Types as Templates
15+
--------------------------
16+
17+
A Procfile is a text file named ``Procfile`` placed in the root of your application that lists the
18+
process types in an application. Each process type is a declaration of a command that is executed
19+
when a container of that process type is started.
20+
21+
All the language and frameworks using :ref:`Heroku's Buildpacks <using-buildpacks>` declare a
22+
``web`` process type, which starts the application server. Rails 3 has the following process type:
23+
24+
.. code-block:: console
25+
26+
web: bundle exec rails server -p $PORT
27+
28+
All applications using :ref:`Dockerfile deployments <using-dockerfiles>` have an implied ``cmd``
29+
process type, which spawns the default process of a Docker image:
30+
31+
.. code-block:: console
32+
33+
$ cat Dockerfile
34+
FROM centos:latest
35+
COPY . /app
36+
WORKDIR /app
37+
CMD python -m SimpleHTTPServer 5000
38+
EXPOSE 5000
39+
40+
For applications using :ref:`Docker image deployments <using-docker-images>`, a ``cmd`` process
41+
type is also implied and spawns the default process of the image.
42+
43+
Declaring Process Types
44+
-----------------------
45+
46+
Process types are declared via a file named ``Procfile``, placed in the root of your app. Its
47+
format is one process type per line, with each line containing:
48+
49+
.. code-block:: console
50+
51+
<process type>: <command>
52+
53+
The syntax is defined as:
54+
55+
``<process type>`` – an alphanumeric string, is a name for your command, such as web, worker, urgentworker, clock, etc.
56+
57+
``<command>`` – a command line to launch the process, such as ``rake jobs:work``.
58+
59+
.. note::
60+
61+
The web and cmd process types are special as they’re the only process types that will receive
62+
HTTP traffic from Deis’s routers. Other process types can be named arbitrarily.
63+
64+
Deploying to Deis
65+
-----------------
66+
67+
A ``Procfile`` is not necessary to deploy most languages supported by Deis. The platform
68+
automatically detects the language and supplies a default ``web`` process type to boot the server.
69+
70+
Creating an explicit Procfile is recommended for greater control and flexibility over your app.
71+
72+
For Deis to use your Procfile, add the Procfile to the root of your application, then push to Deis:
73+
74+
.. code-block:: console
75+
76+
$ git add .
77+
$ git commit -m "Procfile"
78+
$ git push deis master
79+
...
80+
-----> Procfile declares process types: web, worker
81+
Compiled slug size is 10.4MB
82+
83+
Launching... done, v2
84+
85+
-----> unisex-huntress deployed to Deis
86+
http://unisex-huntress.example.com
87+
88+
For docker image deployments, a Procfile in the current directory or via the ``--procfile`` option
89+
flag will be used as the default process types for the application.
90+
91+
.. _`process model`: https://devcenter.heroku.com/articles/process-model

docs/using_deis/using-docker-images.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ Because you are deploying a Docker image, the ``cmd`` process type is automatica
7272

7373
Support for Docker registry authentication is coming soon
7474

75-
Define Process Types
76-
--------------------
77-
Docker containers have a default command usually specified by a `CMD instruction`_.
78-
Deis uses the ``cmd`` process type to refer to this default command.
79-
80-
Process types other than ``cmd`` are not supported when using Docker images.
81-
8275

8376
.. _`Docker Image`: https://docs.docker.com/introduction/understanding-docker/
8477
.. _`DockerHub`: https://registry.hub.docker.com/

docs/using_deis/using-dockerfiles.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,6 @@ Use ``git push deis master`` to deploy your application.
113113
114114
Because a Dockerfile application is detected, the ``cmd`` process type is automatically scaled to 1 on first deploy.
115115

116-
Define Process Types
117-
--------------------
118-
Docker containers have a default command usually specified by a `CMD instruction`_.
119-
Deis uses the ``cmd`` process type to refer to this default command.
120-
121-
Deis also supports scaling other process types as defined in a `Procfile`_. To use this functionality, you must:
122-
123-
1. Define process types with a `Procfile`_ in the root of your repository
124-
2. Include a ``start`` executable that can be called with: ``start <process-type>``
125-
126116

127117
.. _`Dockerfile`: https://docs.docker.com/reference/builder/
128118
.. _`Docker Image`: https://docs.docker.com/introduction/understanding-docker/

0 commit comments

Comments
 (0)