Web development scheme for staging and production servers using Git Push
Posted
by
ServAce85
on Stack Overflow
See other posts from Stack Overflow
or by ServAce85
Published on 2011-11-18T10:16:57Z
Indexed on
2011/11/18
17:51 UTC
Read the original article
Hit count: 259
I am using git to manage a dynamic website (PHP + MySQL) and I want to send my files from my localhost to my staging and development servers in the most efficient and hassle-free way.
I am currently convinced that the best way for me to approach this problem is to use this git branching model to organize my local git repo. From there, I will use the release branches to push
to my staging server for testing. Once I am happy that the release code works on the staging server, I can then merge
with my master branch and push
that to my production server.
Pushing to Staging Server:
As noted in many introductory git posts, I could run into problems push
ing into a non-bare
repo, so, as suggested in this response, I plan to push
the release branch to a bare
repo on the server and have a post-receive hook that clone
s the bare
repo to a non-bare
repo that also acts as the web-hosted directory.
Pushing to Production Server:
Here's my newest source of confusion...
In the response that I cited above, it made me curious as to why @Paul states that it's a completely different story when push
ing to a live, development server. I guess I don't see the problem. Would it be safe and hassle-free to follow the same steps as above, but for the master branch? Where are the potential pit-falls?
Config Files:
With respect to configuration files that are unique to each environment (.htaccess
, config.php
, etc), it seems simplest to .gitignore
each of those files in their respective repos on their respective servers. Can you see anything immediately wrong with this? Better solutions?
Accessing Data:
Finally, as I initially stated, the site uses MySQL databases to store data. How would you suggest I access that data (for testing purposes) from the staging server and localhost?
I realize that I may have asked way too many questions for a single post, but since they're all related to the best way to set up this development scheme, I thought it was necessary.
© Stack Overflow or respective owner