aboutsummaryrefslogtreecommitdiffstats
path: root/testing/synapse
diff options
context:
space:
mode:
authorLeo <thinkabit.ukim@gmail.com>2019-08-01 17:47:40 -0300
committerLeo <thinkabit.ukim@gmail.com>2019-08-05 09:25:31 -0300
commit1e8d91a75e69816000c301a24b01bf0436e4873b (patch)
tree8c26562863f7cc11f57a30d2fe827e4e2fe125b1 /testing/synapse
parent10b99186fd6f57c06e68339f96069f0354db9d9f (diff)
downloadaports-1e8d91a75e69816000c301a24b01bf0436e4873b.tar.bz2
aports-1e8d91a75e69816000c301a24b01bf0436e4873b.tar.xz
testing/synapse: new aport
https://github.com/matrix-org/synapse Matrix reference homeserver
Diffstat (limited to 'testing/synapse')
-rw-r--r--testing/synapse/APKBUILD79
-rw-r--r--testing/synapse/synapse.confd7
-rw-r--r--testing/synapse/synapse.initd23
-rw-r--r--testing/synapse/synapse.post-install11
-rw-r--r--testing/synapse/synapse.pre-install6
5 files changed, 126 insertions, 0 deletions
diff --git a/testing/synapse/APKBUILD b/testing/synapse/APKBUILD
new file mode 100644
index 0000000000..12d207f641
--- /dev/null
+++ b/testing/synapse/APKBUILD
@@ -0,0 +1,79 @@
+# Contributor: Leo <thinkabit.ukim@gmail.com>
+# Maintainer: Leo <thinkabit.ukim@gmail.com>
+pkgname=synapse
+pkgver=1.2.1
+pkgrel=0
+pkgdesc="Matrix reference homeserver"
+url="https://github.com/matrix-org/synapse"
+arch="noarch"
+license="Apache-2.0"
+depends="
+ python3
+ py3-eliot
+ py3-txacme
+ py3-jsonschema
+ py3-frozendict
+ py3-canonicaljson
+ py3-pynacl
+ py3-idna
+ py3-service_identity
+ py3-twisted
+ py3-openssl
+ py3-yaml
+ py3-asn1
+ py3-asn1-modules
+ py3-daemonize
+ py3-bcrypt
+ py3-pillow
+ py3-sortedcontainers
+ py3-psutil
+ py3-msgpack
+ py3-phonenumbers
+ py3-six
+ py3-attrs
+ py3-netaddr
+ py3-jinja2
+ py3-pymacaroons
+ py3-prometheus-client
+ py3-treq
+ py3-lxml
+ py3-psycopg2
+ py3-signedjson
+ py3-bleach
+ "
+makedepends="py3-setuptools"
+checkdepends="py3-mock py3-parameterized"
+pkgusers="synapse"
+pkggroups="synapse"
+install="$pkgname.pre-install $pkgname.post-install"
+subpackages="$pkgname-openrc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/matrix-org/synapse/archive/v$pkgver.tar.gz
+ synapse.initd
+ synapse.confd
+ "
+
+build() {
+ python3 setup.py build
+}
+
+check() {
+ PYTHONPATH="." trial tests
+}
+
+package() {
+ python3 setup.py install --prefix=/usr --root="$pkgdir"
+
+ install -d -g synapse -o synapse -m775 \
+ "$pkgdir"/etc/synapse \
+ "$pkgdir"/var/lib/synapse
+
+ cp -a synapse/res "$pkgdir"/var/lib/synapse
+ chown -R synapse:synapse "$pkgdir"/var/lib/synapse/res
+
+ install -Dm755 "$srcdir"/synapse.initd "$pkgdir"/etc/init.d/synapse
+ install -Dm644 "$srcdir"/synapse.confd "$pkgdir"/etc/conf.d/synapse
+}
+
+sha512sums="545bea5b0602add81b9344acd508585b78568395e57d189d62cd76618913183e79c6d543a28bc45c908bfc2b39b799418d4daf90e9cd7cf5b681c760feef0657 synapse-1.2.1.tar.gz
+af8b136f4e4f155001f6a6397e77ca21f1aff749895ac99dbe58a45bfb3a15ce021a6f70dc3aea4c789dc81bf8fabf0841af8351ca35d13741db1730a800e156 synapse.initd
+7c022f0e00c8ac363d6d2e003b6389fb06a3934f68390ebac156cb46bc1366585e6b6cda07b15176bc62a00f5bf21bfda153ff5418b07331257a7075102a6f83 synapse.confd"
diff --git a/testing/synapse/synapse.confd b/testing/synapse/synapse.confd
new file mode 100644
index 0000000000..e7667d7ab4
--- /dev/null
+++ b/testing/synapse/synapse.confd
@@ -0,0 +1,7 @@
+# Configuration for /etc/init.d/synapse
+
+# Location of configuration file
+config="/etc/synapse/homeserver.yaml"
+
+# Extra arguments to be passed when starting synapse
+# command_args=""
diff --git a/testing/synapse/synapse.initd b/testing/synapse/synapse.initd
new file mode 100644
index 0000000000..f5b46369f2
--- /dev/null
+++ b/testing/synapse/synapse.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+name="synapse"
+description="Daemon for Synapse, the Matrix reference homeserver"
+
+: ${command_user:="synapse:synapse"}
+: ${config:="/etc/synapse/homesever.yaml"}
+
+command="/usr/bin/python3"
+command_args="-m synapse.app.homeserver --config-path=$config $command_args"
+
+pidfile="/run/${RC_SVCNAME}.pid"
+
+depends() {
+ need net
+}
+
+start_pre() {
+ # /var/lib/synapse needs to be owned by the synapse user and so does the config location
+ checkpath --directory --owner "$command_user" /var/lib/synapse
+ checkpath --file --owner "$command_user" $config
+}
diff --git a/testing/synapse/synapse.post-install b/testing/synapse/synapse.post-install
new file mode 100644
index 0000000000..a3c61c5cfd
--- /dev/null
+++ b/testing/synapse/synapse.post-install
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ ! -e etc/synapse/homeserver.yaml ]; then
+ python3 -m synapse.app.homeserver \
+ --server-name my.domain.name \
+ --config-path /etc/synapse/homeserver.yaml \
+ --generate-config \
+ --report-stats=yes 2>/dev/null
+fi
+
+exit 0
diff --git a/testing/synapse/synapse.pre-install b/testing/synapse/synapse.pre-install
new file mode 100644
index 0000000000..f8f78ace6d
--- /dev/null
+++ b/testing/synapse/synapse.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S synapse 2>/dev/null
+adduser -S -D -H -h /var/lib/synapse -s /sbin/nologin -G synapse -g synapse synapse 2>/dev/null
+
+exit 0