An official website of the United States government US flag signifying that this is a United States federal government website

Cloning applications

Cloning applications

Say you have an existing deployment on Cloud Foundry, and you want to make a new staging environment. Below are the different scenarios around application manifests.

If you have a single manifest

  1. Run cf push <NEW_APP_NAME>.
  2. Use the CLI to do any other necessary configuration.

If you have environment-specific manifests

  1. Use manifest inheritance to do any necessary configuration.
  2. Run cf push <NEW_APP_NAME> -f <PATH_TO_MANIFEST>.
  3. Make sure to run any necessary database setup commands, etc.

If you don’t have a manifest

  1. Generate a manifest from an existing application:

    cf target -o <EXISTING_APP_ORG> -s <EXISTING_APP_SPACE>
    cf create-app-manifest <EXISTING_APP_NAME>
    cp <EXISTING_APP_NAME>_manifest.yml <NEW_APP_NAME>_manifest.yml
    
  2. Clean up <NEW_APP_NAME>_manifest.yml. You probably only need the following properties:

    • name (required) – make sure to change it to the new app name
    • env – change any environment-specific variables, e.g. the DATABASE_URL
    • services
  3. Deploy the new environment:

    cf push <NEW_APP_NAME> -f <NEW_APP_NAME>_manifest.yml
    
  4. Make sure to run any necessary database setup commands, etc. for the new application.