1diff --git a/README.md b/README.md
2index aeb52dad969f92a0d436295aa5fc75a4c286184f..70f2fea3776faa738ba3bd30572f18bac0ca69a7 100644
3--- a/README.md
4+++ b/README.md
5@@ -49,3 +49,10 @@ - **version**: 2.2.0
6 - **reason**: Remove edge repository and reddit-nextcloud-importer dependency
7 - **releases**: https://github.com/jsonpickle/jsonpickle/tags
8 - **source**: https://git.alpinelinux.org/aports/tree/testing/py3-jsonpickle?h=master
9+
10+## prometheus-postgres-exporter
11+- **link**: https://github.com/prometheus-community/postgres_exporter
12+- **version**: 0.11.1
13+- **reason**: Remove edge repository and reddit-nextcloud-importer dependency
14+- **releases**: https://github.com/prometheus-community/postgres_exporter/releases
15+- **source**: https://git.alpinelinux.org/aports/tree/testing/prometheus-postgres-exporter?h=master
16diff --git a/apks/prometheus-postgres-exporter/APKBUILD b/apks/prometheus-postgres-exporter/APKBUILD
17new file mode 100644
18index 0000000000000000000000000000000000000000..f323fea6cd1208695ddee63a5151377b842695b2
19--- /dev/null
20+++ b/apks/prometheus-postgres-exporter/APKBUILD
21@@ -0,0 +1,48 @@
22+# Contributor: Alex Denes <caskd@redxen.eu>
23+# Maintainer: Alex Denes <caskd@redxen.eu>
24+pkgname=prometheus-postgres-exporter
25+_pkgname=postgres_exporter
26+pkgver=0.11.1
27+pkgrel=5
28+pkgdesc="Prometheus exporter for PostgreSQL database"
29+url="https://github.com/prometheus-community/postgres_exporter"
30+license="Apache-2.0"
31+arch="x86_64"
32+makedepends="go>=1.14 bash sed"
33+install="$pkgname.pre-install $pkgname.pre-upgrade"
34+subpackages="$pkgname-openrc $pkgname-doc"
35+source="$_pkgname-$pkgver.tar.gz::https://github.com/prometheus-community/postgres_exporter/archive/v$pkgver.tar.gz
36+ postgres-exporter.initd
37+ postgres-exporter.confd
38+ disable-go-race-detector.patch
39+ README.Alpine"
40+builddir="$srcdir/$_pkgname-$pkgver"
41+
42+export GOFLAGS="$GOFLAGS -modcacherw -buildvcs=false"
43+export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
44+export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
45+export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
46+
47+build() {
48+ make build
49+}
50+
51+check() {
52+ make test
53+}
54+
55+package() {
56+ install -Dm755 postgres_exporter "$pkgdir"/usr/bin/postgres_exporter
57+
58+ install -Dm755 "$srcdir"/postgres-exporter.initd "$pkgdir"/etc/init.d/postgres-exporter
59+ install -Dm644 "$srcdir"/postgres-exporter.confd "$pkgdir"/etc/conf.d/postgres-exporter
60+ install -Dm644 "$srcdir"/README.Alpine "$pkgdir"/usr/share/doc/postgres-exporter/README.Alpine
61+}
62+
63+sha512sums="
64+e5bd0ddaac53a8693017a174842831a9bddd1e555b10c1cf61d12d1e9585e1cdaedece378681afdfda46ba6db53aadc10ceecaca0396a330d181d7f06f2665fc postgres_exporter-0.11.1.tar.gz
65+e083183953fee8976765a872b7e21b859a4d907ef650e0320e63da4eff388b6c7f63c82a75cbd14e8f78e06018bae6d67666ebf2451adcbe7261e30f3889125f postgres-exporter.initd
66+14646244988a670caa12eb6cb5e8bea7259c27ec5fe8d89ee6f73675348a66fdfec68cc06304fcf1ce637737c3be7c38e25824e6efe302ed99ced73021d045c3 postgres-exporter.confd
67+0e916a9216fbf21865a3672a1159836993048de1112dc8ddbd4e8283264d7fe12c5a5e2b08adeced2db6d4d35feb799c59eae7e55d010d045e825b4a524ae5e2 disable-go-race-detector.patch
68+d4d8131a2d4787a50f4376cda01f52cc4d40e41088342db7a559e58d464fc92e3110bed542f8622259dd45990e1a95a73806310e1f80c212065e265181e22b32 README.Alpine
69+"
70diff --git a/apks/prometheus-postgres-exporter/README.Alpine b/apks/prometheus-postgres-exporter/README.Alpine
71new file mode 100644
72index 0000000000000000000000000000000000000000..6e0904919e48cf68e01daa5f4cf68e0a25a40868
73--- /dev/null
74+++ b/apks/prometheus-postgres-exporter/README.Alpine
75@@ -0,0 +1,48 @@
76+This document is adapted from README.Debian contained in Debian package.
77+
78+To use the PostgreSQL exporter, you need to connect to the database with
79+superuser (postgres) privileges, or with an user that has been granted enough
80+permissions.
81+
82+The recommended way to do this, is to create a `prometheus` user with no
83+password, and then connect using UNIX domain sockets.
84+
85+To do that, set this connection string in
86+/etc/conf.d/prometheus-postgres-exporter:
87+
88+ DATA_SOURCE_NAME='user=prometheus host=/run/postgresql dbname=postgres'
89+
90+And use psql (doas -u postgres psql) to execute these SQL commands to create
91+the user:
92+
93+ CREATE USER prometheus;
94+ ALTER USER prometheus SET SEARCH_PATH TO prometheus,pg_catalog;
95+
96+ CREATE SCHEMA prometheus AUTHORIZATION prometheus;
97+
98+ CREATE FUNCTION prometheus.f_select_pg_stat_activity()
99+ RETURNS setof pg_catalog.pg_stat_activity
100+ LANGUAGE sql
101+ SECURITY DEFINER
102+ AS $$
103+ SELECT * from pg_catalog.pg_stat_activity;
104+ $$;
105+
106+ CREATE FUNCTION prometheus.f_select_pg_stat_replication()
107+ RETURNS setof pg_catalog.pg_stat_replication
108+ LANGUAGE sql
109+ SECURITY DEFINER
110+ AS $$
111+ SELECT * from pg_catalog.pg_stat_replication;
112+ $$;
113+
114+ CREATE VIEW prometheus.pg_stat_replication
115+ AS
116+ SELECT * FROM prometheus.f_select_pg_stat_replication();
117+
118+ CREATE VIEW prometheus.pg_stat_activity
119+ AS
120+ SELECT * FROM prometheus.f_select_pg_stat_activity();
121+
122+ GRANT SELECT ON prometheus.pg_stat_replication TO prometheus;
123+ GRANT SELECT ON prometheus.pg_stat_activity TO prometheus;
124diff --git a/apks/prometheus-postgres-exporter/disable-go-race-detector.patch b/apks/prometheus-postgres-exporter/disable-go-race-detector.patch
125new file mode 100644
126index 0000000000000000000000000000000000000000..9ba76a3100014cc7f0b839201caa7f54e8951382
127--- /dev/null
128+++ b/apks/prometheus-postgres-exporter/disable-go-race-detector.patch
129@@ -0,0 +1,16 @@
130+--- a/Makefile.common
131++++ b/Makefile.common
132+@@ -111,13 +111,6 @@
133+ PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
134+ TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
135+
136+-ifeq ($(GOHOSTARCH),amd64)
137+- ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
138+- # Only supported on amd64
139+- test-flags := -race
140+- endif
141+-endif
142+-
143+ # This rule is used to forward a target like "build" to "common-build". This
144+ # allows a new "build" target to be defined in a Makefile which includes this
145+ # one and override "common-build" without override warnings.
146diff --git a/apks/prometheus-postgres-exporter/postgres-exporter.confd b/apks/prometheus-postgres-exporter/postgres-exporter.confd
147new file mode 100644
148index 0000000000000000000000000000000000000000..cbc18de585ea2946dd63b430a1af8eca294da893
149--- /dev/null
150+++ b/apks/prometheus-postgres-exporter/postgres-exporter.confd
151@@ -0,0 +1,22 @@
152+# /etc/conf.d/postgres-exporter
153+
154+# Connection string for the PostgreSQL database. You need to either connect as
155+# superuser, or create a user with enough rights, as described in
156+# /usr/share/doc/prometheus-postgres-exporter/README.Alpine
157+
158+# DATA_SOURCE_NAME='postgresql://login:password@hostname:port/'
159+# DATA_SOURCE_NAME='user=prometheus host=/run/postgresql dbname=postgres'
160+
161+DATA_SOURCE_NAME=''
162+
163+# Set the command-line arguments to pass to the server.
164+
165+ARGS=''
166+
167+# Available flags:
168+# --web.listen-address=":9187" Address to listen on for web interface and telemetry.
169+# --web.telemetry-path="/metrics"
170+# Path under which to expose metrics.
171+# --extend.query-path="" Path to custom queries to run.
172+# --log.level="info" Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
173+# --log.format="logger:stderr" Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"
174diff --git a/apks/prometheus-postgres-exporter/postgres-exporter.initd b/apks/prometheus-postgres-exporter/postgres-exporter.initd
175new file mode 100755
176index 0000000000000000000000000000000000000000..8955c15c542f26c706400b6d86a27950cfc18e0a
177--- /dev/null
178+++ b/apks/prometheus-postgres-exporter/postgres-exporter.initd
179@@ -0,0 +1,22 @@
180+#!/sbin/openrc-run
181+supervisor=supervise-daemon
182+
183+command="/usr/bin/postgres_exporter"
184+command_args="$ARGS"
185+command_background="yes"
186+command_user="prometheus:prometheus"
187+
188+export DATA_SOURCE_NAME
189+logdir="/var/log/prometheus"
190+error_log="$logdir/${SVCNAME}.log"
191+pidfile="/var/run/${SVCNAME}.pid"
192+
193+depend() {
194+ need net
195+ after firewall
196+}
197+
198+start_pre() {
199+ checkpath -d -o $command_user -m755 $logdir
200+ checkpath -f -o $command_user -m644 $error_log
201+}
202diff --git a/apks/prometheus-postgres-exporter/prometheus-postgres-exporter.pre-install b/apks/prometheus-postgres-exporter/prometheus-postgres-exporter.pre-install
203new file mode 100755
204index 0000000000000000000000000000000000000000..120995cf35351d604d1aeeafb04ad551607b835a
205--- /dev/null
206+++ b/apks/prometheus-postgres-exporter/prometheus-postgres-exporter.pre-install
207@@ -0,0 +1,6 @@
208+#!/bin/sh
209+
210+addgroup -S prometheus 2>/dev/null
211+adduser -S -D -h /var/lib/prometheus -s /sbin/nologin -G prometheus -g prometheus prometheus 2>/dev/null
212+
213+exit 0
214diff --git a/apks/prometheus-postgres-exporter/prometheus-postgres-exporter.pre-upgrade b/apks/prometheus-postgres-exporter/prometheus-postgres-exporter.pre-upgrade
215new file mode 120000
216index 0000000000000000000000000000000000000000..4bb179f511f2528347b928f4eeb624acfe8c4fe7
217--- /dev/null
218+++ b/apks/prometheus-postgres-exporter/prometheus-postgres-exporter.pre-upgrade
219@@ -0,0 +1 @@
220+prometheus-postgres-exporter.pre-install
221\ No newline at end of file