wiki'd

by JoKeru

Git yourself / configuration management server

If you don't know what is Git good for, or if you do, I suggest to start with these two pages: http://rogerdudler.github.io/git-guide/ and https://www.atlassian.com/git/tutorials/setting-up-a-repository.

Now that everything is clear, we can go on configuring the good stuff:

  • we'll have a central node that will be the configuration management server / repo
  • and X other client nodes that will push their configuration to the central repo

On the central repo:

$ apt-get install git-core
# let's make a git user and not use root for the actual git sync
# you can use ssh keys for the git user so you can script your daily / weekly syncs
$ adduser git
$ su git
# let's make the first repo - let's take an apache document root as an example
$ mkdir node-01.www
$ cd node-01.www
$ git init --bare
Initialized empty Git repository in /home/git/node-01.www/

On node-01:

$ apt-get install git-core
$ git config --global user.name "JoKeru"
$ git config --global user.email "root@node-01"

$ cd /var/www
$ git init
$ # use .gitignore if you don't want to sync files / folders (cache, tmp, logs ...)
$ git add .
$ git status # to check files added
$ git commit -m "initial commit" # now the local repo is done

$ git remote add origin ssh://git@git-central:/home/git/node-01.www
$ git remote show origin
$ git push origin master # now the central repo is also updated
$ git remote show origin

If you want to retrieve the latest configuration for node-01.www repo from the central repo:

$ git clone ssh://git@git-central:/home/git/node-01.www /var/www-from-central-repo

And finally, i suggest you to install this Git Graphical User Interface on the central repo: https://github.com/klaussilveira/gitlist.

Comments