woodpecker-ci / woodpecker

Woodpecker is a simple yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
3.96k stars 352 forks source link

Better deb packaging #1575

Open drequivalent opened 1 year ago

drequivalent commented 1 year ago

Clear and concise description of the problem

Deb packages of Woodpecker contain only a binary which basically makes the deb package near useless.

Suggested solution

Include Systemd service file and the example config into the deb package, so Woodpecker is ready to start out of the box (or at least after quick setup by changing a couple of lines in an already included config file) on the Debian systems.

Alternative

No response

Additional context

Not everyone can use Docker in their setup. LXC containers, for example, don't support Docker.

Validations

johanneskastl commented 1 month ago

I am currently packaging woodpecker for openSUSE (agent, server and CLI). I also found that the RPMs only contain the binary.

I will try to come up with a working systemd unit for agent and server. Once I have them working, I'll post them here and maybe open a PR to add them to the repo.

johanneskastl commented 1 week ago

OK, so my first tests were done using the following systemd unit file woodpecker-server.service:

[Unit]
Description=Woodpecker
Documentation=https://woodpecker-ci.org/docs/administration/server-config
Requires=network.target
After=network.target
ConditionFileNotEmpty=/etc/woodpecker/woodpecker-server.env
ConditionPathExists=/etc/woodpecker/woodpecker-server.env

[Service]
Type=simple
EnvironmentFile=/etc/woodpecker/woodpecker-server.env
User=woodpecker
Group=woodpecker
ExecStart=/usr/bin/woodpecker-server
WorkingDirectory=/var/lib/woodpecker/

[Install]
WantedBy=multi-user.target

This requires to have the "environment variables", e.g. WOODPECKER_HOST in the file /etc/woodpecker/woodpecker-server.env:

WOODPECKER_ADMIN=my-admin
WOODPECKER_HOST=http://192.0.2.13:8000/
WOODPECKER_LOG_LEVEL=debug
[...]

I'll do some more testing and try to connect an agent, but I guess the service file might look similar...