More work on getting packaging working
This commit is contained in:
parent
a21a4355e5
commit
292c6bfd80
16
Makefile
16
Makefile
@ -1,13 +1,15 @@
|
|||||||
PACKAGE_NAME := pgmon
|
PACKAGE_NAME := pgmon
|
||||||
VERSION := 1.0
|
VERSION := 1.0
|
||||||
|
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
|
|
||||||
DEB_IMAGE := debian-package-builder
|
DEB_IMAGE := debian-package-builder
|
||||||
RPM_IMAGE := rpm-package-builder
|
RPM_IMAGE := rpm-package-builder
|
||||||
|
|
||||||
SCRIPT := src/$(PACKAGE_NAME).py
|
SCRIPT := src/$(PACKAGE_NAME).py
|
||||||
|
|
||||||
# Top-level targets
|
# Top-level targets
|
||||||
.PHONY: all clean deb rpm
|
.PHONY: all clean deb rpm test
|
||||||
|
|
||||||
all: deb rpm
|
all: deb rpm
|
||||||
|
|
||||||
@ -28,6 +30,8 @@ rpm:
|
|||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD_DIR)
|
rm -rf $(BUILD_DIR)
|
||||||
|
|
||||||
|
test:
|
||||||
|
cd src ; python3 -m unittest
|
||||||
|
|
||||||
# Container targets
|
# Container targets
|
||||||
.PHONY: docker deb-package-image rpm-package-image
|
.PHONY: docker deb-package-image rpm-package-image
|
||||||
@ -56,22 +60,22 @@ package-rpm:
|
|||||||
cp RPM/$(PACKAGE_NAME).spec /output/SPECS/
|
cp RPM/$(PACKAGE_NAME).spec /output/SPECS/
|
||||||
rpmbuild --define '_topdir /output' \
|
rpmbuild --define '_topdir /output' \
|
||||||
--define 'version $(VERSION)' \
|
--define 'version $(VERSION)' \
|
||||||
-ba /output/SPECS/$(PACKAGE_NAME).spec
|
-bb /output/SPECS/$(PACKAGE_NAME).spec
|
||||||
cp /output/rpm/RPMS/x86_64/*.rpm /output/
|
cp /output/RPMS/x86_64/*.rpm /output/
|
||||||
|
|
||||||
# Install into the specified destination directory (used inside the packaging systems)
|
# Install into the specified destination directory (used inside the packaging systems)
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# Set up directories
|
# Set up directories
|
||||||
mkdir -p $(DESTDIR)/usr/bin
|
mkdir -p $(DESTDIR)/usr/local/bin
|
||||||
mkdir -p $(DESTDIR)/usr/share/man/man1
|
mkdir -p $(DESTDIR)/usr/share/man/man1
|
||||||
mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME)
|
mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME)
|
||||||
mkdir -p $(DESTDIR)/lib/systemd/system
|
mkdir -p $(DESTDIR)/lib/systemd/system
|
||||||
|
|
||||||
# Install script
|
# Install script
|
||||||
cp script.py $(DESTDIR)/usr/bin/$(PACKAGE_NAME)
|
cp $(SCRIPT) $(DESTDIR)/usr/local/bin/$(PACKAGE_NAME)
|
||||||
chmod 755 $(DESTDIR)/usr/bin/$(PACKAGE_NAME)
|
chmod 755 $(DESTDIR)/usr/local/bin/$(PACKAGE_NAME)
|
||||||
|
|
||||||
# Install manpage
|
# Install manpage
|
||||||
cp manpages/* $(DESTDIR)/usr/share/man/man1/
|
cp manpages/* $(DESTDIR)/usr/share/man/man1/
|
||||||
|
|||||||
@ -13,8 +13,10 @@ Requires: python3, python3-psycopg2, systemd
|
|||||||
A bridge to sit between monitoring tools and PostgreSQL
|
A bridge to sit between monitoring tools and PostgreSQL
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
|
# Do nothing since we don't need a tarball
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
# Do nothing since we have nothing to build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make -C /src install DESTDIR=%{buildroot}
|
make -C /src install DESTDIR=%{buildroot}
|
||||||
|
|||||||
0
manpages/pgmon.1
Normal file
0
manpages/pgmon.1
Normal file
14
systemd/pgmon.service
Normal file
14
systemd/pgmon.service
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# This is a meta unit modeled after the PostgreSQL unit file from the Debian
|
||||||
|
# packages.
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=PostgreSQL monitoring bridge
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/bin/true
|
||||||
|
ExecReload=/bin/true
|
||||||
|
RemainAfterExit=on
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@ -1,11 +1,11 @@
|
|||||||
[unit]
|
[unit]
|
||||||
Description=PostgreSQL Monitoring Bridge
|
Description=PostgreSQL Monitoring Bridge
|
||||||
#PartOf=pgmon.service
|
PartOf=pgmon.service
|
||||||
#Before=pgmon.service
|
Before=pgmon.service
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/local/bin/pgmon.py /etc/pgmon/%i.cfg
|
ExecStart=/usr/local/bin/pgmon /etc/pgmon/%i.yml
|
||||||
ExecReload=kill -HUP $MAINPID
|
ExecReload=kill -HUP $MAINPID
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
Type=exec
|
Type=exec
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user