forked from cloudfoundry/docs-dev-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
push-sub-commands.html.md.erb
297 lines (231 loc) · 9.28 KB
/
push-sub-commands.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
---
title: Running cf push sub-step commands
owner: CAPI
---
The Cloud Foundry Command Line Interface (cf CLI) includes commands that provide detailed control over app pushes. When you use these commands, you can follow only some steps of the `cf push` procedure or you can perform specific actions between the steps that are normally part of running `cf push`.
Here are some example use cases for the sub-step commands:
* Updating a third-party system before staging an app
* Retrying failed stagings without incurring downtime
* Calling external services to report audit data during push
* Scanning a droplet before deploy
* Integrating with a change request system
To support these custom push workflows, Cloud Foundry divides apps into smaller building blocks.
The following table describes the building blocks as resources and lists the command associated with each one.
For information about using these commands, see [Example workflows](#example-workflows).
<p class="note important">
<span class="note__title"><strong>Important</strong></span>
The cf CLI v6 commands described in this topic are experimental and unsupported, but are supported in cf CLI v7. The latest supported cf CLI release is cf CLI v8. To upgrade to cf CLI v7, see <a href="https://docs.cloudfoundry.org/cf-cli/v7.html">Upgrading to cf CLI v7</a>. To upgrade to cf CLI v8, see <a href="https://docs.cloudfoundry.org/cf-cli/v8.html">Upgrading to cf CLI v8</a>.</p>
<table>
<tr>
<th>Resource</th>
<th>Description</th>
<th style="width: 30%">Command</th>
</tr>
<tr>
<td>App</td>
<td>The top-level resource that represents an app and its configuration.<br>
For more information, see <a href="https://v3-apidocs.cloudfoundry.org/index.html#apps">Apps</a> in the CAPI documentation.</td>
<td>
<ul>
<li><strong>cf CLI v6:</strong> <br><code>cf v3-create-app</code></li>
<li><strong>cf CLI v7:</strong> <br><code>cf create-app</code></li>
</ul>
</td>
</tr>
<tr>
<td>Package</td>
<td>The source code that makes up an app.<br>
For more information, see <a href="https://v3-apidocs.cloudfoundry.org/index.html#packages">Packages</a> in the CAPI documentation.</td>
<td>
<ul>
<li><strong>cf CLI v6:</strong> <br><code>cf v3-create-package</code></li>
<li><strong>cf CLI v7:</strong> <br><code>cf create-package</code></li>
</ul>
</td>
</tr>
<tr>
<td>Build</td>
<td>Staging the app. Creating a build combines a Package with a Buildpack and builds it into an executable resource.<br>
For more information, see <a href="https://v3-apidocs.cloudfoundry.org/index.html#builds">Builds</a> in the CAPI documentation.</td>
<td>
<ul>
<li><strong>cf CLI v6:</strong> <br><code>cf v3-stage</code></li>
<li><strong>cf CLI v7:</strong> <br><code>cf stage-package</code></li>
</ul>
</td>
</tr>
<tr>
<td>Droplet</td>
<td>An executable resource that results from a Build.<br>
For more information, see <a href="https://v3-apidocs.cloudfoundry.org/index.html#droplets">Droplet</a> in the CAPI documentation.</td>
<td>
<ul>
<li><strong>cf CLI v6:</strong> <br><code>cf v3-set-droplet</code></li>
<li><strong>cf CLI v7:</strong> <br><code>cf set-droplet</code></li>
</ul>
</td>
</tr>
<tr>
<td>Manifest</td>
<td>A file used when pushing your app to apply bulk configuration to an app and its underlying processes.<br>
For more information, see <a href="https://v3-apidocs.cloudfoundry.org/index.html#space-manifest"> Space Manifest</a> in the CAPI documentation.</td>
<td>
<ul>
<li><strong>cf CLI v6:</strong> <br><code>cf v3-apply-manifest</code></li>
<li><strong>cf CLI v7:</strong> <br><code>cf create-app-manifest</code>, <code>cf apply-manifest</code></li>
</ul>
</td>
</tr>
</table>
## <a id="example-workflows"></a> Example workflows
The following sections describe example workflows for working with the `cf push` sub-step commands.
### <a id="update-system"></a> Push an app using sub-step commands
This example workflow describes how to push an app using sub-step commands instead of `cf push`.
1. Create your app with cf CLI:
* If you are using cf CLI v7, run:
```
cf create-app APP-NAME
```
Where `APP-NAME` is the name you give your app.
* If you are using cf CLI v6, run:
```
cf v3-create-app APP-NAME
```
Where `APP-NAME` is the name you give your app.
1. From your app directory, create a package for your app.
* If you are using cf CLI v7, run:
```
cf create-package APP-NAME
```
Where `APP-NAME` is the name of your app.
* If you are using cf CLI v6, run:
```
cf v3-create-package APP-NAME
```
Where `APP-NAME` is the name of your app.
1. Locate and copy the `package guid` from the output of an earlier step. See the following example output:
<pre class="terminal">
Uploading and creating bits package for app APP-NAME in org test / space test as admin...
package guid: 0dfca85a-8ed4-4f00-90d0-3ab08852dba8
OK
</pre>
2. Stage the package you created:
* If you are using cf CLI v7, run:
```
cf stage-package APP-NAME --package-guid PACKAGE-GUID
```
Where:
<ul>
<li><code>APP-NAME</code> is the name of your app.</li>
<li><code>PACKAGE-GUID</code> is the package GUID you recorded in an earlier step.</li>
</ul>
* If you are using cf CLI v6, run:
```
cf v3-stage APP-NAME --package-guid PACKAGE-GUID
```
Where:
<ul>
<li><code>APP-NAME</code> is the name of your app.</li>
<li><code>PACKAGE-GUID</code> is the package GUID you recorded in an earlier step.</li>
</ul>
3. Locate and copy the `droplet guid` from the output of an earlier step. See the following example output:
<pre class="terminal">
Staging package for APP-NAME in org test / space test as admin...
...
Package staged
droplet guid: f60d3464-415a-4202-9d40-26a70373a487
state: staged
created: Mon 25 Sep 16:37:45 PDT 2018
</pre>
4. Assign the droplet to your app:
* If you are using cf CLI v7, run:
```
cf set-droplet APP-NAME -d DROPLET-GUID
```
Where:
<ul>
<li><code>APP-NAME</code> is the name of your app.</li>
<li><code>DROPLET-GUID</code> is the droplet GUID you recorded in an earlier step.</li>
</ul>
* If you are using cf CLI v6, run:
```
cf v3-set-droplet APP-NAME -d DROPLET-GUID
```
Where:
<ul>
<li><code>APP-NAME</code> is the name of your app.</li>
<li><code>DROPLET-GUID</code> is the droplet GUID you recorded in an earlier step.</li>
</ul>
5. Start your app:
* If you are using cf CLI v7, run:
```
cf start APP-NAME
```
Where `APP-NAME` is the name of your app.
* If you are using cf CLI v6, run:
```
cf v3-start APP-NAME
```
Where `APP-NAME` is the name of your app.
### <a id="update-system-example"></a> Roll back to a previous droplet
This example workflow describes how to roll back to a previous droplet used by your app. You might want to use this, for example, if you update your app and it has a bug that causes it to fail.
1. List the droplets for your app:
* If you are using cf CLI v7, run:
```
cf droplets APP-NAME
```
Where `APP-NAME` is the name of your app.
* If you are using cf CLI v6, run:
```
cf v3-droplets APP-NAME
```
Where `APP-NAME` is the name of your app.
1. In the output, locate and copy the second-to-last GUID.
In the following example, this is `66524145-5502-40e6-b782-47fe68e13c49`.
<pre class="terminal">
Listing droplets of app APP-NAME in org test / space test as admin...
guid state created
66524145-5502-40e6-b782-47fe68e13c49 staged Mon 25 Sep 16:37:34 PDT 2018
0677ad93-9f77-4aaa-9a6b-44da022dcd58 staged Mon 25 Sep 16:44:55 PDT 2018
</pre>
2. Stop your app:
* If you are using cf CLI v7, run:
```
cf stop APP-NAME
```
Where `APP-NAME` is the name of your app.
* If you are using cf CLI v6, run:
```
cf v3-stop APP-NAME
```
Where `APP-NAME` is the name of your app.
3. Set the app to use the previous droplet:
* If you are using cf CLI v7, run:
```
cf set-droplet APP-NAME -d PREVIOUS-DROPLET-GUID
```
Where:
<ul>
<li><code>APP-NAME</code> is the name of your app.</li>
<li><code>PREVIOUS-DROPLET-GUID</code> is the droplet GUID you recorded in an earlier step.</li>
</ul>
* If you are using cf CLI v6, run:
```
cf v3-set-droplet APP-NAME -d PREVIOUS-DROPLET-GUID
```
Where:
<ul>
<li><code>APP-NAME</code> is the name of your app.</li>
<li><code>PREVIOUS-DROPLET-GUID</code> is the droplet GUID you recorded in an earlier step.</li>
</ul>
4. Start your app:
* If you are using cf CLI v7, run:
```
cf start APP-NAME
```
Where `APP-NAME` is the name of your app.
* If you are using cf CLI v6, run:
```
cf v3-start APP-NAME
```
Where `APP-NAME` is the name of your app.