forked from cloudfoundry/docs-dev-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultiple-processes.html.md.erb
98 lines (71 loc) · 3.61 KB
/
multiple-processes.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
title: Pushing an App with Multiple Processes (Beta)
owner: CAPI
---
This topic describes how to push and manage apps with multiple processes.
<p class="note"><strong>Note</strong>: This is a beta feature. Because the CLI may change, this feature is not recommended for use in scripts until it is generally available.</p>
<div class="note">
<strong>Note:</strong>
This topic includes references to cf CLI v7 beta commands. Consider the following when using these commands:
<ul>
<li> cf CLI v7 beta and CAPI v3 are both in active development and subject to change. </li>
<li> cf CLI v7 beta is developed and tested against the latest CAPI release candidate. </li>
<li> cf CLI v7 beta does not yet use CAPI v3 for all commands. Some commands still use CAPI v2 during beta. </li>
</ul>
For more information, see <a href="../../cf-cli/v7.html">Upgrading to cf CLI v7 (Beta)</a>.
</div>
## <a id="about-processes"></a> About Processes
The CAPI v3 API supports using a single command to push apps that run multiple processes, such as a web app that has a UI process and a worker process. To push an app that creates multiple processes from the same codebase, you first define its processes in a Procfile. See [Push an App with Multiple Processes](#push-with-multiple-processes).
For more information about processes, see the <a href="http://v3-apidocs.cloudfoundry.org/index.html#processes">Processes</a> section of the CAPI v3 documentation.
## <a id="push-with-multiple-processes"></a> Push an App with Multiple Processes
You can push an app with multiple processes using a Procfile.
Follow the procedure below.
<p class="note"><strong>Note</strong>: You can also push and app with multiple processes using an app manifest. See [The app manifest specification](https://v3-apidocs.cloudfoundry.org/index.html#the-app-manifest-specification) in the CAPI v3 docs.</p>
1. Create a file named `Procfile` in the root of your app directory.
<p class="note"><strong>Note</strong> For more information about Procfiles, see the <a href="https://v3-apidocs.cloudfoundry.org/index.html#procfiles">Procfiles</a> section of the CAPI v3 documentation.</p>
1. Add each process and its start command to the Procfile. See the following example:
```
web: bundle exec rackup config.ru -p $PORT
worker: bundle exec rake worker:start
```
1. Push the app:
* **cf CLI v7**:
```
cf7 push myapp
```
* **cf CLI v6**:
```
cf v3-push myapp
```
By default, the web process has a route and one instance. Other processes have zero instances by default.
## <a id="scale-a-process"></a>Scale a Process
To scale an app process, run the following command:
* **cf CLI v7**:
```
cf7 scale APP-NAME --process PROCESS-NAME -i INSTANCE-COUNT
```
* **cf CLI v6**:
```
cf v3-scale APP-NAME --process PROCESS-NAME -i INSTANCE-COUNT
```
## <a id="view-processes"></a>View Processes
To view the processes running as part of an app, run `cf APP-NAME`. See the following example in which the app has a `web` and a `worker` process.
<p class="note"><strong>Note</strong>: In cf CLI v7, the <code>v3-prefix</code> is not required.</p>
```
$ cf v3-app myapp
Showing health and status for app myapp in org test / space test as admin...
name: myapp
requested state: started
processes: web:1/1, worker:2/2
memory usage: 256M x 1, 256M x 2
routes: myapp.cloudfoundry.example.com
stack: cflinuxfs3
buildpacks: ruby
web:1/1
state since cpu memory disk
#0 running 2017-09-25 15:43:26 PM 0.2% 18.9M of 256M 84.4M of 1G
worker:2/2
state since cpu memory disk
#0 running 2017-09-25 15:49:46 PM 0.1% 5M of 256M 73M of 1G
#1 running 2017-09-25 15:49:46 PM 0.1% 5M of 256M 73M of 1G
```