Edit: Results tabulated, thanks for all y’alls input!
Backup while it is expected to be idle @MangoPenguin@lemmy.blahaj.zone @khorak@lemmy.dbzer0.com @dandroid@sh.itjust.works
@Darkassassin07@lemmy.ca suggested adding a real long-ass-backup-script to run monthly to limit overall downtime
Shutdown all containers -> backup @PotatoPotato@lemmy.world
Leveraging NixOS impermanence, reboot once a day and backup @thejevans@lemmy.ml
(it seems pg_dumpall
for Postgres and mysqldump
for mysql (though some images with mysql don’t have that command for meeeeee))
Dump Postgres via pg_dumpall
on a schedule, backup normally on another schedule @RegalPotoo@lemmy.world
Dump mysql via mysqldump and pipe to restic directly @youRFate@feddit.de
Dump Postgres via pg_dumpall
-> backup -> delete dump @2xsaiko@discuss.tchncs.de @SteveDinn@lemmy.ca
Make your own docker image (https://gitlab.com/trubeck/postgres-backup) and set to run on a schedule, includes restic so it backs itself up @Undaunted@discuss.tchncs.de (thanks for uploading your scripts!!)
Add docker image prodrigestivill/postgres-backup-local
and set to run on a schedule, backup those dumps on another schedule @brewery@lemmy.world @Lem453@lemmy.ca (also recommended additionally backing up the running database and trying that first during a restore)
LVM snapshot -> backup that @butitsnotme@lemmy.world
ZFS snapshot -> backup that @ikidd@lemmy.world (real world recovery experience shows that databases act like they’re recovering from a power outage and it works)
(I assume btrfs snapshot will also work)
pg_dumpall
, zips, then rclone them @DeltaTangoLima@reddrefuge.comI’ve searched this long and hard and I haven’t really seen a good consensus that made sense. The SEO is really slowing me on this one, stuff like “restic backup database” gets me garbage.
I’ve got databases in docker containers in LXC containers, but that shouldn’t matter (I think).
I’ve seen:
None seem turnkey except for the first, but since so many other options exist I have a feeling the first option isn’t something you can rest easy with.
I’d like to minimize backup down times obviously, like what if the backup for whatever reason takes a long time? I’d denial of service myself trying to backup my service.
I’d also like to avoid a “long ass backup script” cause autorestic/borgmatic seem so nice to use. I could, but I’d be sad.
So, what do y’all do to backup docker databases with backup programs like Borg/Restic?
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.
Rules:
Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.
No spam posting.
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.
Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
No trolling.
Resources:
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
Better question is: why are you running static storage servers in Docker?
;.; I don’t know what this means
Don’t run storage services in Docker. It’s stupid and unnecessary. Just run it on the host.
You’d have to run several versions of several db engines side by side, which is not even doable easily in most distros. Not to mention some apps need special niche versions, Immich needs a version of Postgres with pg-vectors installed. Also they don’t tell you how they provision them — and usually I don’t care because that’s the whole point of using a docker stack so I don’t have to.
Last but not least there’s no reason to not run databases in docker.
Ah gotchya, well docker compose plus the image is pretty necessary for me to easily manage big ass/complicated database-based storage services like paperless or Immich - so I’m locked in!
And I’d still have to specially handle the database for backup even if it wasn’t in a container…
Why, exactly?
Because you can’t just copy the files of a running DB (if I got what you mean).
Don’t worry, it’s fine, there’s nothing inherently wrong with running stateful workload in a container.
You should really back that up with arguments as I don’t think a lot of people would agree with you.