-
Notifications
You must be signed in to change notification settings - Fork 217
/
multiple-processes.html.md.erb
127 lines (90 loc) · 4.58 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
---
title: Pushing an app with multiple processes
owner: CAPI
---
The Cloud Foundry API (CAPI) V3 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. You can push an app with multiple processes using either a manifest or a Procfile.
For more information about processes, see the [CAPI V3 documentation](http://v3-apidocs.cloudfoundry.org/index.html#processes).
## <a id='manifest'></a> Push an app with multiple processes using a manifest
To push an app with multiple processes using a manifest:
1. Create a file in YAML format that defines a manifest. Include each process with its start command.
This example manifest file defines the app `example-app` with two processes:
```yaml
version: 1
- name: example-app
processes:
- type: web
command: bundle exec rackup config.ru -p $PORT
instances: 3
- type: worker
command: bundle exec rake worker:start
health-check-type: process
instances: 2
```
1. Push the app with your manifest by running:
```console
cf push -f MANIFEST.yml
```
Where `MANIFEST` is the filename of your manifest file.
For more information about defining processes with manifests, see [processes](deploy-apps/manifest-attributes.html#processes) in _App Manifest Attribute Reference_.
## <a id='procfile'></a>Push an app with multiple processes using a Procfile
Procfile support varies depending on the buildpack you use. For example, the Staticfile buildpack requires a Staticfile instead of a Procfile. For more information, see <a href="../buildpacks/staticfile/index.html">Staticfile Buildpack</a>
To push an app with multiple processes using a Procfile:
1. Create a file named `Procfile` in the root of your app directory. For more information about Procfiles, see the
<a href="https://v3-apidocs.cloudfoundry.org/index.html#procfiles">CAPI V3 documentation</a>.
2. Add each process and its start command to the Procfile. For example:
```
web: bundle exec rackup config.ru -p $PORT
worker: bundle exec rake worker:start
```
3. Push the app by running:
```
cf push APP-NAME
```
Where `APP-NAME` is the name of your app.
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:
1. Run:
```
cf scale APP-NAME --process PROCESS-NAME -i INSTANCE-COUNT
```
Where:
<ul>
<li><code>APP-NAME</code> is the name of your app.</li>
<li><code>PROCESS-NAME</code> is the name of the process you want to scale.</li>
<li><code>INSTANCE-COUNT</code> is the number of instances to which you want to scale the process.</li>
</ul>
## <a id='view-processes'></a> View processes
To view the processes running as part of an app:
1. Run:
```console
cf app APP-NAME
```
Where `APP-NAME` is the name of your app.
The following example shows return output for an app that has a `web` and a `worker` process:
<pre class="terminal">
Showing health and status for app example-app in org test / space test as admin...
name: example-app
requested state: started
routes: example-app.cloudfoundry.example.com
last uploaded: Wed 17 Jul 22:57:04 UTC 2024
stack: cflinuxfs3
buildpacks:
name version detect output buildpack name
ruby_buildpack 1.8.57 ruby ruby
type: web
sidecars:
instances: 1/1
memory usage: 1024M
state since cpu memory disk logging cpu entitlement details
#0 running 2024-07-17T22:57:22Z 0.3% 49.5M of 1G 130.2M of 1G 0B/s of 16K/s 2.4%
type: worker
sidecars:
instances: 2/2
memory usage: 1024M
state since cpu memory disk logging cpu entitlement details
#0 running 2024-07-17T22:57:22Z 0.3% 49.5M of 1G 130.2M of 1G 0B/s of 16K/s 2.4%
#0 running 2024-07-17T22:57:22Z 0.3% 49.5M of 1G 130.2M of 1G 0B/s of 16K/s 2.4%
</pre>
<p class="note important">
To avoid security exposure, ensure that you migrated your apps and custom buildpacks to use the <code>cflinuxfs4</code> stack based on Ubuntu 22.04 LTS (Jammy Jellyfish). The <code>cflinuxfs3</code> stack is based on Ubuntu 18.04 (Bionic Beaver), which reaches end of standard support in April 2023. </p>