Using git to manage a production website?

I have a website with 15,000 files on a production server. Currently, a remote developer does most of the work on the site, but sometimes I also need to make some changes. Obviously we need version control, so I'm trying to set up git.

I would really like to keep the installation simple and straightforward. We don't need any integrator to review our changes - we both fully trust to make changes to the production site. I also don't see the need to make changes on the staging server before making them live, as we can't test anything there that we can't test on our local machines. I just want something that will prevent us from knocking files together. Here's the scenario I mean:

          Production Server
              ↗↙ ↖↘          
Developer1(LAMP)  Developer2(WAMP)

      

Questions:

  • Does this workflow make sense for a team of two developers (one of whom only makes individual changes), or are there better ones?

  • Are there any advantages to adding a staging server between the developers and the production server?

  • My guess is that the production server should be a bare repo with a post-receive hook pointing to the webroot folder so that we clone a copy to each dev machine and then git commit / git push to resume any changes to production?

  • Is there any easy way to create a bare repo on a production server and then add the 15,000 already existing files to it? Or do I need to upload them to a clone repo on my local workstation and then do git add / commit / push to upload them to the repo? (They can take almost 13 hours to load.)

Thank!

+3


source to share


1 answer


Nothing wrong with the workflow, as such. But usually the "canonical" repository is separate and you manually deploy it to your production server using some other mechanism such as rsync. Thus:

  • Updates to your production server are not tied to your development workflow. If your production server (ever!) Needs any work after reloading the code, restart the webserver, clear some cache, change the schema, etc. - then a sudden problem with the production system interferes with your ability to update the code and that sucks.

  • You don't need to worry about accidentally leaking access to your directory .git

    and exposing all source code and development history.

  • It takes two accidents to ruin a site (wreck wizard and deploy), not just one (wizard wreck).

  • You might not just worry about all of you, but it's helpful to have the refresh site button have a different resolution than the refresh code button.



Existing servers exist as production but discontinuous. You only have two developers, but you are already using completely different operating systems; I'm sure at least one of you is not using a development environment that is identical to the production one. :)

And no, you cannot add files to the open repository. To work with a working tree, you need a working copy.

+2


source







All Articles