A simple way to backup, synchronize and encrypt repositories for multiple users and organizations
Most of the governance is made by the use of environmental varaibles. The process can be based in a CRON job or direct execution (no cron).
In order to run this application you will need to provide a valid personal github token with repo level access
This are the environmental secrets that you can use:
GITHUB_TOKEN (mandatory). This token is used to perform the API calls to Github and to clone/pull for private reposPASSPHRASE (optional). Only is required if you want to backup private repositories. This is the passphare used to encrypt/decrypt the private repos. Highly recommended to use a STRONG, LONG and NON-REUSED passwordTARGET_ORGANIZATIONS (optional) list of organizations splitted by comma in scope for backup (including private repos).TARGET_PUBLIC_ORGANIZATIONS (optional) sames as TARGET_ORGANIZATIONS but with public repos only as scopeTARGET_USERS (optional) sames as TARGET_ORGANIZATIONS but for individual usersCRON_TIME (optional) this must be a cron valid pattern. If this is present the execution will be always a CRON jobs basedCRON_TIMEZONE (optional) this must be a valid Timezone, by default is using Europe/MadridThere are two main folders to manage as well:
./repos that stores all the clones of the repos (private and public)./logs that stores all the relevant info of the last batch executionservices:
github-backup:
image: ulisesgascon/github-backup:latest
restart: unless-stopped
environment:
GITHUB_TOKEN: 'github_personal_token'
PASSPHRASE: 'personal_passphrase'
TARGET_ORGANIZATIONS: 'one_org,other_org'
TARGET_PUBLIC_ORGANIZATIONS: 'different_org,aditional_org'
TARGET_USERS: 'my_user,another_user'
CRON_TIME: '* 18 * * * *'
CRON_TIMEZONE: 'Europe/Madrid'
volumes:
- "./repos:/app/repos/"
- "./logs:/app/logs/"
Yep, this project can be use as a regular Nodejs application, but remember to include the environmental secrets you need.
You will need to access the clone and push it to a new server, like:
cd repos/public_repos/USER/REPO.git
git push --mirror [email protected]:USER/REPO.git
Content type
Image
Digest
Size
66.6 MB
Last updated
almost 5 years ago
docker pull ulisesgascon/github-backup