HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   Best way of version control of a live site (http://www.howtoforge.com/forums/showthread.php?t=55040)

alleks 21st November 2011 16:40

Best way of version control of a live site
 
Sorry if I posted in the wrong place but where else? :)

Can any1 help me with this question I made some time ago:
http://stackoverflow.com/questions/7...of-a-live-site

Quote:

I want to test on one of my servers the version control of a live website and implement it the best way possible.

That one of the servers is running on Debian Lenny with Apache2 and wanting to use Mercurial (1.9.3 installed) as version software.

I have followed this tutorial (http://www.isnull.com.ar/2010/03/how...debian-or.html) till a certain point where these doubts showed up: How can I do version control of a live website, thinking of implementing multiple users support in the future. Explain:

I have my live website which I want to add the feature of the version control and it to be the master branch with it's user and password for commits (in the beginning).
From my local computer where I have the development area, I want to be able to commit to the master branch through whatever protocol (http, ssh, ...).
I also would like to know which method would be the most efficient to have the multiple user support and than each user to push to a stable repository and when the push is accepted the administrator will push to live site / master branch. Explication: I have the master branch, a stable clone of the master and each user will have his clone/s of the stable repository and finally each user will push to the stable repo where from there if accepted will go to the master branch.
It does occur to me another question, won't be there conflict problems when a user pushes a file/s different from what other user pushed 1 minute ago? Of course there can be the task separation and each to do certain things but what if not, what if X commits submit.php and Y also commits submit.php 1 minute before? I am asking this because I am sure that I will encounter this problem with the friend I work with, so what any ideas?

Or it's that I didn't fully experimented CVS and neither fully understood it? Even though I think other have encounter the same problems as I but I didn't find no where these questions asked.

Thank you, Alex

PS: Mercurial is not a must, It's just I used that one mostly but I am open to any other software that will help me

Quote:

I have the following structure: Production, Stable , Development and Testing (for testing purposes only) and of course Production is the master branch and each other is a copy of another (Production -> Stable -> Development -> Testing or Production <- Stable <- Development <- Testing) and all of them are workable inclusive the master branch
By that I mean that when everything is ok and goes great I push to Production (Development -> Stable (Stable copy of production) -> Production) and what mainly I am looking for is for a way that automatically when new changes are submitted to Production it updates the LIVE Site through ftp or whatever type of transfer protocol.

Thanks,
Alex

till 22nd November 2011 14:16

I used SVN for this purpose some time ago on several servers and it worked quite well.

Quote:

It does occur to me another question, won't be there conflict problems when a user pushes a file/s different from what other user pushed 1 minute ago?
SVN takes care about that. If a file has been modified and commited by user 1 while user 2 works on it too and user 2 then tries to commit his work, svn will inform the user that he has to run a update on his repository first so that svn can merge the changes in his local copy before he can commit his work. This kind of version control (with svn or git) is used by most OpenSource projects weher a lot of poeple are working at the same time on the code.

I wont use CVS as its quite old and not that easy to use, better use SVN or Git. If you develop on windows systems, then take a look at tortoisesvn client.

alleks 24th November 2011 12:12

Thank you Till, that's very useful to know... but what about the synchronization problem?

till 24th November 2011 13:13

You create e.g. 3 branches in SVN:

/yoursite/trunk
/yoursite/testing
/yoursite/stable

All developers have access to trunk. The release managers have access to testing and stable.

Changes from trunk were merged (applied) to testing and if they work you can merge them to stable.

You can then export the revisions from testing and stable to the webservers with svn export command.

To get a easy way to switch back to a old revision later in case that somethin does not work in stable, then you can create a tag for every released version, so its easy to get back to that version.

/yoursite/tags/1.0
/yoursite/tags/1.1
/yoursite/tags/1.2

etc.

alleks 24th November 2011 18:14

So subversion (the one and only I was avoiding) seems to have the solution :), but my question is how would that work if people have to push changes from a remote place (another pc) and I don't have a Fix/Stable/Own public IP but a dynamic one? I wouldn't like to make branches on a production server and work with them there, there should be only the Live/Production branch. I hope you understand my question.

I do have another idea but I will have to test it first and then I will let you know, it involves a Shorcut/Copy/Remote folder called Production (like a shared folder over the network) of the live website and that will be a masterbranch and when merged changes to that folder they auto update because it's a "shared" folder copy of the webXX/web/.

till 24th November 2011 22:04

Quote:

So subversion (the one and only I was avoiding) seems to have the solution , but my question is how would that work if people have to push changes from a remote place (another pc) and I don't have a Fix/Stable/Own public IP but a dynamic one? I wouldn't like to make branches on a production server and work with them there, there should be only the Live/Production branch. I hope you understand my question.
You have one central svn server. This svn server can be any server that is reachable over the internet, it is normally not the productions system. All developers authenticate at this server with username and password of their svn account, svn has its own user and group management. So the IP addresses or connections of the developers dont matter.

If you want to get a version of the code live, then a script on the live server connects to the svn repository server and pulls a copy of the code to its local harddisk.

Quote:

I do have another idea but I will have to test it first and then I will let you know, it involves a Shorcut/Copy/Remote folder called Production (like a shared folder over the network) of the live website and that will be a masterbranch and when merged changes to that folder they auto update because it's a "shared" folder copy of the webXX/web/.
Thats not required. SVN can do this much better.


All times are GMT +2. The time now is 20:15.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.