I'm currently packaging a python app with dh_virtualenv, to deploy it on Ubuntu 16.04, daemonized with systemd.
I use the dh_systemd plugin to automatically install the file my_app.service will install the .deb package, but I'd like to run another process in a different service that schedules tasks for my app, using celery.
So, I created another service file, my_app.scheduler.service, but I don't know how to declare this file/app/service in my debian packaging rules, so that while installing the whole package, both services file will be copied and thus will be launched independently.
Do you have any idea to do that ?
Here are my debian conf files for dpkg-buildpackage command :
control
Source: my_app
Section: python
Priority: extra
Maintainer: me
Build-Depends: debhelper (>= 9), python, dh-virtualenv (>= 0.6), dh-systemd (>= 1.5), adduser
Standards-Version: 3.9.5
Package: my_app
Architecture: any
Pre-Depends: dpkg (>= 1.16.1), python2.7, ${misc:Pre-Depends}
Depends: ${python:Depends}, ${misc:Depends}
Description: blabla
rules
#!/usr/bin/make -f
%:
dh $@ --with python-virtualenv --with=systemd
install
etc/my_app.config /etc/
dirs
/var/lib/my_app
/var/log/my_app
And of course the .service files :
my_app.service
[Unit]
Description=APP
[Service]
Type=simple
User=app_user
EnvironmentFile=/etc/my_app.config
ExecStart=/usr/share/python/my_app/bin/gunicorn -w 10 -b 0.0.0.0:6000 -t 600 my_app_python_package:app
[Install]
WantedBy=multi-user.target
my_app.scheduler.service
[Unit]
Description=APP Scheduler
[Service]
Type=simple
User=app_user
EnvironmentFile=/etc/my_app.config
ExecStart=/usr/share/python/my_app/bin/celery worker -A my_app_python_package.tasks
[Install]
WantedBy=multi-user.targetroot
Thanks in advance :)
EDIT / SOLUTION
I finally found an answer. For those who might have the same problem, using dh_installinit solves the case :)