I am using github to control the source code of my web application but I am having trouble deploying it on my live server. I would like to ssh onto the server and git pull origin master
when I have stable code in the repo. The problem is that I have two folders which reside in different places on the server.
# Bolded to be version controlled
/var
**/var/ci** <- php framework
/var/www/
**/var/www/webapp1**
/var/www/webapp2
My question: Is there a way to set this up such that afterwards I can just git hub pull origin master
and it will grab the latest code into both directories?
A solution, although sacrificing ease and peace of mind, would be to set up a repo on the server in a different location but have a bash script to do the replacement of the web app. Would any problems arise from this?
#/bin/bash
#Disclaimer: pseudo code
`git pull origin master`
`rm -rf * /my/live/frameworks`
`cp -f /my/git/repo/frameworks /my/live/frameworks
`rm -rf * /my/live/web_root`
`cp -f /my/git/repo/web_root /my/live/web_root
I can see some problems with the method above:
- Non-smooth application upgrade
- Losing cached templates and other temp files. I could add a filter on the
rm -rf
but again this approach is too hacky for me to be comfortable with
If you own a web server and manage it by pulling the latest code out of a repo set up like I do can you please offer some tips on how I should go about doing this? Much appreciated.