Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How do you deploy your updates from Git? (or SVN)
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.

How do you deploy your updates from Git? (or SVN)

littleguylittleguy Member
edited March 2012 in General

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

  • @littleguy said: Do you just Clone the repo to /var/www then Pull and Sync when you need to update?

    Is there a problem with that? It seems like a pretty efficient way to me

    Thanked by 1djvdorp
  • littleguylittleguy Member
    edited March 2012

    @gsrdgrdghd said: 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)

  • @gsrdgrdghd said: 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 ?

  • littleguylittleguy Member
    edited March 2012

    @exussum said: 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.

  • @littleguy said:

    Is there no cleaner way to do this?

    Yes - write your paths to static files in nginx.conf (or apache.conf) explicitly. For my django sites I do

            location /media/ {
            }
            location /static/ {
            }
            # compability
            location /images/ {
            }
            location /robots.txt {
            }
            location /favicon.ico {
            }
            location / {
                    uwsgi_pass 127.0.0.1:49155;
                    include uwsgi_params;
            }
    

    Though I see nothing hackish in .htaccess.

  • bretonbreton Member
    edited March 2012

    @littleguy said:

    /var/www/repo1/www

    /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)

  • flyfly Member

    or in your repo:

    /reporoot/www/*

    set up a hook that copies www/* to the web document root.

  • dracodraco Member

    You can try capistrano. Used it before at work and it's quite efficient. Allows for rollback and stuff.

    Thanked by 1djvdorp
  • flyfly Member

    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.

Sign In or Register to comment.