How do I "backup" my entire app?
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.
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 how to get a copy of any relevant configuration, data, etc.