Gentoo Archives: gentoo-commits

From: Kenton Groombridge <concord@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-apps/miniflux/, www-apps/miniflux/files/
Date: Fri, 06 May 2022 19:33:55
Message-Id: 1651865587.56b29be9ab2c0f44dec89e813761c334a931b1cd.concord@gentoo
1 commit: 56b29be9ab2c0f44dec89e813761c334a931b1cd
2 Author: Kenton Groombridge <concord <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 16 18:27:11 2022 +0000
4 Commit: Kenton Groombridge <concord <AT> gentoo <DOT> org>
5 CommitDate: Fri May 6 19:33:07 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56b29be9
7
8 www-apps/miniflux: new package, add 2.0.36
9
10 Closes: https://github.com/gentoo/gentoo/pull/25048
11 Signed-off-by: Kenton Groombridge <concord <AT> gentoo.org>
12
13 www-apps/miniflux/Manifest | 2 +
14 www-apps/miniflux/files/README.gentoo | 76 +++++++++++++++++++++++++
15 www-apps/miniflux/files/miniflux.conf | 22 ++++++++
16 www-apps/miniflux/files/miniflux.confd | 6 ++
17 www-apps/miniflux/files/miniflux.initd | 16 ++++++
18 www-apps/miniflux/files/miniflux.service | 22 ++++++++
19 www-apps/miniflux/metadata.xml | 11 ++++
20 www-apps/miniflux/miniflux-2.0.36.ebuild | 96 ++++++++++++++++++++++++++++++++
21 8 files changed, 251 insertions(+)
22
23 diff --git a/www-apps/miniflux/Manifest b/www-apps/miniflux/Manifest
24 new file mode 100644
25 index 000000000000..cceb6ac67d55
26 --- /dev/null
27 +++ b/www-apps/miniflux/Manifest
28 @@ -0,0 +1,2 @@
29 +DIST miniflux-2.0.36-deps.tar.xz 151007452 BLAKE2B b21e2a96e9c19341ff1435deb41558b6a1061d7ed136f4164e577949519582e003bfc0ac7f1d60453dbde89d807fbf2707c878dc3c5e0da874ce8f3b6e6682d9 SHA512 f7708d45ad1ed72faf4a32420c990fdeea25258d7caa2a332781590b169bbaa4ead53baaf1024e2e399921182551876a63a3e516a94fdc074995b5cb1d35b9d1
30 +DIST miniflux-2.0.36.tar.gz 548596 BLAKE2B b3f6a85d635eb095f41852d3e618e7e2e2b97e83c776f16b4da9a22a0bb03e9c1815c4ea1a9b841ee8132087067fb7e00a084536f99e004c0863adaf6bbc64b0 SHA512 0c3f1b68e1cb9c4cf5e543847abf3cb34bb56152991a3cd257f4886c7573d17fc177f928574040c2d5b339bf8fe39f9504952f234babe1dcd3b824f8ec95c75a
31
32 diff --git a/www-apps/miniflux/files/README.gentoo b/www-apps/miniflux/files/README.gentoo
33 new file mode 100644
34 index 000000000000..7d236ffadfb6
35 --- /dev/null
36 +++ b/www-apps/miniflux/files/README.gentoo
37 @@ -0,0 +1,76 @@
38 +Introduction
39 +============
40 +
41 +Below are some common tasks needed to administrate a miniflux instance.
42 +
43 +
44 +Create the Database (Example)
45 +=============================
46 +
47 +# Switch to the postgres user
48 +$ su - postgres
49 +
50 +# Create a database user for miniflux
51 +$ createuser -P miniflux
52 +Enter password for new role: ******
53 +Enter it again: ******
54 +
55 +# Create a database for miniflux that belongs to our user
56 +$ createdb -O miniflux miniflux
57 +
58 +# Create the extension hstore as superuser
59 +$ psql miniflux -c 'create extension hstore'
60 +CREATE EXTENSION
61 +
62 +
63 +Create the hstore Extension
64 +===========================
65 +
66 +To create the hstore extension, connect to the miniflux database as any user
67 +with SUPERUSER privileges (like the postgres user) and run:
68 +
69 + CREATE EXTENSION hstore;
70 +
71 +Alternatively, give SUPERUSER privileges to the miniflux user only during the
72 +schema migration:
73 +
74 + ALTER USER miniflux WITH SUPERUSER;
75 + -- Run the migrations (miniflux -migrate)
76 + ALTER USER miniflux WITH NOSUPERUSER;
77 +
78 +
79 +Create the First Admin User
80 +===========================
81 +
82 +The easiest way to create the first admin user with your new miniflux instance
83 +is by running:
84 +
85 + miniflux -create-admin
86 +
87 +Alternatively, set the DATABASE_URL, RUN_MIGRATIONS, CREATE_ADMIN,
88 +ADMIN_USERNAME, and ADMIN_PASSWORD variables in your config file or run miniflux
89 +with these set as environment variables. For example:
90 +
91 + export DATABASE_URL=postgres://miniflux:secretpassword@db/miniflux
92 + export RUN_MIGRATIONS=1
93 + export CREATE_ADMIN=1
94 + export ADMIN_USERNAME=admin
95 + export ADMIN_PASSWORD=n0tAstrongPassw0rd!
96 + miniflux
97 +
98 +
99 +Migrating the Database
100 +======================
101 +
102 +On upgrades, the miniflux database needs to be migrated to the new schema
103 +version. This is handled automatically when you run 'emerge --config miniflux'
104 +but can also be performed using the following manual steps:
105 +
106 +1. Export the DATABASE_URL variable.
107 +2. Disconnect all users by flushing all sessions with 'miniflux -flush-sessions'
108 +3. Stop the miniflux server.
109 +4. Backup your database.
110 +5. Verify that your backup is really working.
111 +6. Run the database migrations with 'miniflux -migrate' or set the environment
112 + variable RUN_MIGRATIONS=1.
113 +7. Start miniflux.
114
115 diff --git a/www-apps/miniflux/files/miniflux.conf b/www-apps/miniflux/files/miniflux.conf
116 new file mode 100644
117 index 000000000000..7a2b217f598c
118 --- /dev/null
119 +++ b/www-apps/miniflux/files/miniflux.conf
120 @@ -0,0 +1,22 @@
121 +# This is a sample configuration file with the most commonly used options needed
122 +# to get started. For a complete list of available options, see the miniflux (1)
123 +# man page or visit https://miniflux.app/docs/configuration.html
124 +
125 +# Toggle debug mode (increase log level).
126 +#DEBUG=off
127 +
128 +# Postgresql connection parameters.
129 +# See https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters
130 +# for more details.
131 +#DATABASE_URL=user=postgres password=postgres dbname=miniflux2 sslmode=disable
132 +
133 +# Address to listen on. Use absolute path for a Unix socket.
134 +#LISTEN_ADDR=127.0.0.1:8080
135 +
136 +# Override LISTEN_ADDR to 0.0.0.0:$PORT (Automatic configuration for PaaS).
137 +# Default is empty.
138 +#PORT=
139 +
140 +# Base URL to generate HTML links and base path for cookies.
141 +# Default is http://localhost/.
142 +#BASE_URL=http://localhost/
143
144 diff --git a/www-apps/miniflux/files/miniflux.confd b/www-apps/miniflux/files/miniflux.confd
145 new file mode 100644
146 index 000000000000..2448e5069f78
147 --- /dev/null
148 +++ b/www-apps/miniflux/files/miniflux.confd
149 @@ -0,0 +1,6 @@
150 +# User and group miniflux server should run as
151 +MINIFLUX_USER=miniflux
152 +MINIFLUX_GROUP=nobody
153 +
154 +# Config file the miniflux server should use
155 +MINIFLUX_CONF=/etc/miniflux.conf
156
157 diff --git a/www-apps/miniflux/files/miniflux.initd b/www-apps/miniflux/files/miniflux.initd
158 new file mode 100644
159 index 000000000000..f8a8c59132da
160 --- /dev/null
161 +++ b/www-apps/miniflux/files/miniflux.initd
162 @@ -0,0 +1,16 @@
163 +#!/sbin/openrc-run
164 +# Copyright 2020-2022 Gentoo Authors
165 +# Distributed under the terms of the GNU General Public License v2
166 +
167 +: ${MINIFLUX_USER:=miniflux}
168 +: ${MINIFLUX_GROUP:=nobody}
169 +: ${MINIFLUX_CONF:=/etc/miniflux.conf}
170 +
171 +name="miniflux daemon"
172 +description="Miniflux Web Server"
173 +command=/usr/bin/miniflux
174 +command_args="${miniflux_args} -c ${MINIFLUX_CONF}"
175 +command_background="true"
176 +command_user="${MINIFLUX_USER}:${MINIFLUX_GROUP}"
177 +error_log="/var/log/${RC_SVCNAME}.err"
178 +pidfile="/run/${RC_SVCNAME}.pid"
179
180 diff --git a/www-apps/miniflux/files/miniflux.service b/www-apps/miniflux/files/miniflux.service
181 new file mode 100644
182 index 000000000000..5480dd01e603
183 --- /dev/null
184 +++ b/www-apps/miniflux/files/miniflux.service
185 @@ -0,0 +1,22 @@
186 +[Unit]
187 +Description=Miniflux Web Server
188 +Documentation=https://miniflux.app/
189 +
190 +After=network.target
191 +Requires=network.target
192 +After=postgresql-9.5.service
193 +After=postgresql-9.6.service
194 +After=postgresql-10.service
195 +After=postgresql-11.service
196 +After=postgresql-12.service
197 +After=postgresql-13.service
198 +After=postgresql-14.service
199 +
200 +[Service]
201 +User=miniflux
202 +ExecStart=/usr/bin/miniflux -c /etc/miniflux.conf
203 +Restart=always
204 +PrivateTmp=true
205 +
206 +[Install]
207 +WantedBy=multi-user.target
208
209 diff --git a/www-apps/miniflux/metadata.xml b/www-apps/miniflux/metadata.xml
210 new file mode 100644
211 index 000000000000..6ae1ef592e60
212 --- /dev/null
213 +++ b/www-apps/miniflux/metadata.xml
214 @@ -0,0 +1,11 @@
215 +<?xml version="1.0" encoding="UTF-8"?>
216 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
217 +<pkgmetadata>
218 + <maintainer type="person">
219 + <email>concord@g.o</email>
220 + <name>Kenton Groombridge</name>
221 + </maintainer>
222 + <upstream>
223 + <remote-id type="github">miniflux/v2</remote-id>
224 + </upstream>
225 +</pkgmetadata>
226
227 diff --git a/www-apps/miniflux/miniflux-2.0.36.ebuild b/www-apps/miniflux/miniflux-2.0.36.ebuild
228 new file mode 100644
229 index 000000000000..7352330614f5
230 --- /dev/null
231 +++ b/www-apps/miniflux/miniflux-2.0.36.ebuild
232 @@ -0,0 +1,96 @@
233 +# Copyright 2020-2022 Gentoo Authors
234 +# Distributed under the terms of the GNU General Public License v2
235 +
236 +EAPI=8
237 +
238 +inherit go-module systemd
239 +
240 +DESCRIPTION="Minimalist and opinionated feed reader"
241 +HOMEPAGE="https://miniflux.app https://github.com/miniflux/v2"
242 +SRC_URI="https://github.com/${PN}/v2/archive/${PV}.tar.gz -> ${P}.tar.gz"
243 +SRC_URI+=" https://dev.gentoo.org/~concord/distfiles/${P}-deps.tar.xz"
244 +
245 +LICENSE="Apache-2.0 BSD BSD-2 MIT"
246 +SLOT="0"
247 +KEYWORDS="~amd64"
248 +
249 +DEPEND="acct-user/miniflux"
250 +RDEPEND="${DEPEND}
251 + >=dev-db/postgresql-9.5
252 +"
253 +
254 +S="${WORKDIR}/v2-${PV}"
255 +
256 +src_compile() {
257 + ego build -ldflags="-s -w -X 'miniflux.app/version.Version=${PV}' " -o miniflux main.go
258 +}
259 +
260 +src_install() {
261 + dobin miniflux
262 +
263 + insinto /etc
264 + doins "${FILESDIR}/${PN}.conf"
265 +
266 + newconfd "${FILESDIR}/${PN}.confd" ${PN}
267 +
268 + newinitd "${FILESDIR}/${PN}.initd" ${PN}
269 + systemd_dounit "${FILESDIR}/${PN}.service"
270 +
271 + fowners miniflux:root /etc/${PN}.conf
272 + fperms o-rwx /etc/${PN}.conf
273 +
274 + local DOCS=(
275 + ChangeLog
276 + README.md
277 + "${FILESDIR}"/README.gentoo
278 + )
279 +
280 + # Makefile has no install target, so call einstalldocs directly
281 + einstalldocs
282 +
283 + doman "${PN}".1
284 +}
285 +
286 +pkg_postinst() {
287 + if [[ -z "${REPLACING_VERSIONS}" ]]; then
288 + # This is a new installation
289 +
290 + echo
291 + elog "Before using miniflux, you must first create and initialize the database"
292 + elog "and enable the hstore extension for it."
293 + elog ""
294 + elog "Afterwards, create your first admin user by running:"
295 + elog " miniflux -create-admin"
296 + else
297 + # This is an existing installation
298 +
299 + echo
300 + elog "If you are upgrading from a previous version, schema migrations must be performed."
301 + elog "To perform the migrations, stop the daemon, backup your database, and run:"
302 + elog " emerge --config =${PF}"
303 + fi
304 +
305 + echo
306 + elog "Please read"
307 + elog ""
308 + elog " ${EPREFIX}/usr/share/doc/${PF}/README.gentoo*"
309 + elog ""
310 + elog "for more information."
311 +}
312 +
313 +pkg_config() {
314 + # To be safe, avoid doing migrations if miniflux is running
315 + if pgrep miniflux; then
316 + die "miniflux appears to be running, refusing to continue."
317 + fi
318 +
319 + # Extract the database URL variable instead of just sourcing the config file
320 + # because miniflux itself may interpret quotes as part of the URL
321 + local DATABASE_URL="$(sed -n 's/^DATABASE_URL=\(.*\)/\1/p' ${EROOT}/etc/${PN}.conf)"
322 + [[ -n "${DATABASE_URL}" ]] || die "Failed getting DATABASE_URL from config file"
323 +
324 + DATABASE_URL="${DATABASE_URL}" "${EROOT}"/usr/bin/miniflux -migrate || die "miniflux -migrate failed. Please check the above output for errors."
325 +
326 + echo
327 + elog "Database migrations complete."
328 +}