Cloning applications
Table of Contents
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
- Run
cf push <NEW_APP_NAME>
. - Use the CLI to do any other necessary configuration.
If you have environment-specific manifests
- Use manifest inheritance to do any necessary configuration.
- Run
cf push <NEW_APP_NAME> -f <PATH_TO_MANIFEST>
. - Make sure to run any necessary database setup commands, etc.
If you don’t have a manifest
-
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
- 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 nameenv
– change any environment-specific variables, e.g. theDATABASE_URL
services
-
Deploy the new environment:
cf push <NEW_APP_NAME> -f <NEW_APP_NAME>_manifest.yml
- Make sure to run any necessary database setup commands, etc. for the new application.