Live data from Hacker News

Deploy a website using git in Ubuntu

kramerapps.com

1–10 of 22 posts

Re: Deploy a website using git in Ubuntu

#2
Great article!

My apologies if this is too off-topic, but it's interesting to see everyone's virtualenv setup. I normally have my project/site/app in my environment folder, so it looks something like:

    projectenv/
      bin/
      include/
      lib/
      project/
but I've also seen (as is the case in the OP's example):

    project/
      env/
      __init__.py
      database.py
      ...
or even having a separate folder for all environments:

    envs/
      env1/
      env2/
      ...
    project1/
      ...
    project2/
      ...
Would anyone say there's a "preferred" setup?

Re: Deploy a website using git in Ubuntu

#3
ok, here's a question.

what if the "bare" git repo (/srv/git/helloworld.git) belongs to a user "git" and the non-bare setup (/srv/www/helloworld) belongs to use "conradev" ? this (different users) setup is what one would prefer when multiple people are working on the project.

git pull hub master would fail in that case as it would be executed by the git user. so you'll probably have a lot of hard time figuring out permissions. what are your suggestions now ?

Re: Deploy a website using git in Ubuntu

#4
Be wary of having .git accessible to the outside world. If it is routed, possibly due to default web server configuration or an oversight, it can be rather easy to fetch the complete (or in the case of packed refs, nearly complete) history of your application server by walking the git objects in reverse from refs/heads/*. This could reveal database configuration details or other particularly interesting things.

The server need not even be set up git over http (via git-update-server-info or what have you) for this to be an issue.

Re: Deploy a website using git in Ubuntu

#5

ok, here's a question. what if the "bare" git repo (/srv/git/helloworld.git) belongs to a user "git" and the non-bare setup (/srv/www/helloworld) belongs to use "conradev" ? this (different users) setup is what one would prefer when multiple people are working on the project. git pull hub master would fail in that case as it would be executed by the git user. so you'll probably have a lot of hard time figuring out pe…

This could be solved reasonably well with ACLs. Give the git user selective write to the tree rooted at /srv/www/helloworld.

Re: Deploy a website using git in Ubuntu

#6
post #5

ok, here's a question. what if the "bare" git repo (/srv/git/helloworld.git) belongs to a user "git" and the non-bare setup (/srv/www/helloworld) belongs to use "conradev" ? this (different users) setup is what one would prefer when multiple people are working on the project. git pull hub master would fail in that case as it would be executed by the git user. so you'll probably have a lot of hard time figuring out pe…

This could be solved reasonably well with ACLs. Give the git user selective write to the tree rooted at /srv/www/helloworld.

but the plan/aim is to make it all very simple to setup (even for noobs :)). cmon, ACL knowledge is not something wide spread.

So, we need to keep things simpler!

Re: Deploy a website using git in Ubuntu

#7
Is git push atomic? I'm reaching the point with a PHP application where enough people are using it at any one point, every time i push an update (using lftp --mirror over sftp) someone gets caught in the crossfire.

My next step is deploying to a temporary folder and swapping symlinks around, but if git/hg can do an atomic update that would be much simpler.

Re: Deploy a website using git in Ubuntu

#9
post #7

Is git push atomic? I'm reaching the point with a PHP application where enough people are using it at any one point, every time i push an update (using lftp --mirror over sftp) someone gets caught in the crossfire. My next step is deploying to a temporary folder and swapping symlinks around, but if git/hg can do an atomic update that would be much simpler.

I do not believe that checking out all files in a repository is supposed to be a single atomic action in either git or hg.

Re: Deploy a website using git in Ubuntu

#10
please do not use the suid binary approach, it is something really avoidable in various way. Check the --touch-reload option of uWSGI, you can create an empty file (writable by the user making commits/push) and use it to signal reloading.
Post reply on HN