Update systemd service and add EnvironmentFile

This commit is contained in:
Manuel 2021-01-24 20:55:39 +01:00
parent 46489b2f85
commit 4b7cc065d2
Signed by: Manuel
GPG key ID: 4085037435E1F07A
5 changed files with 50 additions and 28 deletions

View file

@ -1,17 +1,19 @@
pkgbase = prometheus-postgresql-exporter pkgbase = prometheus-postgresql-exporter
pkgdesc = Prometheus exporter for PostrgreSQL pkgdesc = Prometheus exporter for PostrgreSQL
pkgver = 0.8.0 pkgver = 0.8.0
pkgrel = 1 pkgrel = 2
url = https://github.com/wrouesnel/postgres_exporter url = https://github.com/wrouesnel/postgres_exporter
arch = x86_64 arch = x86_64
arch = i686
license = Apache license = Apache
makedepends = git makedepends = git
makedepends = go makedepends = go
backup = etc/conf.d/prometheus-postgresql-exporter
source = https://github.com/wrouesnel/postgres_exporter/archive/v0.8.0.tar.gz source = https://github.com/wrouesnel/postgres_exporter/archive/v0.8.0.tar.gz
source = prometheus-postgresql-exporter.service source = prometheus-postgresql-exporter.service
source = prometheus-postgresql-exporter.conf
sha256sums = 27877c9b3aa751c7c1265f39986218f6a2c2b66a126cf348c6cc2f20f5201b02 sha256sums = 27877c9b3aa751c7c1265f39986218f6a2c2b66a126cf348c6cc2f20f5201b02
sha256sums = cda225c236df0e2a6d71c17a5390a92ed5cc7f71b8ca5843590c59fa02cdb135 sha256sums = 5eac41333fb12db676fed18c02156cfdefee957154241b4c724718fd40d23212
sha256sums = 5436ad34fbcd6faab69da8675631f3eb5b89d964682eb23164bf4bb816ad1897
pkgname = prometheus-postgresql-exporter pkgname = prometheus-postgresql-exporter

5
.gitignore vendored
View file

@ -1,5 +0,0 @@
*
!PKGBUILD
!.SRCINFO
!.gitignore
!prometheus-postgresql-exporter.service

View file

@ -1,41 +1,48 @@
# Maintainer: Nils Czernia <nils@czserver.de> # Maintainer: Manuel Hüsers <aur@huesers.de>
# Contributor: Nils Czernia <nils@czserver.de>
pkgname=prometheus-postgresql-exporter pkgname=prometheus-postgresql-exporter
pkgver=0.8.0 pkgver=0.8.0
pkgrel=1 pkgrel=2
pkgdesc="Prometheus exporter for PostrgreSQL" pkgdesc="Prometheus exporter for PostrgreSQL"
arch=('x86_64' 'i686') arch=('x86_64')
url="https://github.com/wrouesnel/postgres_exporter" url="https://github.com/wrouesnel/postgres_exporter"
license=('Apache') license=('Apache')
makedepends=('git' 'go') makedepends=('git' 'go')
backup=('etc/conf.d/prometheus-postgresql-exporter')
source=("https://github.com/wrouesnel/postgres_exporter/archive/v${pkgver}.tar.gz" source=("https://github.com/wrouesnel/postgres_exporter/archive/v${pkgver}.tar.gz"
"prometheus-postgresql-exporter.service") "prometheus-postgresql-exporter.service"
"prometheus-postgresql-exporter.conf")
sha256sums=('27877c9b3aa751c7c1265f39986218f6a2c2b66a126cf348c6cc2f20f5201b02' sha256sums=('27877c9b3aa751c7c1265f39986218f6a2c2b66a126cf348c6cc2f20f5201b02'
'cda225c236df0e2a6d71c17a5390a92ed5cc7f71b8ca5843590c59fa02cdb135') '5eac41333fb12db676fed18c02156cfdefee957154241b4c724718fd40d23212'
'5436ad34fbcd6faab69da8675631f3eb5b89d964682eb23164bf4bb816ad1897')
prepare() { prepare() {
cd "${srcdir}/postgres_exporter-${pkgver}" cd "postgres_exporter-${pkgver}"
export GOPATH="${srcdir}/gopath" export GOPATH="${srcdir}/gopath"
mkdir -p "${GOPATH}/src/github.com/wrouesnel" mkdir -p "${GOPATH}/src/github.com/wrouesnel"
ln -snf "${srcdir}/postgres_exporter-${pkgver}" "${GOPATH}/src/github.com/wrouesnel/postgres_exporter" ln -snf "${srcdir}/postgres_exporter-${pkgver}" "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
} }
build() { build() {
export GOPATH="${srcdir}/gopath" export GOPATH="${srcdir}/gopath"
cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter" cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
go run mage.go binary go run mage.go binary
} }
check() { check() {
export GOPATH="${srcdir}/gopath" export GOPATH="${srcdir}/gopath"
cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter" cd "${GOPATH}/src/github.com/wrouesnel/postgres_exporter"
go run mage.go test go run mage.go test
} }
package() { package() {
cd "${srcdir}/postgres_exporter-${pkgver}" install -Dm644 "prometheus-postgresql-exporter.service" \
"${pkgdir}/usr/lib/systemd/system/prometheus-postgresql-exporter.service"
install -Dm644 "prometheus-postgresql-exporter.conf" \
"${pkgdir}/etc/conf.d/prometheus-postgresql-exporter"
install -Dm755 "postgres_exporter" "${pkgdir}/usr/bin/prometheus_postgresql_exporter" cd "postgres_exporter-${pkgver}"
install -Dm755 "${srcdir}/prometheus-postgresql-exporter.service" "${pkgdir}/usr/lib/systemd/system/prometheus-postgresql-exporter.service" install -Dm755 "postgres_exporter" "${pkgdir}/usr/bin/prometheus_postgresql_exporter"
} }

View file

@ -0,0 +1,2 @@
DATA_SOURCE_NAME=""
POSTGRES_EXPORTER_ARGS=""

View file

@ -2,8 +2,24 @@
Description=Prometheus exporter for PostgreSQL Description=Prometheus exporter for PostgreSQL
After=network.target After=network.target
[Service] EnvironmentFile=-/etc/conf.d/prometheus-postgresql-exporter
ExecStart=/usr/bin/prometheus_postgresql_exporter ExecStart=/usr/bin/prometheus_postgresql_exporter $POSTGRES_EXPORTER_ARGS
Restart=on-failure
DynamicUser=true
ProtectKernelModules=true
ProtectKernelTunables=true
LockPersonality=true
ProtectHostname=true
ProtectHome=true
ProtectClock=true
ProtectControlGroups=true
ProtectKernelLogs=true
PrivateDevices=true
PrivateUsers=true
RestrictRealtime=true
CapabilityBoundingSet=
MemoryDenyWriteExecute=true
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target