skip to Main Content

I am in charge of launching web projects and it takes a little too long currently from client sign off to final launch. It is on a server which I have root access to, but it runs Plesk so that the boss can setup VirtualHosts, which means there are many sites running on it.

Each project has its own git repository so currently I have the following setup.

On my staging server there is a clone of the repo and I have two bare repositories. One is on the forge (powered by Indefero) and the other is on the live server.

Each release of a project is tagged with todays date eg. git tag -a deployed-2011-04-20.

So on the staging server I execute something similar to git push --tags live master, which targets the bare repo on the live server.

Then over SSH on the live server I execute a short bash script which basically clones the repository from the live bare repo to the folder Apache will serve.

So if that all makes sense would you be able to recommend a tool or anything to make my life easier that follows that work flow or can be adapted?

It looks something like this:

Forge (authoritative source)
  ^
  |
  v
Staging/development server
  |
  v
Live server bare repo
  |
  v
Releases folder (symlinked to htdocs)

4

Answers


  1. If you use Hudson as a continious integration server, you can make use of the build pipeline plugin.

    You have your normal build process, but add an extra job which contains the commands to deploy your application. The plugin gives you a nice button to execute that build.

    The hudson job could execute all the needed commands or you can take a peek at Maven for PHP and use the available plugins to invoke the remote scripts

    Perhaps it is a bit out of range considering the path you’ve chosen already, but it’s worth the research.

    Login or Signup to reply.
  2. One solution that comes to mind is to add some post-receive hook on the live server bare repo in order to detect any deployed-2011-xx-yy tag coming from the staging repo, and to trigger the ssh script from there.

    The other solution is to have a scheduler (like Hudson mention in pderaaij‘s answer, in order to:

    • monitor the stating repo and, on the right tag, trigger the push on the live server
    • monitor the live bare repo, and trigger the ssh script.

    The second solution has the advantage to keep a trace of all release instances in an Hudson job report, each time said job detect the right tags and execute the release process.

    Login or Signup to reply.
  3. Take a look at Capistrano, which happily does the symlink dance you describe here.

    Login or Signup to reply.
  4. We got a couple of drupal sites we develop for, we are a team of 4 developers and about 20+ non-technical content managers.

    Each developer has his own dev environment, we all got a beta environment where we test code integration and performance, a staging environment where the content managers test features before we push to the live environment, a training environment we use to train people and an environment specific for usability testing.

    All that is setup with only 1 bare repo on a central server where each environment is a branch. We do use the post-receive hook with password-less ssh certs doing the auto pulling on the appropriate repo based on a case statement like the following:

    BRANCH=`echo $line |  sed 's/.*///g'`
    LOG="`date` - updating $BRANCH instance"
    case $BRANCH in
      "beta" )
        ssh www-data@beta "cd /var/www/beta.example.com; git pull"
        ;;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search