Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
me21 opened this issue Jul 4, 2023 · 5 comments
Open

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

me21 opened this issue Jul 4, 2023 · 5 comments

Comments

@me21
Copy link

me21 commented Jul 4, 2023

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 :)

@ikus060
Copy link

ikus060 commented Jul 31, 2023

@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

@me21
Copy link
Author

me21 commented Jul 31, 2023

Thank you.

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

@ikus060
Copy link

ikus060 commented Jul 31, 2023

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

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

@me21
Copy link
Author

me21 commented Jul 31, 2023

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.

@ikus060
Copy link

ikus060 commented Jul 31, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants