A small tool to make Ruby Toolbox production database dumps available
- Make database snapshots easily available to researchers and contributors of the Ruby Toolbox
- Host backups independent of the Ruby Toolbox production infrastructure
- Provide an overview of available snapshots both for browsers as well as in machine-readable format (a.k.a. JSON) for scripted consumption
- Host the main entry points via HTTPS from a domain under Ruby Toolbox control
- Avoid polluting the main app's repo with backup handling code
- Avoid building actual backup-making-code
How does it work?
- Query available backups from the Heroku Postgres API
- Sync the available backups to an AWS S3 bucket
- Build an HTML and JSON index of available recent backups
- Deploy the index as a static site to Netlify
Obviously, access to the API for the app you want to query Heroku Postgres Backups must be provided:
PG_HEROKU_APP: Name of the Heroku app to pull database backups for
PG_HEROKU_USER: E-Mail address for the user account
PG_HEROKU_API_KEY: API key for said user account
To mirror database dumps, AWS S3 is used. You need to set up and configure an IAM role and corresponding API keys as well as the actual S3 bucket via the AWS API or web console yourself, then provide these via:
To deploy the actual listings of available backup, Netlify is used. You need to create and configure the site to deploy to using their API or web interface as well as creating a personal OAuth2 access token in your account settings page.
NETLIFY_TOKEN: Your OAuth2 access token
NETLIFY_SITE: Name of the Netlify site you want to deploy the index to
In the Ruby Toolbox's case, this app is hosted on Heroku. Follow the basic process to get it deployed:
- Create an app in your preferred region
- Add the git remote
heroku config:setall the required configuration options
git push heroku master
Do not worry about Heroku complaining about the absent Procfile, this app does not have any permanently running processes.
Instead, add the Heroku Scheduler add-on and configure an hourly task to run
Code of Conduct
Everyone participating in this project's development, issue trackers and other channels is expected to follow our Code of Conduct
This project is available as open source under the terms of the MIT License.