How to create a clone of an App?

Hey Aptible, is it possible to clone an entire app? We are looking to upgrade an existing application, but we have no way to roll the application back to a previous state, so cloning the application would provide a viable safety net for us. Please let me know.

Since Apps don’t contain any persistent state themselves simply redeploying a previous image with Direct Docker Image Deployment will “roll back” the App to its previous state. For Dockerfile Deployment a previous commit can be pushed which will result in a new image but it will use the same code as the previous commit so the resulting image will be similar.

With that in mind, I assume that you’re deploying migrations that would result in irreversible changes to a Database or other persistent storage location like AWS S3. In this case, you could make the migrations/changes reversible. This can be done by marking database records with a deletion timestamp instead of actually deleting them, creating a new column on a table instead of altering an existing one, moving files in an S3 bucket to a different location instead of deleting them, etc.

If you would like to test the upgrade on Aptible the entire application stack (Apps, Databases, etc) must be duplicated since the irreversible changes aren’t being made directly in the App. Databases can be duplicated by restoring their latest Backup (in the same region) using the aptible backup:restore CLI command. Apps are a little more involved but still relatively easy to duplicate:

  1. Create a new App
  2. Copy the existing App’s configuration to the new App. This can be done relatively easily with the CLI and the xargs command: aptible config --app $SOURCE_APP | xargs aptible config:set --app $TARGET_APP
  3. Update the new App’s configuration to use the duplicate Database(s). This assumes that the App’s Configuration is being used to provide these connection details to the application containers, as it should.
  4. Deploy the new App.
  5. Create any Endpoints you need to test the upgraded App.

Once you’ve identified that the upgrade was successful, deploy the upgrade to the original App.