diff --git a/.github/workflows/20-pipeline-build-deb-package.yml b/.github/workflows/20-pipeline-build-deb-package.yml index 4e65a6e..90651a3 100644 --- a/.github/workflows/20-pipeline-build-deb-package.yml +++ b/.github/workflows/20-pipeline-build-deb-package.yml @@ -28,7 +28,7 @@ jobs: - name: Check out repository uses: actions/checkout@v3 with: - ref: 'development' + ref: ${{ github.ref }} - name: Set up Docker with Debian image run: | @@ -39,9 +39,13 @@ jobs: docker run --rm -v $(pwd):/workspace -w /workspace debian:latest bash -c " # Install dependencies apt-get update && \ - apt-get install -y python3 python3-setuptools debhelper dh-python python3-pip python3-stdeb python3-proxmoxer python3-requests python3-urllib3 && \ - # Build package - python3 setup.py --command-packages=stdeb.command bdist_deb && \ + apt-get install -y python3 python3-setuptools debhelper dh-python python3-pip python3-stdeb python3-proxmoxer python3-requests python3-urllib3 devscripts python3-all && \ + # Build package using stdeb / setuptools + # python3 setup.py --command-packages=stdeb.command bdist_deb && \ + # Build native package + dpkg-buildpackage -us -uc && \ + mkdir package && \ + mv ../*.deb package/ && \ echo 'OK: Debian package successfully created.' " @@ -49,7 +53,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: debian-package - path: deb_dist/*.deb + path: package/*.deb integration-test-debian: needs: build-package-debian @@ -59,15 +63,16 @@ jobs: uses: actions/download-artifact@v4 with: name: debian-package - path: deb_dist/ + path: package/ - name: Set up Docker with Debian image run: docker pull debian:latest - name: Install and test Debian package in Docker container run: | - docker run --rm -v $(pwd)/deb_dist:/deb_dist -w /deb_dist debian:latest bash -c " + docker run --rm -v $(pwd)/package:/package -w /package debian:latest bash -c " apt-get update && \ - apt-get install -y ./python3-proxlb*.deb && \ + apt-get install -y systemd && \ + apt-get install -y ./proxlb*.deb && \ python3 -c 'import proxlb; print(\"OK: Debian package successfully installed.\")' " \ No newline at end of file diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..47d0234 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +proxlb (1.1.0) stable; urgency=medium + + * Refactored code base of ProxLB. (Closes: #114) + + -- Florian Paul Azim Hoberg Mon, 17 Mar 2025 18:55:02 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..597aa00 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: proxlb +Maintainer: Florian Paul Azim Hoberg +Section: admin +Priority: optional +Standards-Version: 4.5.0 +Build-Depends: debhelper-compat (= 13), dh-python, python3-all, python3-setuptools + +Package: proxlb +Architecture: all +Depends: ${python3:Depends}, ${misc:Depends}, python3-requests, python3-urllib3, python3-proxmoxer, python3-yaml +Description: A DRS alike Load Balancer for Proxmox Clusters + An advanced DRS alike loadbalancer for Proxmox clusters that also supports maintenance modes and affinity/anti-affinity rules. diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..bf0eef8 --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +proxlb /usr/lib/python3/dist-packages/ +service/proxlb.service /lib/systemd/system/ diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..5067e06 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +#DEBHELPER# +if [ "$1" = "configure" ]; then + systemctl enable proxlb.service + systemctl restart proxlb.service || true + + # Create the 'plb' user if it does not exist + if ! id "plb" &>/dev/null; then + useradd --system --home /var/lib/proxlb --create-home --shell /usr/sbin/nologin --group nogroup plb + echo "User 'plb' created." + else + echo "User 'plb' already exists, skipping creation." + fi +fi diff --git a/debian/prerm b/debian/prerm new file mode 100755 index 0000000..227b730 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +#DEBHELPER# +if [ "$1" = "remove" ]; then + systemctl stop proxlb.service || true + systemctl disable proxlb.service || true + + # Remove the 'plb' user if it exists + if id "plb" &>/dev/null; then + userdel --remove plb + echo "User 'plb' removed." + else + echo "User 'plb' does not exist, skipping removal." + fi +fi diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..8f89810 --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f +%: + dh $@ --with python3 --buildsystem=pybuild + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native)