net-im/dendrite: Drop polylith mode including possible breakage

Upstream dropped the polylith mode in 0.12.0 as announced in earlier releases.
This leads to some renaming of files, see e.g. upstream issue 2975[1].

As I've got no OpenRC system or container right now I can't test the modified
OpenRC init scripts. In case you have one feedback either way is appreciated
- confirmations that it's working, bug reports if it failes or even just
suggestions for improvement.

As the ebuild didn't build (failed in the install phase) before this fixup
there is no revbump necessary.

This commit also adds an service file which is based upon upstream's
example for their monolith setup (but with paths in /usr instead of opt)[2].

[1] https://github.com/matrix-org/dendrite/issues/2975
[2] https://github.com/matrix-org/dendrite/blob/main/docs/systemd/monolith-example.service

Signed-off-by: Nils Freydank <nils.freydank@posteo.de>
This commit is contained in:
Nils Freydank 2023-03-21 22:57:02 +01:00
parent c47bfac70f
commit 163ef0a26e
Signed by: nfr
GPG Key ID: 0F1DEAB2D36AD112
4 changed files with 38 additions and 23 deletions

View File

@ -1,9 +1,13 @@
# Copyright 2022-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# TODO:
# 1. fix LICENSE field
# 2. fix init scripts
EAPI="8"
EGO_PN="github.com/matrix-org/dendrite/"
inherit go-module
inherit go-module systemd
COMMIT_ID=""
DESCRIPTION="Matrix homeserver written in go"
@ -20,7 +24,6 @@ fi
SRC_URI+=" https://files.holgersson.xyz/gentoo/distfiles/${P}-deps.tar.xz"
KEYWORDS="~amd64"
# FIXME
LICENSE="Apache-2.0"
SLOT="0"
IUSE=""
@ -54,25 +57,32 @@ src_test() {
}
src_install() {
# Install the binaries from bin and prefix everything with "dendrite".
# Install files from bin, prefix with 'dendrite' if necessary.
newbin bin/create-account dendrite-create-account
dobin bin/dendrite-demo-pinecone
dobin bin/dendrite-demo-yggdrasil
dobin bin/dendrite-monolith-server
dobin bin/dendrite-polylith-multi
dobin bin/dendrite
dobin bin/dendrite-upgrade-tests
# prefix
newbin bin/furl dendrite-furl
newbin bin/generate-config dendrite-generate-config
newbin bin/generate-keys dendrite-generate-keys
newbin bin/resolve-state dendrite-resolve-state
# Provide a sample configuration.
dodir "/etc/dendrite"
insinto /etc/dendrite
doins "${S}/dendrite-sample.monolith.yaml"
doins "${S}/dendrite-sample.polylith.yaml"
doins "${S}/dendrite-sample.yaml"
# Install init scripts for OpenRC
newinitd "${FILESDIR}"/dendrite.initd dendrite
newconfd "${FILESDIR}"/dendrite.confd dendrite
# Install a systemd unit.
systemd_newunit "${FILESDIR}"/dendrite.service dendrite.service
keepdir "/var/log/dendrite"
fowners dendrite:dendrite "/var/log/dendrite"
}

View File

@ -7,9 +7,6 @@ rc_ulimit="-n 4096"
# this should be set to "loopback" which provides the loopback interface.
rc_need="loopback"
# Dendrite mode. Either "monolith" or "polylith".
DENDRITE_MODE="monolith"
# If your configuration of dendrite uses locally running PostgreSQL
# you may want to uncomment the next line
# rc_need="${rc_need} postgresql"
@ -23,5 +20,5 @@ DENDRITE_MODE="monolith"
# rc_need="${rc_need} nginx"
# Additional command-line options. These can be used to set the bind address and port of the monolith server,
# among other things. See `dendrite-monolith-server -help` or `dendrite-polylith-multi -help` for a full list.
# among other things. See `dendrite -help` for a full list.
# DENDRITE_OPTS="-http-bind-address localhost:8008"

View File

@ -13,19 +13,8 @@ else
: ${DENDRITE_RC_CONFIG:=${RC_PREFIX%/}/etc/conf.d/dendrite}
fi
if [ -n "${DENDRITE_BINARY}" ] ; then
: # Do nothing, DENDRITE_BINARY is set externally.
elif [ -z "${DENDRITE_MODE}" -o "${DENDRITE_MODE}" == "monolith" ] ; then
DENDRITE_BINARY=${RC_PREFIX%/}/usr/bin/dendrite-monolith-server
elif [ "${DENDRITE_MODE}" == "polylith" ] ; then
DENDRITE_BINARY:=${RC_PREFIX%/}/usr/bin/dendrite-polylith-multi
else
echo "Unknown dendrite mode: \"${DENDRITE_MODE}\"." >&2
echo "Check the DENDRITE_MODE variable in ${DENDRITE_RC_CONFIG}" >&2
exit 1
fi
command="${RC_PREFIX%/}/usr/bin/dendrite"
command="${DENDRITE_BINARY}"
pidfile="${DENDRITE_PIDFILE}"
command_background=true
command_user="dendrite:dendrite"

View File

@ -0,0 +1,19 @@
[Unit]
Description=Dendrite Matrix Homeserver
After=syslog.target
After=network.target
After=postgresql.service
[Service]
Environment=GODEBUG=madvdontneed=1
RestartSec=2s
Type=simple
User=dendrite
Group=dendrite
ExecStart=/usr/bin/dendrite --config=/etc/dendrite/config.yaml
WorkingDirectory=/var/lib/dendrite/
Restart=always
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target