Long story short - Backup often, backup soon and write tutorials

And here the long version…

Holiday - best time to write new rules and solve unsolved problems in openHAB. I did so and reworked almost my tital system. But then one day i did it - i tried to install a new version or revert to an older version? i don’t know anymore.

So i created a backup with openhab-cli, installed the new or old version and made a mistake. Don’t know what, but everything was gone including the backup. No comment on this …

Now almost 8 weeks later my systems is nearly complete and i changed a lot of things. S i am almost happy, bute there is one thing. My gas stations rules are gone and i have to remember what i have done during my holidays. And then i remeber one thing - I wrote a tutorial about my latest changes - Wow use the search enigine and there are my items, rules etc to build up my gas station annoucement system.

Just copied it, made some smaler changes and now i am happy again.

My conclusion: Backup often, backup soon and write tutorials, it may save your system.

Thomas

8 Likes

Perfect introduction to link my post from today openHABianPi Initial Setup
:grinning:

You may want to copy the backup off your system too. I once realized as a reformatted a system that although I backed it up., I did not copy the backup off of the system. :flushed:

4 Likes

Glad it worked out for you, and while of course I would like to encourage everybody to write more tutorials, the forum software is not really the most reliable backup solution. Better install Amanda, and take a minute or two thinking about that introductory section.

PS:
https://www.spreadshirt.com/shop/design/admin+shirt+no+backup+no+pity+nerdy+geek+gift+mens+premium+t-shirt-D5bf155932051765adf76592d

3 Likes

Hmm, another kind of backup I suspect :smiley:

To get people to create backups regulary, it requires at least two things.

  1. Dicipline, (or enough suffering from crashes).
  2. Very easy software.

I have yet to see an easy software/script/whatever, which makes backup and restoring a piece of cake, except for a image copying of a whole drive, (including booting).

Thomas
for sure posting my stuff on the forum helps others (hopefully) but yeah… it also helps me remember what I did

3 Likes

I’ll add a step. “Backup often, backup soon, test your backups, and write tutorials.” :wink: A backup is worthless if it’s a broken backup.

In lieu of writing tutorials, you can use an admin tool like Ansible to configure in the first place in which case all the things you’ve done to your system will be captured in playbooks, which of course you need to back up. I don’t remember how I’ve done hardly any of the setup on my machines, but I can set it up again with one command.

2 Likes

How?
I suspect you mean, you can restore a backup with one command, which means it let your system back to the latest backup, right?

Ansible playbooks are designed for automating complex tasks. If all the configuration is setup in ansible, one command could just run all the commands to re-create the configuration.

Ansible is an IT automation tool. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates.

https://docs.ansible.com/ansible/latest/index.html

Yack!! :astonished:

I just took at quick look… Started the quick start video…
13 minutes just to tell what Ansible is?? I can create an image backup and restore it again faster than that. And I have not even done anything regarding Ansible, which I understand may be very good for restoring, but there seem to be pretty much setup behind.

he told you

google is yer bud

And I gave them a link to the documentation and they read it.

What point are you trying to make here? Verifying you do not read the posts in a thread before posting?

Here’s my “super simple” backup script, good if you have a NAS at home or other sort of device running FTP server. Uses openhab-cli backup command within a custom script to get backups off to alternate storage. Hasn’t missed a beat since I’ve set it up. Saved my arse twice (although now on SSD HDD, coz SD flash cards suck)

pound sand Bruce!

No, I mean set up a new machine with one command.

With Ansible, everything that you do to a machine gets coded in playbooks. Every installed or uninstalled program, every change to every config, any files that need to be moved to the machine get captured in the playbook.

So yes, you do need to keep a backup of sorts for some things (e.g. database contents, openHAB configs) but Ansible can be used to both take those backups and restore them. For openHAB configs I use git as a backup for the configs.

Then I just run ansible-playbook -i <path to my inventory file> homeautomation.yml. The inventory tells Ansible what machine is the home automation machine(s) and homeautomation.yml has all of the roles and playbooks to build up my home automation machine from a base Linux with nothing configured to my preferred configuration running openHAB, Mosquitto, InfluxDB, Grafana, and Shinobi with the most recent database backup restored to InfluxDB and the most recent openHAB configs checked out from my git server.

It’s not a backup in the traditional sense of the word. It’s a complete rebuild from scratch. But the playbooks are all also checked in to git and because everything is encoded in the playbooks, all of the configs are also self documented. And because I use git, I also have a history of changes I’ve made to my machines.

And upgrades are a breeze. I just spin up a new VM with the new OS (e.g. moving from Ubuntu 18.4 to 20.4) and run the playbook and I’m up and running.

It’s not about backup and restoring. It’s about infrastructure as code. You don’t set up your machines. You code how you want the machines set up. Once you’ve done that you’ve created a configuration that is repeatable, self documenting, and traceable.

What would happen if your images got lost or the restore didn’t work? What will happen when you need to move from stretch to buster and doing an inplace upgrade of the OS fails? Do you remember how you set everything up? Do you remember every little tweak and change you’ve made? You’re gonna have to redo them in either of these scenarios. That’s why the OP mentioned tutorials and why I mentioned Ansible as an alternative to tutorials.

If you are only dealing with one machine, one probably set up with openHABian in the first place, it’s probably no big deal and Ansible is way overkill. I have 5 VMs, 6 RPis, and well over a dozen services installed and running not to mention scores of tweaks and minor changes to all of these machines. I’d never ever remember how I set up and configured them all. With Ansible I don’t have to.

@Bruce_Osborne and @Andrew_Rowe, there is no need to get angry here. We are all friends.

4 Likes

Hmm… In a short term, there is no difference :smiley:

Does it get recorded, or do you have to manually create scripts?
( I admit, I only looked for 7 minutes at the quick start video. I simply felt this it was way beyound any decent backup system).

This is a usual problem with backup systems… Often you´ll need to do something, before you can restore your backup. (like having a clean OS up running). Only exception is, if you do drive/image copy, or if you have a backup procedure which can run from boot.

Hmm so Ansible doesnt touch the main OS (core system) ??

I agree, these are all fall groups in a backup system, speciellt when using image copy.
A image copy which fails is fatal, like any other backup systems, where the restoring fails.
The best way to do image backups, is to do it regulary (once a day).
If I need to upgrade the OS, and it fails. There is a totally new situation. A typical backup cant helt here either. But I do understand the advantages when using Ansible or simular. I just cant see how a very complexed system would be easy to code in Ansible.

But I guess you´ll have to spend alot of time coding them first time?

If you need additional software installed in addition to the basic install, this can be done in the ansible playbook too. One command does it all.

It can if you wish (your choice), The place I work uses it to manage the OS on Linux servers.

It is probably not too bad if it was done while he was building the configuration.

Does Ansible “record” then?

Ansible is text file based. At work I have my text configurations for network switches stored in a Git repository that also acts as a configuration backup.

So you´ll need to enter the code in text files while you´re setting up your system?

1 Like