Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to best implement Version Control for Web Development?

Version control systems are obviously important in development projects but there use in web development projects appears to be more complex, what with the requirement of having a web server to run all but the simplest of web applications.

With that in mind, I have looked around and discovered a few different methods of using version control in web development projects:

  1. Provide each developer with a virtual machine which is a replication of the development server and have the developer run their working copy of the application in the virtual machine.

  2. Have each developer use a sub domain on the development server, e.g. john.project.com and checkout their working copy of the app to the directories the sub domain points to.

  3. Use the version control system to checkout code, make a change, commit the code and then check it on the development server (which points to the head of the repository).

I can see a drawback of 1 being the added time required to create the virtual machines and ensure that the virtual machines are kept insync with the development server (also the need(?) to continuously change the developers host file to point at the virtual machine not the development server).

I can see 2 possibly being a problem if absolute URLs are used within the site unless there is an easy way to update the configuration to use the new subdomains as well.

3 is the easiest to set up but is rather primitive and it will presumably become quite tedious for a developer to keep checking in the code after every time change.

How have the users of stackoverflow used version control with web development projects and which method/workflow was most effective.

Please also include extra methods I haven't thought of / read about.

like image 777
Adam Taylor Avatar asked Nov 05 '22 19:11

Adam Taylor


1 Answers

Try a combination of 1+3.

#1: Provide each developer with a virtual machine which is a replication of the development server and have the developer run their working copy of the application in the virtual machine.

I don't like VMs - maybe just because I am running the same OS the server is running on. Updating and keeping it in sync is a task I can do by myself (once a week: "just install package XYZ"). Every month or so you might freeze a VM for backup (or to give to new developers).

It's the best method for the developer. He doesn't have to wait for a commit/deploy to happen. Change a line of code, save the file, press F5 in the browser, done. For best efficiency that's the way to go.

#3: Use the version control system to checkout code, make a change, commit the code and then check it on the development server (which points to the head of the repository).

I would really recommend to setup a staging/dev server. Each time somebody commits into Version Control the server should automatically get the newest version and restart the webserver. This way other people can have a look at the running product and give feedback.

like image 66
Marcel Jackwerth Avatar answered Nov 29 '22 12:11

Marcel Jackwerth