4
Summary: A set of tools for virtualenv
5
Home-page: http://github.com/fireteam/virtualenv-tools
7
Author-email: support@fireteam.net
12
This repository contains scripts we're using at Fireteam for our
13
deployment of Python code. We're using them in combination with
14
salt to build code on one server on a self contained virtualenv
15
and then move that over to the destination servers to run.
17
Why not virtualenv --relocatable?
19
For starters: because it does not work. relocatable is very
20
limited in what it does and it works at runtime instead of
21
making the whole thing actually move to the new location. We
22
ran into a ton of issues with it and it is currently in the
23
process of being phased out.
25
Why would I want to use it?
27
The main reason you want to use this is for build caching. You
28
have one folder where one virtualenv exists, you install the
29
latest version of your codebase and all extensions in there, then
30
you can make the virtualenv relocate to a target location, put it
31
into a tarball, distribute it to all servers and done!
35
First time: create the build cache
37
$ mkdir /tmp/build-cache
38
$ virtualenv --distribute /tmp/build-cache
40
Now every time you build:
42
$ . /tmp/build-cache/bin/activate
43
$ pip install YourApplication
45
Build done, package up and copy to whatever location you want to have
48
Once unpacked on the target server, use the virtualenv tools to
49
update the paths and make the virtualenv magically work in the new
50
location. For instance we deploy things to a path with the
51
hash of the commit in:
53
$ virtualenv-tools --update-path /srv/your-application/<hash>
55
To also update the Python executable in the virtualenv to the
56
system one you can reinitialize it in one go:
58
$ virtualenv-tools --reinitialize /srv/your-application/<hash>
61
Compile once, deploy whereever. Virtualenvs are completely self
62
contained. In order to switch the current version all you need to
63
do is to relink the builds.
68
Classifier: License :: OSI Approved :: BSD License
69
Classifier: Programming Language :: Python