Kamal makes deploying web applications to your preferred infrastructure a breeze. However, it has its tradeoffs, mainly that you need to manage a lot of the maintenance work yourself. One of the essential things you’ll need to handle yourself when using Kamal are database backups.
In this video, I'll show you a quick and easy way to back up PostgreSQL databases for your Kamal-deployed web apps and store them securely on Amazon S3.
*Thanks for watching!*
If you find this video helpful, consider subscribing to this channel for more tips on helping Rails developers ship their code with more confidence, from development to deployment.
You can also check my website for more in-depth articles covering Rails, testing, DevOps, and other software engineering topics: https://dennmart.com/
*Chapters:*
0:00 - Intro
1:53 - Introducing the postgres-backup-s3 Docker image
3:14 - Setting up backups accessory in Kamal configuration
4:16 - Configuring environment variables for backups accessory
8:29 - Deploying backups accessory using Kamal
9:23 - Making our first Kamal database backup to Amazon S3
11:30 - Restoring the latest database backup from Amazon S3
12:50 - Restoring a specific database backup
13:51 - Using Cloudflare R2 instead of Amazon S3 for backups
17:15 - Wrapup
*Additional resources:*
- Written version of this video: https://dennmart.com/articles/hassle-free-automated-postgresql-backups-for-kamal-apps/
*Related Links:*
- Kamal: https://kamal-deploy.org/
- Rails Deployments Made Easy with Terraform and Kamal (Video): https://www.youtube.com/watch?v=uVGo7eZr6wU
- postgres-backup-s3 (GitHub Repo): https://github.com/eeshugerman/postgres-backup-s3
- Cloudflare R2: https://www.cloudflare.com/developer-platform/r2/
*Background music used in video:*
- Summer Adventures by SergePavkinMusic: https://pixabay.com/users/sergepavkinmusic-6130722/
*Additional videos used:*
- Video by Paice Street: https://www.pexels.com/video/a-computer-hard-drive-part-spinning-in-operation-3289546/