Running gickup on a QNAP NAS

15 Oct 2022 in Infrastructure

I learned about Gickup whilst reading Jeff Geerling’s backup plan and thought it would be a useful thing to run for my own repos.

I initially ran it on my local machine periodically, then realised that I could run it on my QNAP NAS every night. Here’s how I did it:

  • Create a shared folder named gickup to contain the backups. I’ve got a volume named Backups that contains this, but any volume will do
  • Create a directory to store your backups by running mkdir -p /share/gickup/repos
  • Edit /etc/config/crontab and add the following line to the end: 0 3 * * * docker run --rm -v /share/gickup:/hostvol buddyspencer/gickup:0.9 /gickup/app /hostvol/config.yml > /share/gickup/last-run.log 2>&1. This will run gickup every day at 3am
  • Reload cron to pick up that change by running crontab /etc/config/crontab && /etc/init.d/crond.sh restart

You may have noticed that I reference /hostvol/config.yml. I mount the /share/gickup folder a /hostvol, and config.yml is my gickup configuration file. Here’s what it looks like:

yaml
# config.yml in /share/gickup
source:
github:
- token: CHANGE_ME_TO_YOUR_GITHUB_PAT
excludeorgs: # this excludes repos from the organizations "foo" and "bar"
- foo
- bar
destination:
local:
- path: /hostvol/repos
structured: true

Create your own config.yml, making sure you change the token value. If you’ve configured all of the above, all the repositories you have access to will be backed up at 3am each day.