Syncing files between servers and using Git

Discussion in 'Systems Administration' started by thecenters, Aug 21, 2020.

  1. I'm kind of a noob with running a dedicated machine. I'm learning as I go but I have some questions I hope someone can answer.

    Is it possible to use git on each of my servers, but only for the *.yml files? I'm trying to get some version control. If I can, what's the best way to connect this to a github for people who work through ftp?

    How can I best link specific static files between servers. Should I setup a symlink for this or is there something better I should be doing?
     
  2. Are you just trying to share configuration between multiple servers? Git may be a good candidate. To do this you can set up a .gitignore for your repository that ignores all files except those ending with *.yml

    It'd look something like this
    Code (Text):
    */**
    !.yml
    You'd need to run git pull in order to update your configuration, and you'd also need a way to host your git repository (i.e. GitHub). If you want to update your configuration you could clone the repository locally, make your changes, push to GitHub, and then pull on each server.

    I do something similar for a server I run with a friend: https://github.com/shepherdjerred-minecraft/server-mercury
     
  3. I only need to keep some files in sync and they aren't .yml files. They are static files that the servers share.

    Is there some way to do automatic commits and send them to github? Allowing my staff to sftp to edit the files and simplifying the process a little?
     
  4. Why not use something like rsync which is literally made for this? Using git is a tad hacky, nevermind the poor support for larger files (since GitHub LFS is a enterprise only thing for as far as I know)
     
    • Winner Winner x 1
  5. I'm looking into rsync right now and that would work to make sure files are sync'd across servers. However I think I still would like git setup for version control over my server's config files.
     
  6. Airee

    Supporter

    For my network with 3 identical servers we have a CI script that rsyncs the files to each of the instances. Check out GitHub Actions.