This document contains IaaS-specific notes and instructions for using cf-deployment
with GCP. See the main README for more general information about cf-deployment
.
- You'll need to make sure your GCP quotas are large enough. You can request a quota increase and ask for the following increases:
- 100 CPUs
- 50 In-use IP addresses
- Clone the cf-deployment repository
git clone [email protected]:cloudfoundry/cf-deployment.git
-
Terraform environment: https://github.com/cloudfoundry-incubator/cf-gcp-infrastructure/blob/master/README.md
-
Update DNS in Route 53 to contain the name servers made by terraform
-
Generate ssh key for director manifest and add to GCP
ssh-keygen -t rsa -f /PATH/TO/DIRECTOR/SSH_KEY -C vcap -N ""
paste -d: <(echo vcap) /PATH/TO/DIRECTOR/SSH_KEY.pub > /PATH/TO/DIRECTOR/SSH_KEY.gcp_pub
gcloud auth activate-service-account --key-file /PATH/TO/GOOGLE_AUTH_JSON
gcloud config set project PROJECT_ID
gcloud config set compute/region REGION
gcloud config set compute/zone ZONE
gcloud compute project-info add-metadata --metadata-from-file sshKeys=/PATH/TO/DIRECTOR/SSH_KEY.gcp_pub
- Generate director certificate
cf-gcp-infrastructure/deployments/generate-certs.sh director DIRECTOR_IP bosh.ENV_NAME.cf-app.com /TARGET_DIRECTORY/FOR/CERTS
- Generate Bosh deployment var file containing the following keys:
project: PROJECT_ID
zone: ZONE
env_name: ENV_NAME
director_ip: DIRECTOR_IP
nats_password: SOME_PASSWORD
postgres_password: SOME_PASSWORD
blobstore_director_password: SOME_PASSWORD
blobstore_agent_password: SOME_PASSWORD
hm_password: SOME_PASSWORD
mbus_password: SOME_PASSWORD
director_cert: contents of /TARGET_DIRECTORY/FOR/CERTS/director.crt
director_key: contents of /TARGET_DIRECTORY/FOR/CERTS/director.key
google_cpi_json_key: stringified GOOGLE_AUTH_JSON content
director_username: BOSH_USERNAME
director_password: BOSH_PASSWORD
director_ssh_key_path: /PATH/TO/DIRECTOR/SSH_KEY
- Deploy bosh. NB: You need the new BOSH CLI to run
create-env
.
bosh interpolate -l DEPLOYMENT_VAR_FILE --var-errs cf-gcp-infrastructure/bosh/bosh.yml > /dev/null
bosh create-env --var-file DEPLOYMENT_VAR_FILE cf-gcp-infrastructure/bosh/bosh.yml
- Save the
bosh-state.json
file now located atcf-gcp-infrastructure/bosh/bosh-state.json
- Upload cloud config
export BOSH_USER=BOSH_USERNAME
export BOSH_PASSWORD=BOSH_PASSWORD
export BOSH_ENVIRONMENT=DIRECTOR_IP
export BOSH_CA_CERT=/TARGET_DIRECTORY/FOR/CERTS/rootCA.pem
bosh log-in
bosh -n update-cloud-config \
--var-file=DEPLOYMENT_VAR_FILE \
cf-gcp-infrastructure/deployments/cloud-config.yml
- Upload the current stemcell for
cf
by running the command below with the appropriate version number. The version number is specified on the last line ofcf-deployment.yml
.
bosh upload stemcell https://bosh.io/d/stemcells/bosh-google-kvm-ubuntu-trusty-go_agent?v=VERSION
- Use instructions in the main README from cf-deployment to generate a vars file if you don't already have one.
- Check that you can generate a final manifest without errors
bosh -n interpolate -l CF_DEPLOYMENT_VARS_FILE -o manifest/gcp.yml --var-errs manifest/cf-deployment.yml
- Deploy!
bosh \
-n \
-d "cf" \
deploy \
-l CF_DEPLOYMENT_VARS_FILE \
-o manifest/gcp.yml \
"manifest/cf-deployment.yml"