06-22-2017 07:29 PM - edited 06-22-2017 07:31 PM
I'm not thrilled with the way system config-management commit-archive location works, and I wanted to push every commit to a git repo, so I've whipped up some scripts to do just that.
The scripts don't require any extra packages on the EdgeRouter and don't modify any files that are part of the OS. It send the backups to a git repository directory on a remote host using scp, then executes the git commands on the remote host over ssh.
The whole thing is ~40 lines of Bash in three scripts, plus a configuration file and an SSH key. Should be pretty simple to understand and the readme runs through everything you need to get it running except for the git portion and generating ssh keys.
Works on my ER-8 and ER-X-SFP on v1.9.1. Will test it against an ER-L and ER-8-XG soon.
Credit to this thread for helping me figure out how to hook into commit and persist across reboots:
06-26-2017 09:07 AM
I've made a bunch of tweaks since posting this, the most awesome of which is that it now also generates a backup of /config that is directly restorable from the web interface.
06-26-2017 02:28 PM
Indeed. I've improved on their method slightly by making the .tar.gz file reproducible. If you download the backup config from the UI twice in a row and hash them, you'll get two different hash values even though the contents of /config haven't changed.
It's a small thing but when you're putting things in source control you don't want files changing needlessly.