Backing up IaC

2 years ago by ch8zer to c/selfhosted

Hi all, I have my home lab set up as a single git repo. I’ve got all infrastructure as opentofu / ansible configs, and using git crypt to protect secret files (tofu state, ansible secret values, etc).

How would you back up such a system? Keeping it on my self hosted git creates a circular dependency. I’m hesitant to use a private codeberg repo in case I leak secrets. Just wondering what the rest of you are doing.

r0ertel 9 points 2 years ago

As others have said, a traditional off site backup will work. How do you plan to perform a restore, though? If you need the self hosted source repo, it won't be available until the infrastructure is stood to creating another circular dependency.

I'm still in the early stages of exploring this, too. My solution is to run a local filesystem git clone of the "main" repo and execute it with a Taskfile that builds a docker image from which it can execute the ansible infrastructure build. It is somewhat manual but I have performed a full rebuild a few times after some Big Mistakes.

path: 0 16367578, hotness: undefined, score: 9, children: 4
ch8zer 4 points 2 years ago

You pretty much got it. I need a quick way to restore the repo and ideally have git do a self backup. Seems like a cheap VPS may be the way to go

path: 0 16367578 16369146, hotness: undefined, score: 4, children: 3
r0ertel 2 points 2 years ago

For my own curiosity, how do you perform a build? Is it all done in pipelines, kicked off on change? Do you execute the whole infra build each time you release an update?

path: 0 16367578 16369146 16369626, hotness: undefined, score: 2, children: 2
ch8zer 3 points 2 years ago

Honestly, I just run it from the CLI myself.

I’ve wasted too much time fighting with CI and automation that when I migrated to forjego I didn’t bother to put it in again.

path: 0 16367578 16369146 16369626 16372478, hotness: undefined, score: 3, children: 1
r0ertel 2 points 2 years ago

Same. I have spent way more time troubleshooting a pipeline than it saves. I like the idea of automation but laziness prevails.

path: 0 16367578 16369146 16369626 16372478 16385631, hotness: undefined, score: 2, children: 0
oranki 4 points 2 years ago

Borgbackup in addition to git. Since there's probably not much data, any cheap VPS could act as storage.

path: 0 16367426, hotness: undefined, score: 4, children: 0
possiblylinux127 3 points 2 years ago

I would set aside a dedicated device that acts as a sort of "provisioner" and admin node. It can be something like a raspberry pi or desktop computer.

From a backup perspective I would evacuate risk vs cost/effort. If you lost your home would it really matter that you lost some config files?

path: 0 16387034, hotness: undefined, score: 3, children: 0
Grimm665 3 points 2 years ago

I would configure a Backblaze B2 bucket and copy your repos and configs there, should be dirt cheap compared to a VPS and very durable.

path: 0 16384553, hotness: undefined, score: 3, children: 0
vegetaaaaaaa 1 point a year ago

Back up your git service/repositories to offline storage.

path: 0 16492521, hotness: undefined, score: 1, children: 0
Vendetta9076 1 point 2 years ago

Codeberg and make sure you don't leak secrets or back it up at your buddies house on his homelab

path: 0 16366376, hotness: undefined, score: 1, children: 0
HelloRoot 1 point 2 years ago

What I did is set up a NAS at my parents house, which I can log into as well for near zero cost offsite backups.

And at home I have a couple of local drives with borgbackups.

path: 0 16372200, hotness: undefined, score: 1, children: 1
ch8zer 2 points 2 years ago

My parents have a NAS! Maybe I set up Tailscale and send it over there…

Although they live 3 streets away from me so I worry it’s not remote enough in case of flood etc

path: 0 16372200 16372495, hotness: undefined, score: 2, children: 0
selfhosted
selfhosted

@lemmy.world

login for more options
62973
6798
5683

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:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

go to feed...