forked from orbit-oss/flask
use pip instead of setup.py in fabric command
This commit is contained in:
parent
14a5a9e554
commit
aa9a994946
1 changed files with 14 additions and 25 deletions
|
|
@ -43,37 +43,26 @@ virtual environment::
|
||||||
env.hosts = ['server1.example.com', 'server2.example.com']
|
env.hosts = ['server1.example.com', 'server2.example.com']
|
||||||
|
|
||||||
def pack():
|
def pack():
|
||||||
# create a new source distribution as tarball
|
# build the package
|
||||||
local('python setup.py sdist --formats=gztar', capture=False)
|
local('python setup.py sdist --formats=gztar', capture=False)
|
||||||
|
|
||||||
def deploy():
|
def deploy():
|
||||||
# figure out the release name and version
|
# figure out the package name and version
|
||||||
dist = local('python setup.py --fullname', capture=True).strip()
|
dist = local('python setup.py --fullname', capture=True).strip()
|
||||||
# upload the source tarball to the temporary folder on the server
|
filename = '%s.tar.gz' % dist
|
||||||
put('dist/%s.tar.gz' % dist, '/tmp/yourapplication.tar.gz')
|
|
||||||
# create a place where we can unzip the tarball, then enter
|
# upload the package to the temporary folder on the server
|
||||||
# that directory and unzip it
|
put('dist/%s' % filename, '/tmp/%s' % filename)
|
||||||
run('mkdir /tmp/yourapplication')
|
|
||||||
with cd('/tmp/yourapplication'):
|
# install the package in the application's virtualenv with pip
|
||||||
run('tar xzf /tmp/yourapplication.tar.gz')
|
run('/var/www/yourapplication/env/bin/pip install /tmp/%s' % filename)
|
||||||
# now setup the package with our virtual environment's
|
|
||||||
# python interpreter
|
# remove the uploaded package
|
||||||
run('/var/www/yourapplication/env/bin/python setup.py install')
|
run('rm -r /tmp/%s' % filename)
|
||||||
# now that all is set up, delete the folder again
|
|
||||||
run('rm -rf /tmp/yourapplication /tmp/yourapplication.tar.gz')
|
# touch the .wsgi file to trigger a reload in mod_wsgi
|
||||||
# and finally touch the .wsgi file so that mod_wsgi triggers
|
|
||||||
# a reload of the application
|
|
||||||
run('touch /var/www/yourapplication.wsgi')
|
run('touch /var/www/yourapplication.wsgi')
|
||||||
|
|
||||||
The example above is well documented and should be straightforward. Here
|
|
||||||
a recap of the most common commands fabric provides:
|
|
||||||
|
|
||||||
- `run` - executes a command on a remote server
|
|
||||||
- `local` - executes a command on the local machine
|
|
||||||
- `put` - uploads a file to the remote server
|
|
||||||
- `cd` - changes the directory on the serverside. This has to be used
|
|
||||||
in combination with the ``with`` statement.
|
|
||||||
|
|
||||||
Running Fabfiles
|
Running Fabfiles
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue