[Openstack-operators] Packaging Virtualenvs

Kris G. Lindgren klindgren at godaddy.com
Thu Jun 23 21:34:04 UTC 2016


When we did this within CentOS6 with the python 2.7 software collection.  When nova called into nova-rootwrap, rootwrap was called without any of the software collection or venv stuff activated. So we had to move rootwrap to rootwrap-real and create a shell script that did the needful (activate the software collection and activate the venv, then call rootwrap-real).

Other than that we just modified the normal upstart scripts to activate the venv before executing the service like normal.  Under systemd one would do the same.  We never packaged the openstack clients into venv's, but if we did one could just add the correct stuff to your keystonerc file.
___________________________________________________________________
Kris Lindgren
Senior Linux Systems Engineer
GoDaddy







On 6/23/16, 3:12 PM, "Doug Hellmann" <doug at doughellmann.com> wrote:

>Excerpts from Silence Dogood's message of 2016-06-23 15:45:34 -0400:
>> I know from conversations that a few folks package their python apps as
>> distributable virtualenvs.   spotify created dh-virtualenv for this.  you
>> can do it pretty simply by hand.
>> 
>> I built a toolchain for building rpms as distributable virtualenvs and that
>> works really well.
>> 
>> What I'd like to do is make it so that every app that's built as a
>> virtualenv gets setup to automatically execute at call time in their
>> virtualenv.
>> 
>> I see two options:
>> 
>> 1)  Dynamically generate a wrapper script during build and put it in the
>> RPM.  Call the wrapper.
>> 
>> 2)  Created a dependency global module ( as an rpm ) set it as a
>> dependency.  And basically it'd be an autoexecuting import that
>> instantiates the virtualenv.  it would probably know all it needs to
>> because I am building all my packages to an internal standard.  Then when
>> building the APP rpm all I need to do is inject an import into the import
>> chain if it's being built as a virtualenv.  Then I have what are
>> effectively statically compiled python apps.
>> 
>> I like 2.  But 1 isn't very bad.  Both are a little hokey.
>> 
>> Was curious if folks might have a preference, or a better idea.
>> 
>> Thanks.
>> 
>> Matt
>
>I'm not sure what you mean by a "wrapper script".  If you run the
>Python console script from within the virtualenv you've packaged,
>you shouldn't need to do anything to "activate" that environment
>separately because it should have the correct shebang line.
>
>Are you seeing different behavior?
>
>Doug
>
>_______________________________________________
>OpenStack-operators mailing list
>OpenStack-operators at lists.openstack.org
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators


More information about the OpenStack-operators mailing list