diff --git a/net-im/dendrite/dendrite-0.12.0.ebuild b/net-im/dendrite/dendrite-0.12.0.ebuild index 88ab0b9..0322f5d 100644 --- a/net-im/dendrite/dendrite-0.12.0.ebuild +++ b/net-im/dendrite/dendrite-0.12.0.ebuild @@ -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" } diff --git a/net-im/dendrite/files/dendrite.confd b/net-im/dendrite/files/dendrite.confd index 7a2f10f..a762157 100644 --- a/net-im/dendrite/files/dendrite.confd +++ b/net-im/dendrite/files/dendrite.confd @@ -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" diff --git a/net-im/dendrite/files/dendrite.initd b/net-im/dendrite/files/dendrite.initd index 5ddc76c..8806a58 100644 --- a/net-im/dendrite/files/dendrite.initd +++ b/net-im/dendrite/files/dendrite.initd @@ -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" diff --git a/net-im/dendrite/files/dendrite.service b/net-im/dendrite/files/dendrite.service new file mode 100644 index 0000000..04c3c93 --- /dev/null +++ b/net-im/dendrite/files/dendrite.service @@ -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