-
Notifications
You must be signed in to change notification settings - Fork 122
/
how-applications-are-staged.html.md.erb
132 lines (92 loc) · 6.61 KB
/
how-applications-are-staged.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
---
title: Staging your apps in Cloud Foundry
owner:
- Diego
- CAPI
---
This topic tells you how Diego stages buildpack apps and Docker images
in <%= vars.app_runtime_first %>.
<%= vars.app_runtime_abbr %> uses Diego to manage app containers. It is a self-healing system that attempts to keep the correct number of instances running in Diego Cells to avoid network failures and crashes. For more information about Diego, see [Diego Components and Architecture](../concepts/diego/diego-architecture.html).
Learn about tasks and long-running processes (LRPs).
For more information about these, see the [Tasks and Long-Running Processes](diego/diego-auction.html#processes) section of the _How Diego Balances App Processes_ topic.
To better understand the flow and caching of source bits during staging, see the [How Staging Uses the Blobstore](../concepts/cc-blobstore.html#stage-blobstore) section of the _Cloud Controller blobstore_ topic.
## <a id='stage-buildpack'></a> How Diego stages buildpack apps
Learn how Diego stages buildpack apps.
The following diagram illustrates the steps and components involved in the process of staging a buildpack app.
The staging process for buildpack apps includes a developer and the following components: CF Command Line, Cloud Controller (CCNG), CCNG Blobstore, CCDB, Diego Cell (Staging), and Diego Cell (Running).\
* Step 1: cf push from Developer to CF Command Line.
* Step 2: Create App from CF Command Line to Cloud Controller (CCNG).
* Step 3: Stores App Metadata from CCNG to the CCDB.
* Step 4: Upload App Files from the CF Command Line to CCNG.
* Step 5: Store App Files from CCNG to CCNG Blobstore.
* Step 6: App Start from CF Command Line to CCNG.
* Step 7: Stage App from CCNG to Diego Cell (Staging).
* Step 8: Stream Staging Output from Diego Cell (Staging) to the Developer.
* Step 9: Store App Droplet from Diego Cell (Staging) to CCNG Blobstore.
* Step 10: Report Staging Complete from Diego Cell (Staging) to CCNG.
* Step 11: Start Staged App from CCNG to Diego Cell (Running).
* Step 12: Report App Status from Diego Cell (Running) to CCNG.
![Full description of this diagram is in the text.](./images/app_push_flow_diagram_diego.png)
[//]: https://docs.google.com/drawings/d/1F4vIuCLCtl4hwhMZbeDNcSGImSpaTXFnul4-xpgXOgs/edit?usp=sharing
The following steps describe the process of staging a buildpack app:
1. A developer runs `cf push`.
2. Cloud Foundry Command Line Interface (cf CLI) tells the Cloud Controller to create a record for the app. For more information about the Cloud Controller, see [Cloud Controller](../concepts/architecture/cloud-controller.html).
3. Cloud Controller stores the app metadata. App metadata can include the app name, number of instances, buildpack, and other information about the app.
4. This step includes:
<ol type="a">
<li> The cf CLI requests a resource match from the Cloud Controller.</li>
<li> The cf CLI uploads the app source files, omitting any app files that already exist in the resource cache. </li>
<li> The Cloud Controller combines the uploaded app files with files from the resource cache to create the app package.</li>
</ol>
5. Cloud Controller stores the app package in the blobstore. For more information, see the [Blobstore](../concepts/architecture/index.html#blob) section of the _<%= vars.app_runtime_abbr %> Components_ topic.
6. The cf CLI issues a request to start the app.
7. This step includes:
<ol type="a">
<li>The Cloud Controller issues a staging request to Diego.</li>
<li>Diego schedules a Diego Cell to run the staging task.</li>
<li>The task downloads buildpacks and the app buildpack cache, if present.</li>
<li>The task uses the buildpack to compile and stage the app.</li>
</ol>
8. Diego Cell streams the output of the staging process. You might need to view the output to troubleshoot staging problems.
9. This step includes:
<ol type="a">
<li>The task creates a tarball, or droplet, with the compiled and staged app.</li>
<li>The Diego Cell stores the droplet in the blobstore.</li>
<li>The task uploads the buildpack cache to the blobstore for use the next time the app is staged.</li>
</ol>
10. Diego Bulletin Board System (BBS) reports to the Cloud Controller that staging is complete. If staging does not complete within 15 minutes, it fails.
11. Diego schedules the app as a LRP on one or more Diego Cells.
12. Diego Cells report the status of the app to the Cloud Controller.
## <a id='stage-docker'></a> How Diego stages Docker images
This section describes how Diego stages Docker images.
The following diagram illustrates the steps and components involved in the process of staging a Docker image.
The staging process for Docker images includes a developer and the following components: CF Command Line, Cloud Controller (CCNG), CCDB, Diego Cell (Staging), and Diego Cell (Running).
* Step 1: CF Push from Developer to CF Command Line.
* Step 2: Create Record from CF Command Line to CCNG.
* Step 3: Stage Image from CCNG to CCDB.
* Step 4: Stream Staging Output from Diego Cell (Staging) to Developer.
* Step 5: Fetch Metadata from Diego Cell (Staging) to CCNG.
* Step 6: Store Metadata from CCNG to CCDB.
* Step 7: Submit LRP an Run Start Command from CCNG to Diego Cell (Running).
![Full description of this diagram is in the text.](./images/docker_push_flow_diagram_diego.png)
[//]: https://docs.google.com/drawings/d/1ckWGbgTWhyc3LxP4QcVD1IgwnHu1w2XNvT28-r51Z3M/edit?usp=sharing
The following describe each step in the process of staging a Docker image:
1. A developer runs `cf push` and includes the name of a Docker image in an accessible Docker Registry.
1. The cf CLI tells the Cloud Controller to create a record for the Docker image.
1. This step includes:
<ol type="a">
<li> The Cloud Controller issues a staging request to Diego.</li>
<li> Diego schedules a Diego Cell to run the task.</li>
</ol>
1. Diego Cell streams the output of the staging process. You might need to view the output to troubleshoot staging problems.
1. The task fetches the metadata associated with the Docker image and returns a portion of it to the Cloud Controller.
1. Cloud Controller stores the metadata in the Cloud Controller database.
1. This step includes:
<ol type="a">
<li> Cloud Controller uses the Docker image metadata to construct a LRP that runs the start command specified in the Dockerfile.</li>
<li> Cloud Controller submits the LRP to Diego.</li>
<li> Diego schedules the LRP on one or more Diego Cells.</li>
<li> Cloud Controller instructs Diego and the Gorouter to route traffic to the Docker image.</li>
</ol>
<p> Cloud Controller takes into account any user-specified overrides specified in the Dockerfile, such as
environment variables.</p>