forked from pool/python-HyperKitty
Accepting request 856030 from devel:languages:python:mailman
- Added hyperkitty-qcluster.service - Added hyperkitty-runjob.service and hyperkitty-runjob.timer - Create a HyperKitty-web package with webroot files - Create a HyperKitty-web-uwsgi with uwsgi configuration - Added hyperkitty-settings.patch * Sets the FHS default paths - Added hyperkitty-fix-tests.patch * Make migration compatible with django >= 3.1 - Added rpmlint config OBS-URL: https://build.opensuse.org/request/show/856030 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-HyperKitty?expand=0&rev=5
This commit is contained in:
113
README.SUSE.md
Normal file
113
README.SUSE.md
Normal file
@@ -0,0 +1,113 @@
|
||||
HyperKitty
|
||||
==========
|
||||
|
||||
## Configuration
|
||||
|
||||
The web application is configured in `/etc/hyperkitty/settings_local.py` which
|
||||
is included by the default configuration in
|
||||
/srv/www/webapps/mailman/hyperkitty/settings.py.
|
||||
|
||||
1. Optional: Change the default secret for the application:
|
||||
We already created one, but feel free to replace with a stronger
|
||||
alternative.
|
||||
|
||||
`/etc/hyperkitty/settings_local.py`:
|
||||
|
||||
SECRET_KEY = 'something-very-secret'
|
||||
|
||||
2. Make sure to disable debugging when running in production:
|
||||
|
||||
`/etc/hyperkitty/settings_local.py`:
|
||||
|
||||
DEBUG = False
|
||||
|
||||
3. Add a valid email configuration
|
||||
|
||||
`/etc/postorius/settings_local.py`:
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
EMAIL_HOST = 'localhost'
|
||||
EMAIL_PORT = 25
|
||||
EMAIL_HOST_USER = <username>
|
||||
EMAIL_HOST_PASSWORD = <password>
|
||||
|
||||
4. The valid hosts or domain names for the application need to be defined:
|
||||
|
||||
`/srv/www/webapps/mailman/postorius/settings_local.py`:
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'localhost',
|
||||
'lists.example.com'
|
||||
]
|
||||
|
||||
5. To connect with a running mailman instance's REST API, configuration options
|
||||
have to be added to hyperkitty's configuration.
|
||||
|
||||
`/etc/hyperkitty/settings_local.py`:
|
||||
|
||||
MAILMAN_REST_API_URL = 'http://localhost:8001'
|
||||
MAILMAN_REST_API_USER = 'rest_admin'
|
||||
MAILMAN_REST_API_PASS = 'rest_admin_password'
|
||||
|
||||
6. To configure the archive integration with a mailman instance first setup the
|
||||
integration with hyperkitty on mailman's side and then configure hyperkitty
|
||||
to accept those connections:
|
||||
|
||||
`/etc/hyperkitty/settings_local.py`:
|
||||
|
||||
MAILMAN_ARCHIVER_KEY = 'SecretArchiverAPIKey'
|
||||
MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1')
|
||||
|
||||
7. Setup the database (optionally configure e.g. postgres first,
|
||||
default: sqlite3)
|
||||
|
||||
hyperkitty-manage migrate
|
||||
|
||||
8. Populate the database with default data (when setting up for the first time):
|
||||
|
||||
hyperkitty-manage loaddata
|
||||
|
||||
9. Create admin user
|
||||
|
||||
hyperkitty-manage createsuperuser
|
||||
|
||||
10. Enable HyperKitty async tasks runner
|
||||
|
||||
systemctl enable --now hyperkitty-qcluster.service
|
||||
|
||||
11. Enable HyperKitty runjob timers
|
||||
|
||||
systemctl enable hyperkitty-runjob-minutely.service
|
||||
systemctl enable hyperkitty-runjob-quarter-hourly.service
|
||||
systemctl enable hyperkitty-runjob-hourly.service
|
||||
systemctl enable hyperkitty-runjob-daily.service
|
||||
systemctl enable hyperkitty-runjob-weekly.service
|
||||
systemctl enable hyperkitty-runjob-monthly.service
|
||||
systemctl enable hyperkitty-runjob-yearly.service
|
||||
|
||||
## Apache2
|
||||
|
||||
To configure hyperkitty with Apache and uwsgi, just add the follwing lines to a vhost:
|
||||
|
||||
ProxyPassMatch ^/static !
|
||||
ProxyPass / unix:/run/uwsgi/uwsgi-hyperkitty.sock|uwsgi://localhost/
|
||||
<Directory /srv/www/webapps/mailman/hyperkitty>
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
## Xapian search backend
|
||||
|
||||
Hyperkitty can make use of a Xapian based search backend.
|
||||
|
||||
`/etc/hyperkitty/settings_local.py`:
|
||||
|
||||
HAYSTACK_CONNECTIONS = {
|
||||
'default': {
|
||||
'ENGINE': 'xapian_backend.XapianEngine',
|
||||
'PATH': "/var/lib/hyperkitty/data/xapian_index",
|
||||
},
|
||||
}
|
||||
|
||||
Make sure to create the search index for all lists afterwards.
|
||||
|
||||
hyperkitty-manage update_index
|
||||
78
hyperkitty-fix-tests.patch
Normal file
78
hyperkitty-fix-tests.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
From 0e46371f0f2aab8618aa2852ea6f63c245e16927 Mon Sep 17 00:00:00 2001
|
||||
From: David Runge <dave@sleepmap.de>
|
||||
Date: Sat, 7 Nov 2020 01:14:04 +0000
|
||||
Subject: [PATCH] Make migration compatible with django >= 3.1
|
||||
|
||||
hyperkitty/migrations/0013_mailinglist_id_1.py:
|
||||
With django >= 3.1 the state.models.fields are represented as dicts,
|
||||
while with django < 3.1 they are represented as lists.
|
||||
Accomodate both use-cases by checking the type of the fields before
|
||||
trying to add to them.
|
||||
|
||||
Fixes #329
|
||||
---
|
||||
.../migrations/0013_mailinglist_id_1.py | 33 ++++++++++--
|
||||
setup.py | 2 +-
|
||||
tox.ini | 5 +-
|
||||
4 files changed, 62 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/hyperkitty/migrations/0013_mailinglist_id_1.py b/hyperkitty/migrations/0013_mailinglist_id_1.py
|
||||
index f460daf9..d55afed5 100644
|
||||
--- a/hyperkitty/migrations/0013_mailinglist_id_1.py
|
||||
+++ b/hyperkitty/migrations/0013_mailinglist_id_1.py
|
||||
@@ -16,10 +16,35 @@ class MailingListPrimaryKey(migrations.AlterField):
|
||||
)
|
||||
|
||||
def state_forwards(self, app_label, state):
|
||||
- state.models[app_label, self.model_name_lower].fields.insert(0, (
|
||||
- "id", models.AutoField(
|
||||
- name="id", auto_created=True, primary_key=True, serialize=False,
|
||||
- verbose_name='ID')))
|
||||
+ # django < 3.1
|
||||
+ if type(state.models[app_label, self.model_name_lower].fields) is list:
|
||||
+ state.models[app_label, self.model_name_lower].fields.insert(
|
||||
+ 0,
|
||||
+ (
|
||||
+ "id",
|
||||
+ models.AutoField(
|
||||
+ name="id",
|
||||
+ auto_created=True,
|
||||
+ primary_key=True,
|
||||
+ serialize=False,
|
||||
+ verbose_name='ID'
|
||||
+ )
|
||||
+ )
|
||||
+ )
|
||||
+ # django >= 3.1
|
||||
+ else:
|
||||
+ state.models[app_label, self.model_name_lower].fields.update(
|
||||
+ {
|
||||
+ "id":
|
||||
+ models.AutoField(
|
||||
+ name="id",
|
||||
+ auto_created=True,
|
||||
+ primary_key=True,
|
||||
+ serialize=False,
|
||||
+ verbose_name='ID',
|
||||
+ )
|
||||
+ }
|
||||
+ )
|
||||
super(MailingListPrimaryKey, self).state_forwards(app_label, state)
|
||||
|
||||
def database_forwards(self, app_label, schema_editor, from_state, to_state):
|
||||
diff --git a/setup.py b/setup.py
|
||||
index cb058659..0968c676 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -37,7 +37,7 @@ with open('hyperkitty/__init__.py') as fp:
|
||||
|
||||
# Requirements
|
||||
REQUIRES = [
|
||||
- "Django>=2.0,<3.1",
|
||||
+ "Django>=2.2,<3.2",
|
||||
"django_mailman3>=1.3.3",
|
||||
"django-gravatar2>=1.0.6",
|
||||
"djangorestframework>=3.0.0",
|
||||
--
|
||||
GitLab
|
||||
|
||||
3
hyperkitty-manage.sh
Normal file
3
hyperkitty-manage.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo -u hyperkitty-admin /usr/bin/python3 /srv/www/webapps/mailman/hyperkitty/manage.py "$@"
|
||||
31
hyperkitty-permissions.sh
Normal file
31
hyperkitty-permissions.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
LOG_DIR="/var/log/hyperkitty"
|
||||
LIB_DIR="/var/lib/hyperkitty"
|
||||
DATA_DIR="$LIB_DIR/data/"
|
||||
|
||||
setfacl -R --no-mask -m u:hyperkitty-admin:rwX ${DATA_DIR}
|
||||
setfacl -R -d --no-mask -m u:hyperkitty-admin:rwX ${DATA_DIR}
|
||||
|
||||
chown hyperkitty-admin:hyperkitty-admin ${LIB_DIR}
|
||||
chmod u=rwX,g=rwX,o= ${LIB_DIR}
|
||||
|
||||
chown -R hyperkitty:hyperkitty ${DATA_DIR}
|
||||
chmod -R u=rwX,g=rwX,o= ${DATA_DIR}
|
||||
|
||||
chown hyperkitty:hyperkitty ${DATA_DIR}/hyperkitty.db 2>/dev/null
|
||||
chmod u=rwX,g=rwX,o= ${DATA_DIR}/hyperkitty.db 2>/dev/null
|
||||
|
||||
setfacl -R --no-mask -m u:hyperkitty:rwX ${DATA_DIR}
|
||||
setfacl -R -d --no-mask -m u:hyperkitty:rwX ${DATA_DIR}
|
||||
setfacl -R --no-mask -m u:hyperkitty-admin:rwX ${DATA_DIR}
|
||||
setfacl -R -d --no-mask -m u:hyperkitty-admin:rwX ${DATA_DIR}
|
||||
|
||||
chown hyperkitty-admin:hyperkitty-admin ${LOG_DIR}
|
||||
chmod u=rwX,g=rwX,o= ${LOG_DIR}
|
||||
chown hyperkitty-admin:hyperkitty-admin ${LOG_DIR}/hyperkitty.log 2>/dev/null
|
||||
chmod u=rwX,g=rwX,o= ${LOG_DIR}/hyperkitty.log 2>/dev/null
|
||||
|
||||
setfacl -R --no-mask -m u:hyperkitty:rwX ${LOG_DIR}
|
||||
setfacl -R -d --no-mask -m u:hyperkitty:rwX ${LOG_DIR}
|
||||
setfacl -R --no-mask -m u:hyperkitty-admin:rwX ${LOG_DIR}
|
||||
setfacl -R -d --no-mask -m u:hyperkitty-admin:rwX ${LOG_DIR}
|
||||
12
hyperkitty-qcluster.service
Normal file
12
hyperkitty-qcluster.service
Normal file
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=HyperKitty async tasks runner
|
||||
After=network.target remote-fs.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /srv/www/webapps/mailman/hyperkitty/manage.py qcluster --pythonpath /srv/www/webapps/mailman/hyperkitty/ --settings settings
|
||||
User=hyperkitty
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
8
hyperkitty-runjob.service
Normal file
8
hyperkitty-runjob.service
Normal file
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=HyperKitty runjob @HYPERKITTY_RUNJOB@
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/python3 /srv/www/webapps/mailman/hyperkitty/manage.py runjob @HYPERKITTY_RUNJOB@ --pythonpath /srv/www/webapps/mailman/hyperkitty/ --settings settings
|
||||
User=hyperkitty-admin
|
||||
Group=hyperkitty-admin
|
||||
10
hyperkitty-runjob.timer
Normal file
10
hyperkitty-runjob.timer
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=HyperKitty runjob @HYPERKITTY_RUNJOB@
|
||||
|
||||
[Timer]
|
||||
@HYPERKITTY_RUNJOB_CALENDAR@
|
||||
@HYPERKITTY_RUNJOB_DELAY@
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=basic.target
|
||||
31
hyperkitty-settings.patch
Normal file
31
hyperkitty-settings.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
Index: HyperKitty-1.3.3/example_project/settings.py
|
||||
===================================================================
|
||||
--- HyperKitty-1.3.3.orig/example_project/settings.py
|
||||
+++ HyperKitty-1.3.3/example_project/settings.py
|
||||
@@ -134,7 +134,7 @@ DATABASES = {
|
||||
# Use 'sqlite3', 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
# DB name or path to database file if using sqlite3.
|
||||
- 'NAME': os.path.join(BASE_DIR, 'hyperkitty.db'),
|
||||
+ 'NAME': '/var/lib/hyperkitty/data/hyperkitty.db',
|
||||
# The following settings are not used with sqlite3:
|
||||
'USER': 'hyperkitty',
|
||||
'PASSWORD': 'hkpass',
|
||||
@@ -202,7 +202,7 @@ USE_TZ = True
|
||||
# Don't put anything in this directory yourself; store your static files
|
||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||
# Example: "/var/www/example.com/static/"
|
||||
-STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
+STATIC_ROOT = '/srv/www/webapps/mailman/hyperkitty/static'
|
||||
|
||||
# URL prefix for static files.
|
||||
# Example: "http://example.com/static/", "http://static.example.com/"
|
||||
@@ -395,7 +395,7 @@ LOGGING = {
|
||||
'level': 'INFO',
|
||||
#'class': 'logging.handlers.RotatingFileHandler',
|
||||
'class': 'logging.handlers.WatchedFileHandler',
|
||||
- 'filename': os.path.join(BASE_DIR, 'hyperkitty.log'),
|
||||
+ 'filename': '/var/log/hyperkitty/hyperkitty.log',
|
||||
'formatter': 'verbose',
|
||||
},
|
||||
},
|
||||
17
hyperkitty.uwsgi
Normal file
17
hyperkitty.uwsgi
Normal file
@@ -0,0 +1,17 @@
|
||||
[uwsgi]
|
||||
#plugin = apparmor
|
||||
#apparmor-hat = hyperkitty
|
||||
|
||||
uid = hyperkitty
|
||||
gid = hyperkitty
|
||||
|
||||
processes = 1
|
||||
threads = 25
|
||||
|
||||
socket = /run/uwsgi/uwsgi-hyperkitty.sock
|
||||
chmod-socket = 660
|
||||
chown-socket = wwwrun:www
|
||||
|
||||
plugin = python3
|
||||
chdir = /srv/www/webapps/mailman/hyperkitty
|
||||
module = wsgi
|
||||
3
python-HyperKitty-rpmlintrc
Normal file
3
python-HyperKitty-rpmlintrc
Normal file
@@ -0,0 +1,3 @@
|
||||
addFilter("zero-length")
|
||||
addFilter("non-standard-gid")
|
||||
addFilter("non-standard-uid")
|
||||
@@ -1,3 +1,20 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Dec 13 11:16:18 UTC 2020 - Andreas Schneider <asn@cryptomilk.org>
|
||||
|
||||
- Added hyperkitty-qcluster.service
|
||||
- Added hyperkitty-runjob.service and hyperkitty-runjob.timer
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 12 19:43:44 UTC 2020 - Andreas Schneider <asn@cryptomilk.org>
|
||||
|
||||
- Create a HyperKitty-web package with webroot files
|
||||
- Create a HyperKitty-web-uwsgi with uwsgi configuration
|
||||
- Added hyperkitty-settings.patch
|
||||
* Sets the FHS default paths
|
||||
- Added hyperkitty-fix-tests.patch
|
||||
* Make migration compatible with django >= 3.1
|
||||
- Added rpmlint config
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 4 01:35:17 UTC 2020 - Stasiek Michalski <stasiek@michalski.cc>
|
||||
|
||||
|
||||
@@ -16,6 +16,21 @@
|
||||
#
|
||||
|
||||
|
||||
%global webapps_dir /srv/www/webapps
|
||||
|
||||
%global hyperkitty_pkgname HyperKitty
|
||||
|
||||
%global hyperkitty_basedir %{webapps_dir}/mailman/hyperkitty
|
||||
%global hyperkitty_localedir %{hyperkitty_basedir}/locale
|
||||
%global hyperkitty_staticdir %{hyperkitty_basedir}/static
|
||||
|
||||
%global hyperkitty_etcdir %{_sysconfdir}/hyperkitty
|
||||
%global hyperkitty_libdir %{_localstatedir}/lib/hyperkitty
|
||||
%global hyperkitty_logdir %{_localstatedir}/log/hyperkitty
|
||||
%global hyperkitty_datadir %{hyperkitty_libdir}/data
|
||||
|
||||
%global hyperkitty_services hyperkitty-qcluster.service hyperkitty-runjob-daily.service hyperkitty-runjob-daily.timer hyperkitty-runjob-hourly.service hyperkitty-runjob-hourly.timer hyperkitty-runjob-minutely.service hyperkitty-runjob-minutely.timer hyperkitty-runjob-monthly.service hyperkitty-runjob-monthly.timer hyperkitty-runjob-quarter-hourly.service hyperkitty-runjob-quarter-hourly.timer hyperkitty-runjob-weekly.service hyperkitty-runjob-weekly.timer hyperkitty-runjob-yearly.service hyperkitty-runjob-yearly.timer
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define skip_python2 1
|
||||
Name: python-HyperKitty
|
||||
@@ -24,13 +39,37 @@ Release: 0
|
||||
Summary: A web interface to access GNU Mailman v3 archives
|
||||
License: GPL-3.0-only
|
||||
URL: https://gitlab.com/mailman/hyperkitty
|
||||
Source: https://files.pythonhosted.org/packages/source/H/HyperKitty/HyperKitty-%{version}.tar.gz
|
||||
#
|
||||
Source0: https://files.pythonhosted.org/packages/source/H/HyperKitty/HyperKitty-%{version}.tar.gz
|
||||
Source1: python-HyperKitty-rpmlintrc
|
||||
#
|
||||
Source10: hyperkitty-manage.sh
|
||||
Source11: hyperkitty-permissions.sh
|
||||
Source12: hyperkitty.uwsgi
|
||||
#
|
||||
Source20: hyperkitty-qcluster.service
|
||||
Source21: hyperkitty-runjob.service
|
||||
Source22: hyperkitty-runjob.timer
|
||||
#
|
||||
Source30: README.SUSE.md
|
||||
#
|
||||
Patch0: hyperkitty-settings.patch
|
||||
# Make migration compatible with django >= 3.1
|
||||
# https://gitlab.com/mailman/hyperkitty/-/commit/0e46371f0f2aab8618aa2852ea6f63c245e16927.patch
|
||||
Patch1: hyperkitty-fix-tests.patch
|
||||
#
|
||||
BuildRequires: %{python_module django-debug-toolbar >= 2.2}
|
||||
BuildRequires: %{python_module isort}
|
||||
BuildRequires: %{python_module libsass}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: acl
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: openssl
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: sudo
|
||||
Requires: python-Django >= 1.11
|
||||
Requires: python-django-compressor >= 1.3
|
||||
Requires: python-django-debug-toolbar >= 2.2
|
||||
Requires: python-django-extensions >= 1.3.7
|
||||
Requires: python-django-gravatar2 >= 1.0.6
|
||||
Requires: python-django-haystack >= 2.8.0
|
||||
@@ -44,6 +83,7 @@ Requires: python-networkx >= 1.9.1
|
||||
Requires: python-python-dateutil >= 2.0
|
||||
Requires: python-pytz >= 2012
|
||||
Requires: python-robot-detection >= 0.3
|
||||
Requires: python-xapian-haystack >= 2.1.0
|
||||
BuildArch: noarch
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module Django >= 1.11}
|
||||
@@ -72,24 +112,182 @@ BuildRequires: %{python_module robot-detection >= 0.3}
|
||||
%description
|
||||
A web interface to access GNU Mailman v3 archives.
|
||||
|
||||
%package -n %{hyperkitty_pkgname}-web
|
||||
Summary: The webroot for GNU Mailman
|
||||
Requires: acl
|
||||
Requires: openssl
|
||||
Requires: python3-HyperKitty
|
||||
Requires: sudo
|
||||
|
||||
%description -n %{hyperkitty_pkgname}-web
|
||||
A web user interface for GNU Mailman.
|
||||
|
||||
This package holds the web interface.
|
||||
|
||||
%package -n %{hyperkitty_pkgname}-web-uwsgi
|
||||
Summary: HyperKitty - uwsgi configuration
|
||||
Requires: %{hyperkitty_pkgname}-web
|
||||
Requires: uwsgi
|
||||
|
||||
%description -n %{hyperkitty_pkgname}-web-uwsgi
|
||||
A web user interface for GNU Mailman.
|
||||
|
||||
This package holds the uwsgi configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n HyperKitty-%{version}
|
||||
%autosetup -p1 -n HyperKitty-%{version}
|
||||
cp %{SOURCE30} .
|
||||
touch settings_local.py
|
||||
|
||||
%build
|
||||
sed -i 's|^#!/usr/bin/env.*|#!%{_bindir}/python3|' \
|
||||
example_project/manage.py
|
||||
|
||||
%python_build
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
install -d -m 0750 \
|
||||
%{buildroot}%{hyperkitty_etcdir} \
|
||||
%{buildroot}%{hyperkitty_libdir} \
|
||||
%{buildroot}%{hyperkitty_datadir} \
|
||||
%{buildroot}%{hyperkitty_datadir}/attachments \
|
||||
%{buildroot}%{hyperkitty_logdir}
|
||||
|
||||
install -d -m 0755 \
|
||||
%{buildroot}%{hyperkitty_basedir} \
|
||||
%{buildroot}%{hyperkitty_localedir} \
|
||||
%{buildroot}%{hyperkitty_staticdir} \
|
||||
%{buildroot}%{_unitdir}
|
||||
|
||||
cp -a example_project/* %{buildroot}%{hyperkitty_basedir}
|
||||
chmod -x %{buildroot}%{hyperkitty_basedir}/wsgi.py
|
||||
|
||||
for f in \
|
||||
README.rst \
|
||||
apache.conf \
|
||||
crontab \
|
||||
qcluster.service \
|
||||
; do
|
||||
rm -f %{buildroot}%{hyperkitty_basedir}/$f
|
||||
done
|
||||
%python_expand rm -rf %{buildroot}%{$python_sitelib}/example_project
|
||||
|
||||
# Create an empty settings_local.py. This will be filled with a SECRET_KEY in post
|
||||
install -m 0644 settings_local.py %{buildroot}%{hyperkitty_etcdir}/settings_local.py
|
||||
|
||||
ln -svf %{hyperkitty_etcdir}/settings_local.py \
|
||||
%{buildroot}/%{hyperkitty_basedir}/settings_local.py
|
||||
|
||||
%fdupes %{buildroot}%{hyperkitty_basedir}
|
||||
|
||||
# Manage script
|
||||
install -d -m 0755 %{buildroot}%{_sbindir}
|
||||
install -m 0750 %{SOURCE10} %{buildroot}%{_sbindir}/hyperkitty-manage
|
||||
install -m 0750 %{SOURCE11} %{buildroot}%{_sbindir}/hyperkitty-fix-permissions
|
||||
|
||||
install -d -m 0755 %{buildroot}%{_sysconfdir}/uwsgi/vassals
|
||||
install -m 0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/uwsgi/vassals/hyperkitty.ini
|
||||
|
||||
install -m 0644 %{SOURCE20} %{buildroot}%{_unitdir}/hyperkitty-qcluster.service
|
||||
ln -s /sbin/service %{buildroot}%{_sbindir}/rchyperkitty-qcluster
|
||||
|
||||
for job in \
|
||||
minutely \
|
||||
quarter-hourly \
|
||||
hourly \
|
||||
daily \
|
||||
weekly \
|
||||
monthly \
|
||||
yearly \
|
||||
; do
|
||||
install -m 0644 %{SOURCE21} %{buildroot}%{_unitdir}/hyperkitty-runjob-${job}.service
|
||||
sed -i "s/@HYPERKITTY_RUNJOB@/${job}/g" %{buildroot}%{_unitdir}/hyperkitty-runjob-${job}.service
|
||||
ln -s /sbin/service %{buildroot}%{_sbindir}/rchyperkitty-runjob-${job}
|
||||
|
||||
install -m 0644 %{SOURCE22} %{buildroot}%{_unitdir}/hyperkitty-runjob-${job}.timer
|
||||
|
||||
hyperkitty_runjob_calendar="OnCalendar=${job}"
|
||||
hyperkitty_runjob_delay="RandomizedDelaySec=15m"
|
||||
hyperkitty_runjob_name="${job}"
|
||||
|
||||
if [ "${job}" = "minutely" ]; then
|
||||
hyperkitty_runjob_delay="RandomizedDelaySec=15s"
|
||||
elif [ "${job}" = "quarter-hourly" ]; then
|
||||
hyperkitty_runjob_timer="OnCalendar=quaterly"
|
||||
hyperkitty_runjob_delay="RandomizedDelaySec=2m"
|
||||
# The real jobname is with an underscore
|
||||
hyperkitty_runjob_name="quarter_hourly"
|
||||
fi
|
||||
sed -i "s/@HYPERKITTY_RUNJOB_CALENDAR@/${hyperkitty_runjob_calendar}/g" %{buildroot}%{_unitdir}/hyperkitty-runjob-${job}.timer
|
||||
sed -i "s/@HYPERKITTY_RUNJOB_DELAY@/${hyperkitty_runjob_delay}/g" %{buildroot}%{_unitdir}/hyperkitty-runjob-${job}.timer
|
||||
sed -i "s/@HYPERKITTY_RUNJOB@/${hyperkitty_runjob_name}/g" %{buildroot}%{_unitdir}/hyperkitty-runjob-${job}.timer
|
||||
done
|
||||
|
||||
%check
|
||||
export DJANGO_SETTINGS_MODULE="hyperkitty.tests.settings_test"
|
||||
export PYTHONPATH='.'
|
||||
%python_exec example_project/manage.py test
|
||||
|
||||
%pre -n %{hyperkitty_pkgname}-web
|
||||
/usr/sbin/groupadd -r hyperkitty &>/dev/null || :
|
||||
/usr/sbin/useradd -g hyperkitty -s /bin/false -r -c "HyperKitty" -d %{hyperkitty_basedir} hyperkitty &>/dev/null || :
|
||||
|
||||
/usr/sbin/groupadd -r hyperkitty-admin &>/dev/null || :
|
||||
/usr/sbin/useradd -g hyperkitty-admin -s /bin/bash -r -c "HyperKitty Admin" -d %{hyperkitty_basedir} hyperkitty-admin &>/dev/null || :
|
||||
|
||||
%service_add_pre %{hyperkitty_services}
|
||||
|
||||
%post -n %{hyperkitty_pkgname}-web
|
||||
%{_sbindir}/hyperkitty-fix-permissions
|
||||
# We need a SECRET_KEY for manage to work
|
||||
if ! grep -q "^SECRET_KEY.*" %{hyperkitty_etcdir}/settings_local.py; then
|
||||
echo "SECRET_KEY='$(openssl rand -base64 48)'" >> %{hyperkitty_etcdir}/settings_local.py
|
||||
fi
|
||||
%{_sbindir}/hyperkitty-manage migrate --pythonpath /srv/www/webapps/mailman/hyperkitty/ --settings settings
|
||||
%{_sbindir}/hyperkitty-manage collectstatic --pythonpath /srv/www/webapps/mailman/hyperkitty/ --settings settings --clear --noinput
|
||||
%{_sbindir}/hyperkitty-manage compress --pythonpath /srv/www/webapps/mailman/hyperkitty/ --settings settings --force
|
||||
|
||||
%service_add_post %{hyperkitty_services}
|
||||
|
||||
%preun -n %{hyperkitty_pkgname}-web
|
||||
%service_del_preun %{hyperkitty_services}
|
||||
|
||||
%postun -n %{hyperkitty_pkgname}-web
|
||||
%service_del_postun %{hyperkitty_services}
|
||||
|
||||
%files %{python_files}
|
||||
%doc AUTHORS.txt README.rst example_project doc/*.rst
|
||||
%license COPYING.txt
|
||||
%{python_sitelib}/*
|
||||
%{python_sitelib}/hyperkitty
|
||||
%{python_sitelib}/HyperKitty*.egg-info
|
||||
|
||||
%files -n %{hyperkitty_pkgname}-web
|
||||
%doc README.SUSE.md
|
||||
%{_sbindir}/hyperkitty-manage
|
||||
%{_sbindir}/hyperkitty-fix-permissions
|
||||
%{_sbindir}/rchyperkitty-qcluster
|
||||
%{_sbindir}/rchyperkitty-runjob-*
|
||||
%dir %{webapps_dir}
|
||||
%dir %{webapps_dir}/mailman
|
||||
%{_unitdir}/hyperkitty-qcluster.service
|
||||
%{_unitdir}/hyperkitty-runjob-*.service
|
||||
%{_unitdir}/hyperkitty-runjob-*.timer
|
||||
|
||||
%defattr(-,hyperkitty-admin,hyperkitty)
|
||||
%{hyperkitty_basedir}
|
||||
|
||||
%attr(750,hyperkitty-admin,hyperkitty) %dir %{hyperkitty_etcdir}
|
||||
%attr(640,hyperkitty-admin,hyperkitty) %config(noreplace) %{hyperkitty_etcdir}/settings_local.py
|
||||
%attr(750,hyperkitty-admin,hyperkitty) %dir %{hyperkitty_libdir}
|
||||
%attr(750,hyperkitty-admin,hyperkitty) %dir %{hyperkitty_datadir}
|
||||
%attr(750,hyperkitty-admin,hyperkitty) %dir %{hyperkitty_logdir}
|
||||
|
||||
%files -n %{hyperkitty_pkgname}-web-uwsgi
|
||||
%dir %{_sysconfdir}/uwsgi
|
||||
%dir %{_sysconfdir}/uwsgi/vassals
|
||||
%config (noreplace) %{_sysconfdir}/uwsgi/vassals/hyperkitty.ini
|
||||
|
||||
%changelog
|
||||
|
||||
Reference in New Issue
Block a user