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.
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.
I’ll add a step. “Backup often, backup soon, test your backups, and write tutorials.” 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.
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.
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)
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.
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?