New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How do you deploy your updates from Git? (or SVN)
I run a web site with a common setup - it's a Drupal site on Apache/MySQL.
We're a small group of people that work on the site and we use Git for version control. We all run our own internal development versions and commit to Git when we make changes.
Everything is working great, except when we actually need to deploy things on our live server - we haven't found a good workflow for this.
How do you perform updates on live server using Git ? Do you just Clone the repo to /var/www then Pull and Sync when you need to update?
Comments
Is there a problem with that? It seems like a pretty efficient way to me
The problem with this is that the entire .git folder is on the live server, which is a huge security risk as well as exposing the site source code.
Hiding the .git folder with .htaccess is hackish and not always possible.
You can but the git repo in another dir (that is not open to the web) and then just publish the dir that should be visible to the public (e.g. by mounting with with mount --bind to /var/www)
Mounting is also a hackish solution, and it complicates adding a new site.
Is there no cleaner way to do this?
Have git in the dir below and have www as a folder that git manages ?
Then you need to have a more complicated directory structure if you are running multiple sites, like:
/var/www/repo1/www
/var/www/repo2/www etc...
It also makes for unnecessary folders in the git repo.
Yes - write your paths to static files in nginx.conf (or apache.conf) explicitly. For my django sites I do
Though I see nothing hackish in .htaccess.
/var/www/repo2/www etc...
In fact, I do have a similar structure. Because it can be quite comfy to keep in repo1/ something, except www. Though git is initialized in www/ part.
Don't give the www user permissions to the .git folder ? If it can't read it it can't display it (or what ever user apache is running as)
or in your repo:
/reporoot/www/*
set up a hook that copies www/* to the web document root.
You can try capistrano. Used it before at work and it's quite efficient. Allows for rollback and stuff.
Actually regarding git: a friend of mine wrote a little script for got. Check it out @ http://github.com/bkase/git-paradox
his read me is pretty thorough but essentially it allows easy changes to small code errors in previous versions of your branch.