Make systemd user configurable and create log directory
This commit is contained in:
parent
2c87a41048
commit
7b58b4a3ed
7
DEBIAN/postinst
Executable file
7
DEBIAN/postinst
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Create the log directory
|
||||
install -d -m 0755 -o root -g root /var/log/pgmon
|
||||
|
||||
exit 0
|
||||
8
Makefile
8
Makefile
@ -25,7 +25,7 @@ deb:
|
||||
docker run --rm \
|
||||
-v .:/src:ro \
|
||||
-v ./$(BUILD_DIR)/deb:/output \
|
||||
--user $(shell id -u):$(shell i -g) \
|
||||
--user $(shell id -u):$(shell id -g) \
|
||||
$(DEB_IMAGE)
|
||||
|
||||
rpm:
|
||||
@ -33,7 +33,7 @@ rpm:
|
||||
docker run --rm \
|
||||
-v .:/src:ro \
|
||||
-v ./$(BUILD_DIR)/rpm:/output \
|
||||
--user $(shell id -u):$(shell i -g) \
|
||||
--user $(shell id -u):$(shell id -g) \
|
||||
$(RPM_IMAGE)
|
||||
|
||||
tgz:
|
||||
@ -61,7 +61,7 @@ install:
|
||||
|
||||
# Install manpage
|
||||
cp manpages/* $(DESTDIR)/usr/share/man/man1/
|
||||
gzip -9 $(DESTDIR)/usr/share/man/man1/$(PACKAGE_NAME).1
|
||||
gzip -f -9 $(DESTDIR)/usr/share/man/man1/$(PACKAGE_NAME).1
|
||||
|
||||
# Install sample config
|
||||
cp sample-config/* $(DESTDIR)/etc/$(PACKAGE_NAME)/
|
||||
@ -103,7 +103,7 @@ ubuntu-install-test:
|
||||
# Debian package creation logic
|
||||
package-deb:
|
||||
$(MAKE) install DESTDIR=/output
|
||||
cp -r DEBIAN /output/
|
||||
cp -r --preserve=mode DEBIAN /output/
|
||||
dpkg-deb -Zgzip --build /output /output/$(PACKAGE_NAME)_$(VERSION).deb
|
||||
|
||||
# RPM package creation logic
|
||||
|
||||
@ -26,9 +26,14 @@ make -C /src install DESTDIR=%{buildroot}
|
||||
/usr/share/man/man1/pgmon.1.gz
|
||||
/etc/pgmon/pgmon.yml
|
||||
/etc/pgmon/pgmon-metrics.yml
|
||||
/etc/pgmon/pgmon-service.conf
|
||||
/lib/systemd/system/pgmon.service
|
||||
/lib/systemd/system/pgmon@.service
|
||||
|
||||
%post
|
||||
mkdir -p -m 0755 /var/log/pgmon
|
||||
chown root:root /var/log/pgmon
|
||||
|
||||
%changelog
|
||||
* Wed Jan 08 2025 James Campbell <james@commandprompt.com> - 1.0-1
|
||||
- Initial RPM release.
|
||||
|
||||
2
sample-config/pgmon-service.conf
Normal file
2
sample-config/pgmon-service.conf
Normal file
@ -0,0 +1,2 @@
|
||||
# Define the system user who will run pgmon
|
||||
SERVICE_USER=postgres
|
||||
@ -5,6 +5,8 @@ Before=pgmon.service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/pgmon/%i-service.conf
|
||||
User=${SERVICE_USER:-postgres}
|
||||
ExecStart=/usr/local/bin/pgmon /etc/pgmon/%i.yml
|
||||
ExecReload=kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
|
||||
Loading…
Reference in New Issue
Block a user