For two weeks now I've been trying to implement Git at our office. Rather than lack of documentation it's the wealth of examples, tutorials and the various uses of git that have made me confused as to what is a recommended setup for web development.
I think I have a decent setup in mind, but before diving into yet another structure, I'd like to check with more experienced people. I have the following in mind:
- Workstations push to a local staging server (A)
- Local staging server works with gitolite to properly divide roles
- A hook automatically pushes any change to the staging server onto the production server (B)
This is visualized below:
Does this make sense? We have a variety of smaller PHP websites, nothing very complicated. The doubts I have are:
- What kind of 'hook' should I use for (B)?
- Should I also run gitolite on the production server? I feel I should not, because after all it is just one user that uploads things to the server (the hook on the staging server), but I'm not sure.
- My starting point is: we have all websites on the Production server, and not yet on the Staging server nor the Workstations. What is a convenient way of "pulling" them down to staging and workstations, at the initial setup?
Now, the following questions are some extra thoughts, not of utmost important at the moment but share your thoughts if you happen to know more:
For simplicity I prefer to be able to run
git push
from the workstation and have both the staging server and production server updated. But sometimes it might be useful to only update the staging server and check out things over there first, before going live. Is there an easy solution?In reality we have not only one but several different production servers. But only one staging server. Is there a way of configuring different production servers so that git automatically pushes them out to the right server?
Thanks in advance for sharing your thoughts!