How do I "backup" my entire app?

Issue

You are looking to download a complete copy of your application source code, data, etc. Reasons for wanting said backup might range from a desire to "pause" all billing on an app temporarily, migrate the app away from Heroku to another platform, or close an account.

Resolution

There isn't a one-click solution for downloading a complete backup of all data for your Heroku app, but there are four things you'll want to get a copy of to ensure you have a complete backup of your application:

  1. Your code, preferably with Git history
  2. Your config variables
  3. Your database
  4. Any add-on data (such as Redis, New Relic, LogEntries, etc)

Getting a copy of your code

If you are a collaborator/owner of the app, you will likely have a version of the code locally -- just make sure that you have the most recent commits. If you don't have a copy of the app's code locally, you can clone it from Heroku by running the CLI command heroku git:clone -a <myapp>. Alternatively, if your source code is stored in a service like Github (highly recommended), you could also clone it from there. All of these solutions do require basic knowledge of Git version control.

The latest slug can also be downloaded. Install the plugin heroku plugins:install heroku-slugs and run heroku slugs:download -a <app_name>. This will download the latest application code that is running.

Getting a copy of your config variables

Also known as environment variables, these often contain important details such as API keys and database credentials. You can view all of your config variables and their values by running heroku config -a <myapp>.

Getting a copy of your database

If you are using Heroku Postgres you can either create a logical backup with Heroku PgBackups or, for Standard and Premium databases, backups can also be retrieved through Heroku Postgres Rollbacks.

If you're using a different service provider for your database you will need to refer to their documentation on how to download a copy.

Getting a copy of your add-on data

As this is data is not managed by Heroku (unless it's a Heroku-provided add-on like Postgres/Redis) each of your add-ons will need to be handled individually. Reach out to your add-on providers for details on how to get a copy of any relevant configuration, data, etc.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support