5 ms·
Simple deployment with git
Description of a really basic git deployment strategy.
- pendexgabo 13y agoreally? ok...I mean...really?
- elclanrs 13y agoYou 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!
- mrous 13y agoThis 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...