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.
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:
- Your code, preferably with Git history
- Your config variables
- Your database
- 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'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.