I have a simple Python program, which implements a prometheus exporter, that uses zdaemon via buildout. How can I deploy this using Ansible, while retaining the isolated environment that buildout makes?
I've looked at Ansible's pip module but if I make a package using buildout setup ...
then I just get myscript packaged without the zdaemon stuff that buildout adds.
The way I'm thinking about to do this is to install the 'bin/server' that buildout makes on the server and and run it from cron's @reboot, but of course that won't work directly because buildout uses paths on the build machine in the scripts it generates.
buildout.cfg:
develop = .
parts = server
[server]
recipe = zc.zdaemonrecipe
program = ${buildout:bin-directory}/myscript.py
eggs =
myscript
zdaemon
setup.py:
from setuptools import setup, find_packages
setup(
name="myscript",
version="0.1",
packages=find_packages(),
scripts=['myscript.py'],
install_requires=['prometheus_client']
)