Joe E
Joe E

Reputation: 21

Staging in Cloud Foundry

Can someone explain staging in cloud foundry. I have some high level knowledge on this. That CC sends request via cc bridge to diego brain, etc..does staging happens inside a container created temporarily for this purpose ? Are the buildpacks and app files downloaded to containier to create the droplet ?

Upvotes: 0

Views: 1783

Answers (1)

ams
ams

Reputation: 62652

In order for Cloud Foundry to run a container with an app in it has to have a droplet created. A droplet is a tar.gz file. There are two ways to create the droplet.

  • Outside of Cloud Foundry
  • Inside of Cloud Foundry

To create a the droplet outside of cloud foundry you write a script to produce to .tar.gz that follows the cf conventions then you use cf push --droplet mydroplet.tgz to upload a droplet directly to cf and then you can start it and run apps with it. This is very uncommon you should not be doing this.

To create a the droplet inside cloud foundry you execute a cf push without specifying a droplet. This tells cf that you want it to create the droplet. The process of cf creating a droplet is called staging. Here is what happens during the staging process.

  • cf will create a container to run the staging in
  • cf will make sure that the cell VM that is executing the staging container has a cached copy of every buildpack installed into cf
  • cf will download the application bits into the staging container
  • cf will start with first build pack execute the bin/detect script of buildpack
  • if the bin/detect script return 0 then build pack knows how to run. if it returns 1 then the buildpack is skipped and cf tries the next build pack
  • Once a matching buildpack is found then the build pack executes and creates the droplet .tar.gz file
  • cf uploads the droplet into it's blob store
  • cf staging container is destroyed
  • staging process is complete

Once a droplet is created and stored in the cf blob store cf can start launching containers based on the blob. I recommend you read through the cf docs on bulidpacks at https://docs.cloudfoundry.org/buildpacks/understand-buildpacks.html

Also once an app is running you can do cf ssh to get into a running container produced by a buildpack through the staging process and look around at the file system layout.

Upvotes: 1

Related Questions