carnivuth/github_sync

By carnivuth

Updated 7 months ago

handy script to clone public repositories from a public account for backup

Image
Databases & Storage
Networking
Operating Systems

73

GITHUB SYNC

A handy script for backupping public repos from a github account :) (it's just my fear of loosing data :c ).

WHY THIS

DO BACKUPS!! this is what as been told to me since i started doing system administration tasks and projects. So i wrote this script moved by the fear of losing github repositories (as if my hard drives were more reliable than microsoft ones), originally designed to run as a cron job.

recently i have migrated my homelab services to a configuration managed with ansible and terraform and i found myself dealing with a lot of scripts like this one that were not designed to be ported from a machine to another and the idea comes to mind:

What if i put a cron script inside a docker container?

and this abomination was born :)

HOW IT WORKS

The script runs as a cron job every our, it fetches the github api to download the list of public repos and downloads them, then it curls healthcheck.io for monitoring.

In order to work the following env vars must be set inside container

HEALTHCHECK: "healthchecks.io url"
ACCOUNT: "github username to fetch for backup"

also a mount for the data and log folder are required

volumes:
  - "data folder:/var/lib/github_sync"
  - "logs folder:/var/log/github_sync"

INSTALLATION

simply use docker compose, a sample file is here

Docker Pull Command

docker pull carnivuth/github_sync