This guide assumes that you already have:
- a GitHub account and a GitHub repository, typically under the 18F organization
- a CircleCI account (Log In with GitHub)
- a cloud.gov account
1. Getting deployer credentials
Use the instructions on Cloud.gov to create a deployer account for your app. Your deployer credentials will regularly expire, so please make sure to update them periodically.
2. Configure the continuous integration service
Add your cloud.gov deployer service credentials as environment variables to CircleCI. Save them as the CF_USERNAME and CF_PASSWORD.
Cloud.gov (and Cloud Foundry) use manifest files to specify how an app should be built on cloud.gov. You will now add two separate files, a
manifest.yml for your production app and a
manifest-staging.yml for your development application.
Generally your production application will have multiple instances while your staging will only have one. Manifests can be short and sweet, or extensive. For the full cloud foundry documentation on manifests see here: https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#minimal-manifest.
Zero Downtime Deploy Options
v3-zdt-pushis an official command, yet is in active development. See https://docs.cloudfoundry.org/devguide/deploy-apps/rolling-deploy.html
zero-downtime-pushis the popular Autopilot plugin used by a lot of 18F projects and used in both of the above examples. It is now unmaintained and archived though. Does not support buildpacks. If your application successfully deploys to cloud.gov but does not start, which may happen for an application that does not have an adequate test suite, you may have to go into the cf target space and manually delete the “APP_NAME-venerable” application in order to make use of
blue-green-deployanother plugin similar to autopilot. https://github.com/bluemixgaragelondon/cf-blue-green-deploy
- An official CircleCI / Cloud Foundry Orb is also available at https://circleci.com/orbs/registry/orb/circleci/cloudfoundry