spotify / dh-virtualenv

Python virtualenvs in Debian packages

Home Page:http://dh-virtualenv.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How would I install additional files (e.g. systemd service file)?

me21 opened this issue · comments

Hello,

Firstly, thank you for your project! It packages my application along with virtual environment containing its requirements.

However, how would I make my application start automatically after installation? I would like to install a systemd service file and enable the service for auto start up. I guess I can achieve that by editing the debian subdirectory by hand and adding some entries there. I haven't went down that path yet. Or maybe I can change my setup.py to achieve that effect?..

Anyway, I think it would be nice to provide or document a means to install additional files with dh-virtualenv :)

@me21

You need to create a "package.service" file in your debian folder.

[Unit]
Description=Minarca Web Server
Documentation=https://minarca.org/

[Service]
ExecStart=/opt/minarca-server/bin/minarca-server
User=minarca
Group=minarca

[Install]
WantedBy=multi-user.target

In your rule file add something similar to the following

override_dh_installsystemd:
	dh_installsystemd --restart-after-upgrade

Thank you.

What if I need additional files like configuration, libraries, shell scripts?..

What if I need additional files like configuration, libraries, shell scripts?..

I'm not sure to understand your question. Could you clarify ?

For example, I need to put a config.json to /etc/opt/myprogram/, and script.sh next to Python interpreter in the virtualenv bin subdirectory.

@me21 Copying file are done using debian/package.install file.

Creation of service unit and copying file are both part of Debian build system. Documentation about this is scattered.