0

I'm trying to deploy an "app" written on top off web.py with fabric on a VPS running Arch Linux.

But I'm confused about best pratices regarding Fabric and virtualenv: which user should I use to create the virtualenv and how do I do that using Fabric?

My incomplete fabfile is below.

fabfile.py:

from fabric.api import cd, env, local, put, run, sudo

env.project = 'project_name'


def setup():
    sudo('pacman -S python2-virtualenv python-virtualenvwrapper')


def pack():
    local('python setup.py sdist --formats=gztar', capture=False)


def deploy():
    dist = local('python setup.py --fullname', capture=True).strip()
    put('dist/%s.tar.gz' % dist, '/tmp/%s.tar.gz' % dist)
    with cd('/tmp'):
        run('tar xzf /tmp/%s.tar.gz' % dist)
    run('rm -rf /tmp/%s.tar.gz' % dist)

1 Answers1

0

Preferably not root. Any other user that has permission to read and write the project directory and subdirectories. You could create a new User once and use it henceforth.

Bibhas Debnath
  • 14,559
  • 17
  • 68
  • 96
  • Thanks for your answer. What user is it best to create, then? (name, homedir). It seems to me that the http user is designed to "serve" files via http having homedir /srv/http, but it has no shell and no password (for security I guess) so I can't run commands with it with fabric. –  May 08 '13 at 23:37
  • Create a user with any username you like. Here, look under the `User Management` header - https://wiki.archlinux.org/index.php/Users_and_Groups. `-m` option will create the home directory for you. – Bibhas Debnath May 08 '13 at 23:39
  • I might not have been clear, it's not the username I'm most concerned about, it's the purpose of the http user and the eventual new user I might create (shouldn't I be using the http user for this given it's /srv/http home?) and how I would go about creating the virtualenv with fabric in general. –  May 08 '13 at 23:43
  • The `http` user is for running the server software, Apache. It's created by default. But it doesn't have much permission outside it's home directory. You *can* use it I think, as long as the `http` user has read and write permission to your project directory. – Bibhas Debnath May 08 '13 at 23:48