From 438af50e1b564e5537a5eff3b951dacbec6414ad Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Fri, 2 Jun 2017 13:42:29 -0400 Subject: [PATCH] Initial import (#1438842) Signed-off-by: Jeremy Cline --- .gitignore | 1 + ...trict-version-requirement-for-pynacl.patch | 26 +++ matrix-synapse.spec | 155 ++++++++++++++++++ sources | 1 + synapse.sysconfig | 12 ++ 5 files changed, 195 insertions(+) create mode 100644 0001-Remove-the-strict-version-requirement-for-pynacl.patch create mode 100644 matrix-synapse.spec create mode 100644 synapse.sysconfig diff --git a/.gitignore b/.gitignore index e69de29..ec9b30d 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/synapse-v0.19.3.tar.gz diff --git a/0001-Remove-the-strict-version-requirement-for-pynacl.patch b/0001-Remove-the-strict-version-requirement-for-pynacl.patch new file mode 100644 index 0000000..d8ba562 --- /dev/null +++ b/0001-Remove-the-strict-version-requirement-for-pynacl.patch @@ -0,0 +1,26 @@ +From 992a2483be7778954fa5004d74a9fb1d93c5e2bc Mon Sep 17 00:00:00 2001 +From: Jeremy Cline +Date: Mon, 3 Apr 2017 21:21:28 +0000 +Subject: [PATCH] Remove the strict version requirement for pynacl + +Signed-off-by: Jeremy Cline +--- + synapse/python_dependencies.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py +index 7817b0cd..3f17f47a 100644 +--- a/synapse/python_dependencies.py ++++ b/synapse/python_dependencies.py +@@ -22,7 +22,7 @@ REQUIREMENTS = { + "unpaddedbase64>=1.1.0": ["unpaddedbase64>=1.1.0"], + "canonicaljson>=1.0.0": ["canonicaljson>=1.0.0"], + "signedjson>=1.0.0": ["signedjson>=1.0.0"], +- "pynacl==0.3.0": ["nacl==0.3.0", "nacl.bindings"], ++ "pynacl": ["nacl", "nacl.bindings"], + "service_identity>=1.0.0": ["service_identity>=1.0.0"], + "Twisted>=16.0.0": ["twisted>=16.0.0"], + "pyopenssl>=0.14": ["OpenSSL>=0.14"], +-- +2.12.2 + diff --git a/matrix-synapse.spec b/matrix-synapse.spec new file mode 100644 index 0000000..3220d59 --- /dev/null +++ b/matrix-synapse.spec @@ -0,0 +1,155 @@ +%global srcname synapse + +Name: matrix-%{srcname} +Version: 0.19.3 +Release: 4%{?dist} +Summary: A Matrix reference homeserver written in Python using Twisted +License: ASL 2.0 +URL: https://github.com/matrix-org/%{srcname} +Source0: %{url}/archive/v%{version}/%{srcname}-v%{version}.tar.gz +Source1: synapse.sysconfig +# Upstream pins its version of pynacl: +# https://github.com/matrix-org/synapse/issues/1642 +Patch0: 0001-Remove-the-strict-version-requirement-for-pynacl.patch +BuildArch: noarch + +BuildRequires: python2-devel +BuildRequires: python2-setuptools +BuildRequires: python-sphinx +BuildRequires: py-bcrypt +BuildRequires: pyOpenSSL >= 0.14 +BuildRequires: python-bleach >= 1.4.2 +BuildRequires: python-blist +BuildRequires: python-canonicaljson >= 1.0.0 +BuildRequires: python-daemonize +BuildRequires: python-frozendict >= 0.4 +BuildRequires: python-jinja2 >= 2.8 +BuildRequires: python-jsonschema +BuildRequires: python-lxml +BuildRequires: python-matrix-synapse-ldap3 >= 0.1 +BuildRequires: python-msgpack +BuildRequires: python-netaddr >= 0.7.18 +BuildRequires: python-pillow +BuildRequires: python-psutil >= 2.0.0 +BuildRequires: python-pyasn1 +BuildRequires: python-pydenticon +BuildRequires: python-pymacaroons-pynacl +BuildRequires: python-pynacl >= 0.3.0 +BuildRequires: python-pysaml2 >= 3.0.0 +BuildRequires: python-service-identity >= 1.0.0 +BuildRequires: python-signedjson >= 1.0.0 +BuildRequires: python-systemd +BuildRequires: python-twisted >= 16.0.0 +BuildRequires: python-ujson +BuildRequires: python-unpaddedbase64 >= 1.1.0 +BuildRequires: python-yaml +BuildRequires: systemd +BuildRequires: python-mock + +Requires: py-bcrypt +Requires: pyOpenSSL >= 0.14 +Requires: python-bleach >= 1.4.2 +Requires: python-blist +Requires: python-canonicaljson >= 1.0.0 +Requires: python-daemonize +Requires: python-frozendict >= 0.4 +Requires: python-jinja2 >= 2.8 +Requires: python-jsonschema +Requires: python-lxml +Requires: python-matrix-synapse-ldap3 >= 0.1 +Requires: python-msgpack +Requires: python-netaddr >= 0.7.18 +Requires: python-pillow +Requires: python-psutil >= 2.0.0 +Requires: python-pyasn1 +Requires: python-pydenticon +Requires: python-pymacaroons-pynacl +Requires: python-pynacl >= 0.3.0 +Requires: python-pysaml2 >= 3.0.0 +Requires: python-service-identity >= 1.0.0 +Requires: python-signedjson >= 1.0.0 +Requires: python-systemd +Requires: python-twisted >= 16.0.0 +Requires: python-ujson +Requires: python-unpaddedbase64 >= 1.1.0 +Requires: python-yaml +Requires(pre): shadow-utils +Requires: systemd + + +%description +Matrix is an ambitious new ecosystem for open federated Instant Messaging and +VoIP. Synapse is a reference "homeserver" implementation of Matrix from the +core development team at matrix.org, written in Python/Twisted. It is intended +to showcase the concept of Matrix and let folks see the spec in the context of +a coded base and let you run your own homeserver and generally help bootstrap +the ecosystem. + + +%prep +%autosetup -p1 -n %{srcname}-%{version} + +# We don't support the built-in client so remove all the bundled JS. +rm -rf synapse/static + + +%build +%py2_build + + +%install +%py2_install + +install -p -D -T -m 0644 contrib/systemd/log_config.yaml %{buildroot}%{_sysconfdir}/synapse/log_config.yaml +install -p -D -T -m 0644 contrib/systemd/synapse.service %{buildroot}%{_unitdir}/synapse.service +install -p -D -T -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/synapse +install -p -d -m 755 %{buildroot}/%{_sharedstatedir}/synapse + + +%check +PYTHONPATH=. trial tests + + +%pre +getent group synapse >/dev/null || groupadd -r synapse +getent passwd synapse >/dev/null || \ + useradd -r -g synapse -d %{_sharedstatedir}/synapse -s /sbin/nologin \ + -c "The user for the Synapse Matrix server" synapse +exit 0 + +%post +%systemd_post synapse.service + +%preun +%systemd_preun synapse.service + +%postun +%systemd_postun_with_restart synapse.service + + +%files +%license LICENSE +%doc *.rst +%dir %{_sysconfdir}/synapse +%config(noreplace) %{_sysconfdir}/synapse/* +%config(noreplace) %{_sysconfdir}/sysconfig/synapse +%{python2_sitelib}/synapse/ +%{python2_sitelib}/matrix_synapse*.egg-info/ +%{_bindir}/* +%{_unitdir}/synapse.service +%attr(755,synapse,synapse) %dir %{_sharedstatedir}/synapse + + +%changelog +* Tue May 30 2017 Jeremy Cline - 0.19.3-4 +- use _sharedstatedir rather than _localstatedir + +* Wed May 17 2017 Jeremy Cline - 0.19.3-3 +- Remove bundled JS +- Fix some typos in the summary and description + +* Tue Apr 04 2017 Jeremy Cline - 0.19.3-2 +- Remove the duplicate requirement on pysaml + +* Tue Mar 28 2017 Jeremy Cline - 0.19.3-1 +- Initial package diff --git a/sources b/sources index e69de29..a8becd9 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (synapse-v0.19.3.tar.gz) = ebfcac4cc5f0d0f6e54d294cc91bb3c948e94feaa0877d08dfa5d3aab7abbbf181f47426fa0e3530ae31a3df1c6d344f7df00bceb8afb80e75032ea91b17d0b0 diff --git a/synapse.sysconfig b/synapse.sysconfig new file mode 100644 index 0000000..10770e7 --- /dev/null +++ b/synapse.sysconfig @@ -0,0 +1,12 @@ +# Synapse's architecture is quite RAM hungry currently - we deliberately cache +# a lot of recent room data and metadata in RAM in order to speed up common +# requests. We'll improve this in future, but for now the easiest way to either +# reduce the RAM usage (at the risk of slowing things down) is to set the +# almost-undocumented SYNAPSE_CACHE_FACTOR environment variable. Roughly +# speaking, a SYNAPSE_CACHE_FACTOR of 1.0 will max out at around 3-4GB of +# resident memory - this is what we currently run the matrix.org on. The +# default setting is currently 0.1, which is probably around a ~700MB +# footprint. You can dial it down further to 0.02 if desired, which targets +# roughly ~512MB. Conversely you can dial it up if you need performance for +# lots of users and have a box with a lot of RAM. +SYNAPSE_CACHE_FACTOR=0.1