Skip to content

Instantly share code, notes, and snippets.

@klausenbusk
Last active July 3, 2021 23:21
Show Gist options
  • Save klausenbusk/5982063f95c503754a51ed2fefb8915e to your computer and use it in GitHub Desktop.
Save klausenbusk/5982063f95c503754a51ed2fefb8915e to your computer and use it in GitHub Desktop.
mailman-web PKGBUILD
diff --git a/docs/settings.py b/docs/settings.py
index 3f660c7..2e16be0 100644
--- a/docs/settings.py
+++ b/docs/settings.py
@@ -11,24 +11,24 @@ ADMINS = (
)
# Postgresql datbase setup.
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.postgresql_psycopg2',
- 'NAME': ‘mailmanweb’,
- 'USER': '<db_username>',
- 'PASSWORD': '<password>',
- 'HOST': 'localhost',
- 'PORT': '5432',
- }
-}
+#DATABASES = {
+# 'default': {
+# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
+# 'NAME': 'mailmanweb',
+# 'USER': '<db_username>',
+# 'PASSWORD': '<password>',
+# 'HOST': 'localhost',
+# 'PORT': '5432',
+# }
+#}
# 'collectstatic' command will copy all the static files here.
# Alias this location from your webserver to `/static`
-STATIC_ROOT = '/opt/mailman/web/static'
+STATIC_ROOT = '/var/lib/mailman-web/static'
# Make sure that this directory is created or Django will fail on start.
-LOGGING['handlers']['file']['filename'] = '/opt/mailman/web/logs/mailmanweb.log'
+LOGGING['handlers']['file']['filename'] = '/var/log/mailman-web/mailman-web.log'
#: See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [
diff --git a/mailman_web/settings/base.py b/mailman_web/settings/base.py
index 992c09f..9168f5c 100644
--- a/mailman_web/settings/base.py
+++ b/mailman_web/settings/base.py
@@ -135,7 +135,7 @@ WSGI_APPLICATION = 'mailman_web.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': os.path.join(BASE_DIR, 'mailman-web.db'),
+ 'NAME': '/var/lib/mailman-web/mailman-web.db',
'HOST': '',
'PORT': '',
}
@@ -179,7 +179,7 @@ USE_TZ = True
#: Default path where static files will be placed.
-STATIC_ROOT = os.path.join(BASE_DIR, 'static')
+STATIC_ROOT = '/var/lib/mailman-web/static'
#: URL prefix for static files.
#: Example: "http://example.com/static/", "http://static.example.com/"
@@ -252,7 +252,7 @@ LOGGING = {
'level': 'INFO',
#'class': 'logging.handlers.RotatingFileHandler',
'class': 'logging.handlers.WatchedFileHandler',
- 'filename': os.path.join(BASE_DIR, 'logs', 'mailmanweb.log'),
+ 'filename': '/var/log/mailman-web/mailman-web.log',
'formatter': 'verbose',
},
'console': {
diff --git a/setup.cfg b/setup.cfg
--- a/setup.cfg
+++ b/setup.cfg
@@ -22,7 +22,7 @@ setup_requires =
setuptools
setuptools-scm
install_requires =
- Django<3.1
+ Django
postorius
hyperkitty
whoosh
u mailman-web - "GNU Mailman Web" -
z /etc/mailman3/settings.py 0640 root mailman-web -
z /etc/mailman3/urls.py 0640 root mailman-web -
d %L/mailman-web 750 mailman-web mailman-web -
d %S/mailman-web - mailman-web mailman-web -
d %S/mailman-web/data 750 mailman-web mailman-web -
d %S/mailman-web/static - mailman-web mailman-web -
d %t/mailman-web - mailman-web mailman-web -
[uwsgi]
procname-master = mailman-web
master = true
plugins = python
socket = /run/mailman-web/%n.sock
stats = /run/mailman-web/%n-stats.sock
uid = mailman-web
gid = mailman-web
chmod-socket = 660
chown-socket = mailman-web:http
processes = 10
cheaper = 2
cheaper-step = 1
idle = 120
die-on-idle = true
module=mailman_web.wsgi:application
# Add to python import path.
pythonpath = /etc/mailman3/
home = /
touch-reload = %p
vacuum = true
attach-daemon = django-admin qcluster --pythonpath /etc/mailman3 --settings settings
cron2 = minute=0,hour=0,day=0,week=0,month=0,unique=1 /usr/bin/django-admin runjobs yearly --pythonpath /etc/mailman3 --settings settings
cron2 = minute=0,hour=0,day=0,week=0,unique=1 /usr/bin/django-admin runjobs monthly --pythonpath /etc/mailman3 --settings settings
cron2 = minute=0,hour=0,day=0,unique=1 /usr/bin/django-admin runjobs weekly --pythonpath /etc/mailman3 --settings settings
cron2 = minute=0,hour=0,unique=1 django-admin runjobs daily --pythonpath /etc/mailman3 --settings settings
cron2 = minute=0,unique=1 /usr/bin/django-admin runjobs hourly --pythonpath /etc/mailman3 --settings settings
cron2 = minute=-15,unique=1 /usr/bin/django-admin runjobs quarter_hourly --pythonpath /etc/mailman3 --settings settings
cron2 = unique=1 /usr/bin/django-admin runjobs minutely --pythonpath /etc/mailman3 --settings settings
# Maintainer:
pkgname=mailman-web
pkgver=0.0.4
pkgrel=1
pkgdesc="Mailman Web is the web interface for Mailman 3"
arch=('any')
url="https://gitlab.com/mailman/mailman-web"
license=('GPL3')
depends=('python-django' 'postorius' 'hyperkitty' 'python-whoosh')
makedepends=('python-setuptools')
backup=("etc/mailman3/settings.py"
"etc/mailman3/urls.py")
source=("https://files.pythonhosted.org/packages/source/${pkgname::1}/${pkgname}/${pkgname}-${pkgver}.tar.gz"{,.asc}
"mailman-web-0.0.4-settings.patch"
"mailman-web-0.0.4-setup.patch"
"mailman-web.sysusers"
"mailman-web.tmpfiles"
"mailman-web.uwsgi")
sha512sums=('d28a043be12693692453a433509a1c3b081f4c6c35fca62d87bd79f56b2bae943aafc15c374e32eb836e82c7a6ec2d7ab7e37e0eafe188d7c17c4949c10015d2'
'SKIP'
'a17b3b3d61bb1d40f14a3ed01d9b506ae40c513dc66de466fdfdc641fa56659a358e81f90dc402ed4becbf54a8bfa5ef10b155651dfcba587618aed361b112c1'
'f020405983bf20dd7b15adc5682811b801a866b050c8392ffbbc0ebfa152f4fc382a9734eaad2ca5b38007daac31472718f2da1ce6735c2856f2aaccbcbfa542'
'4044b2500dc63ec1cea829d0189428de590755006c38d6f82e5a51af8935409a1ea5a5fb1f676d2331ceb59383cf79730837427eff32ad82f900068684aa3b45'
'4fffedb415b9df53c755c06d94d11cf6195551f9361f2bf2890c7d46cd8f91a949ee7d1a2f4b605b59b966b6164df58c455c04b5a5f28c1798dedd5dd16d9f07'
'40918aff80bc05b4284530b36061a4507f594abe3383e952151dba0b7022435cff64b1038dfa1209a977ca74507f19e1d65e872cbba921e7ccd751532f62e9dc')
validpgpkeys=('541EA0448453394FF77A0ECC9D9B2BA061D0A67C') # Abhilash Raj <[email protected]>
prepare() {
cd "$pkgname-$pkgver"
# setting FHS compliant default paths and use Sql
patch -Np1 -i "../${pkgname}-0.0.4-settings.patch"
patch -Np1 -i "../${pkgname}-0.0.4-setup.patch"
}
build() {
cd "$pkgname-$pkgver"
python setup.py build
}
package() {
cd "$pkgname-$pkgver"
python setup.py install --skip-build \
--optimize=1 \
--root="${pkgdir}"
install -vDm 640 docs/settings.py \
"${pkgdir}/etc/mailman3/settings.py"
local python_stdlib_basepath="$(python -c "from sysconfig import get_path; print(get_path('stdlib'))")"
install -vDm 640 mailman_web/urls.py \
"${pkgdir}/etc/mailman3/urls.py"
ln -svf "/etc/mailman3/urls.py" \
"${pkgdir}${python_stdlib_basepath}/site-packages/${pkgname/-/_}/urls.py"
# state dir
install -vdm 750 "${pkgdir}/var/lib/${pkgname}/data"
# uwsgi
install -vDm 644 "../${pkgname}.uwsgi" \
"${pkgdir}/etc/uwsgi/${pkgname}.ini"
# tmpfiles.d
install -vDm 644 "../${pkgname}.tmpfiles" \
"${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
# sysusers.d
install -vDm 644 "../${pkgname}.sysusers" \
"${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment