Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Cloudron Backups to GitLab/GitHub Private Repos



  • I'm happy with the current paid backup options with their service levels that come with it - but it occurred to me that GitLab.com & GitHub.com both effectively offer unlimited storage for free, and Git Large File Support (LFS) now too.

    Inspired a little by this neat app that turns a Git Repo into a Dropbox/GDrive type service:

    And since encrypted backups are an option, there's additional security.

    Not a high priority - but might be nice for both the really tight and multi-location/provider redundancy aims.

    Plus it's already a version-control system for historic records, so could help cover some of the legal compliance archiving of records needs for companies.

    Just a thought but maybe something in this?


  • App Dev

    @marcusquinn I think if you choose "SSHFS Mount" in the options and throw in your gitlab repo credentials / path that it would probably work??? I am not 100% sure tho.

    Sike - Try this instead:

    1. Enable Filesystem as the backup Storage Provider
    2. Pick a path on your Cloudron HDD, something like /home/backups/gitlab
    3. Initialize it as a git repo: cd /home/backups/gitlab && git init && git remote add origin https://gitlab-server/username/repository
    4. Make sure to save the password in git as well: git config --global credential.helper store then pull the empty repo to store password. NOTE: you should use a randomly generated username and password as they will be stored in PLAINTEXT here.
    5. Put the following in crontab 00 23 * * * /home/backups/gitlab_script.sh
      Essentially this cron job runs everyday at 11PM server time.
    6. Put the following in /home/backups/gitlab_script.sh:
    #!/bin/bash
    
    ## Todays date
    NOW=$(date +"%m-%d-%Y")
    
    ## Change DIR to backups path
    cd /home/backups/gitlab
    
    ## Add changed files
    git add -A
    
    ## Add untracked (not tracked) files to git
    git add -u
    
    ## Commit to git
    git commit -m "Backup $NOW"
    
    ## Push to gitlab
    git push origin master
    

    that should do it, but note, it will take a long time to process.



  • @murgero Interesting, will give it a try and feedback here if it works as then it would be devs favourite solution; just be some notes added to the docs. 🙂👍


  • App Dev

    @marcusquinn Check my edit - much better solution.



  • @murgero Interesting - that covers it being multi-backups nicely too! Certainly one to try with caution for the CPU & Bandwidth though but good that it's a possibility.


  • App Dev

    @marcusquinn It's only extra cost to resource is drive space, otherwise CPU and bandwidth usage is similar to other backup solution cloudron supports.


  • Staff

    @marcusquinn said in Cloudron Backups to GitLab/GitHub Private Repos:

    Not a high priority - but might be nice for both the really tight and multi-location/provider redundancy aims.

    I have to think through the rest but multi-location backups is in our radar. We have a long pending issue about this https://git.cloudron.io/cloudron/box/-/issues/528


Log in to reply