5

I am new to the dev-ops side of things, and I've been working to get a Python application packaged into an RPM (using python setup.py bdist_rpm) deployed onto a centos VM via Yum. Chef is used to manage the VM. The Python app will run within a virtualenv, as part of a continuous deployment process.

Should the RPM be smart and self-contained, performing such operations as creating/starting the virtualenv environment, pip-installing required dependencies and then finally configuring an init process (in this case to kick off a uwsgi REST server process for the virtualenv)?

Or, should the Chef recipe manage building the virtualenv and pip-installing dependencies, with the RPM itself doing a simple 'python setup.py install' to load my Python modules into the virtualenv's pythonX.Y/site-packages folder?

A follow on 'yum install/reinstall ' call (say via an automated process) would work for either approach, but the former requires a more complex RPM which may not be 'best practice', correct? The former does allow for a self-contained install that could be more cleanly removed later, and better separates concerns between developer (Python) and dev-ops (Chef). Please advise on what is 'typically' done.

1 Answer 1

0

This Chef cookbook seems to be pretty good. It provides support for what you're looking to do. For what is typically done I can only approach it from a Puppet standpoint, but I don't see a reason to add that sort of complexity to the RPM when it is easily supported by a cookbook. You're simply creating more work for yourself later when you need to make changes, and making it harder for other users to support.

3
  • Thanks Forrest, I am using this plugin, but it seems best for situations where all of your python app (so app + dependencies) is deployed via the pip process into a virtualenv. The devops folks are preferring that we package our app in an RPM (or Debian) package though, so doing a pip install approach for the app's dependencies but using the RPM just to copy our app's Python files into the virtual env's site-packages folder seems awkward to me.
    – woodbon
    Mar 18, 2013 at 3:44
  • Their reasoning is fair, and if that works best for you then you should go for it. My only concern is being burned down the road. I've had a lot of RPMs I had to rip the configuration files out of to put into Puppet so they were easier to manage, and it just resulted in a lot of extra work. I'm not extremely familiar with Chef, but can't you put the configuration file requirements, along with the RPM into a single recipe and make it so that the configuration files require that the RPM has been installed?
    – Forrest
    Mar 18, 2013 at 18:06
  • I believe so Forrest, I'll take a look, thank you.
    – woodbon
    Mar 19, 2013 at 16:55

Not the answer you're looking for? Browse other questions tagged .