Hacker News new | ask | show | jobs
Simple deployment with git (rous.info)
4 points by mrous 4648 days ago
Description of a really basic git deployment strategy.
2 comments

You can avoid pulling the repo everytime if you create a hook. In Ubuntu real quick, with default LAMP stack:

    git init --bare --shared=group /srv/git/app.git
    mkdir /var/www/app
    chown -R www-data:www-data /srv/git/app.git /var/www/app
    chmod -R g+rw /srv/git/app.git /var/www/app
    vim /srv/git/app.git/hooks/post-receive
      #!/bin/sh
      export GIT_WORK_TREE=/var/www/app
      git checkout -f dev # dev branch
      cd /var/www/app
      # Run composer, npm, etc...
    chmod +x /srv/git/app.git/hooks/post-receive
Whenever you push it'll checkout the dev branch in your public web folder. Now, that's instant deployment!
This is quite beneficial if you want all of your pushes deployed instantly (as is the case in the post).

This was just a little post using pull as the simplest example possible. It's a part of a toy project I'm working on and I didn't want to go in too deep...

really? ok...I mean...really?