This guide describes how to deploy a minimal Cloud Foundry on Google Compute Engine using BOSH. The BOSH director must have been created following the steps in the Deploy BOSH on Google Cloud Platform guide.
- You must have an existing BOSH director and bastion host created by following the Deploy BOSH on Google Cloud Platform guide.
- This CF deployment (and the BOSH director/bastion pre-requisite) is small enough to fit in a default project Resource Quota. It consumes:
- 20 cores in a single region
- 24 pre-emptible cores in a second region during compilation only
- 2 IP addresses
- 600 Gb persistent disk
You can view an estimate of the cost to run this deployment for an entire month at this link.
The following instructions use Terraform to provision all of the infrastructure required to run CloudFoundry.
- SSH to the
bosh-bastion
VM. You can SSH form Cloud Shell or any workstation that hasgcloud
installed:
gcloud compute ssh bosh-bastion
cd
into the Cloud Foundry docs directory that you cloned when you created the BOSH bastion:
cd /share/docs/cloudfoundry
- Export a few vars to specify the location of compilation VMs:
# You may be tempted to set these to the same value as your BOSH deployment (eg `us-east1`).
# However, this may cause you to exceed your regional quotas.
# By breaking apart the regions, you avoid this problem.
export region_compilation=us-central1
export zone_compilation=us-central1-b
- View the Terraform execution plan to see the resources that will be created:
terraform plan \
-var network=${network} \
-var projectid=${project_id} \
-var region=${region} \
-var region_compilation=${region_compilation} \
-var zone=${zone} \
-var zone_compilation=${zone_compilation}
- Create the resources:
terraform apply \
-var network=${network} \
-var projectid=${project_id} \
-var region=${region} \
-var region_compilation=${region_compilation} \
-var zone=${zone} \
-var zone_compilation=${zone_compilation}
- Create a service account and key that will be used by Cloud Foundry VMs:
gcloud iam service-accounts create cf-component
- Grant the new service account editor access and logging access to your project:
gcloud projects add-iam-policy-binding ${project_id} \
--member serviceAccount:cf-component@${project_id}.iam.gserviceaccount.com \
--role "roles/editor" \
--role "roles/logging.logWriter" \
--role "roles/logging.configWriter"
- Target and login into your BOSH environment:
bosh target 10.0.0.6
Note: Your username is
admin
and password isadmin
.
- Retrieve the outputs of your Terraform run to be used in your Cloud Foundry deployment:
export vip=$(terraform output ip)
export zone=$(terraform output zone)
export zone_compilation=$(terraform output zone_compilation)
export region=$(terraform output region)
export region_compilation=$(terraform output region_compilation)
export private_subnet=$(terraform output private_subnet)
export compilation_subnet=$(terraform output compilation_subnet)
export network=$(terraform output network)
export director=$(bosh status --uuid)
- Upload the stemcell:
bosh upload stemcell https://bosh.io/d/stemcells/bosh-google-kvm-ubuntu-trusty-go_agent?v=3263.7
- Upload the required BOSH Releases:
bosh upload release https://bosh.io/d/github.com/cloudfoundry/cf-mysql-release?v=23
bosh upload release https://bosh.io/d/github.com/cloudfoundry-incubator/garden-linux-release?v=0.340.0
bosh upload release https://bosh.io/d/github.com/cloudfoundry-incubator/etcd-release?v=36
bosh upload release https://bosh.io/d/github.com/cloudfoundry-incubator/diego-release?v=0.1454.0
bosh upload release https://bosh.io/d/github.com/cloudfoundry/cf-release?v=231
- Target the deployment file and deploy:
bosh deployment manifest.yml
bosh deploy
Once deployed, you can target your Cloud Foundry environment using the CF CLI:
cf api https://api.${vip}.xip.io --skip-ssl-validation
cf login
Your username is admin
and your password is c1oudc0w
.
From your bosh-bastion
instance, delete your Cloud Foundry deployment:
bosh delete deployment cf
Then delete the infrastructure you created with terraform:
cd /share/docs/cloudfoundry
terraform destroy \
-var projectid=${project_id} \
-var region=${region} \
-var zone=${zone} \
-var network=${network}
Important: The BOSH bastion and director you created must also be destroyed. Follow the Delete resources instructions in the Deploy BOSH on Google Cloud Platform guide.