# nayaksur...@gmail.com / 2015-01-30 00:00:21 -0800:
> 1. What are the best strategy for git based deployment and rollback on 
> large setup. (around 500 servers).

the best strategy is to (mostly) leave git out of the deployment
picture.  minimal recipe: to deploy to /srv/http/thisapp/current/
(on a single server for demonstration) you'd do:

  % r=git://mygithost/repo.git
  % h=deadbeef # whatever commit you want to deploy
  % cd /srv/http/thisapp/
  % git archive --remote $r --prefix $h/
  % ... stop the web server
  % ln -sf $h current
  % ... start the web server

in the above, git-archive is nor really necessary and can be replaced
with eg. rsync (from a worktree somewhere).  ie. you can have a single
work tree used as a master source for your deployments, always at a
desired revision (use git-checkout to your heart's content, or the
git-archive thing), and trigger deployments from there.

> 2. how to rollback in git. Which are the better way. In git revert it 
> reverts to last commit. What if I wanted to revert to for example: last 5 
> commits.

i take it you want to rollback the deployed files to some previous
state, as opposed to creating a new commit that undoes N most recent
commits.  git revert is not a deployment tool, it's a shortcut for
git commit creating a commit negating N most recent commits.

that said, the easy solution is (provided you still have that old
version on your servers):

  % h=01dbeef
  % ln -sf $h current

> 3. what problems I can face while rollback.

none unless you force git into a shoe that does not fit, so don't do it.
outside of that, the same kinds of problem like in "rollforward".

if i had 500 servers running the same stuff i'd be packaging my files
and deploying them using the native tools of the OS in question, like
rpm packages with zypper in suse linux.  you may want to wrap that up
in the likes of chef and puppet, though i consider these contraptions.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to