Commit 17ad4ac2 authored by Matthieu Gautier's avatar Matthieu Gautier

Merge branch 'debian-packaging' into 'master'

Debian packaging

Closes #9

See merge request !5
parents 743ed246 0225e8e4
irfi (1.0~beta1) unstable; urgency=low
* Initial package build.
-- Mathieu Bridon <bochecha@daitauha.fr> Fri, 19 Jan 2018 17:50:00 +0100
Source: irfi
Section: python
Priority: optional
Maintainer: BSF Pôle Numérique <TODO>
Uploaders:
Mathieu Bridon <bochecha@daitauha.fr>,
Matthieu Gautier <mgautier@kymeria.fr>
Build-Depends:
debhelper (>= 9),
dh-virtualenv (>= 0.10),
python3,
python3-dev,
python3-setuptools,
# For Pillow
libjpeg-dev,
zlib1g-dev,
# For lxml
libxml2-dev,
libxslt1-dev,
# For dbus-python
autoconf,
automake,
libdbus-glib-1-dev,
libtool,
# For PyYAML
libyaml-dev,
# To clone Ideascube
git,
Standards-Version: 3.9.6
Package: irfi
Architecture: any
Depends:
${misc:Depends},
${python3:Depends},
${shlibs:Depends},
adduser,
libpam-systemd,
network-manager,
nginx,
policykit-1,
python3,
uwsgi,
uwsgi-plugin-python3,
Description: Library server
Ideascube is a complete library management server. It allows librarians to
manage their content, the users, and more. It also allows installing more
content and applications from various repositories, for example offline
copies of Wikipedia.
.
Ideascube is used as the main user interface in the Ideasbox and Koombook
servers from Libraries Without Borders.
.
Irfi is an application based on Ideascube, customized to the needs of the
RFI Planète Radio project.
# Make possible to bypass proxy, in case of debug needs.
HOST=0.0.0.0
PORT=8001
usr/share/ideascube/static/branding
var/ideascube/main
var/cache/ideascube
extras/nginx/ideascube etc/nginx/sites-available
extras/uwsgi/ideascube.ini etc/uwsgi/apps-available
extras/uwsgi/uwsgi_params var/ideascube
extras/bin/ideascube usr/bin
extras/polkit-debian/ideascube-networkmanager.pkla var/lib/polkit-1/localauthority/20-org.d
extras/polkit-debian/ideascube-systemd.pkla var/lib/polkit-1/localauthority/20-org.d
extras/polkit-debian/org.bsf.ideascube.policy usr/share/polkit-1/actions
extras/pam/ideascube etc/pam.d
irfi: binary-without-manpage usr/bin/ideascube
irfi: dir-or-file-in-opt opt/venvs/irfi/*
irfi: duplicate-font-file opt/venvs/irfi/lib/*
irfi: embedded-javascript-library opt/venvs/irfi/lib/*
irfi: extra-license-file opt/venvs/irfi/lib/*
irfi: font-in-non-font-package opt/venvs/irfi/lib/*
irfi: package-contains-empty-directory usr/share/irfi/static/branding/
irfi: package-installs-python-pycache-dir opt/venvs/irfi/*
irfi: wrong-path-for-interpreter opt/venvs/irfi/bin/*
#!/bin/sh
set -e
case "$1" in
configure)
if ! getent passwd "ideascube" > /dev/null 2>&1 ; then
adduser --quiet \
--system \
--no-create-home \
--group \
--disabled-password \
--shell /bin/false \
"ideascube"
fi
chown ideascube:ideascube /var/ideascube
chown ideascube:ideascube /var/ideascube/main
chown ideascube:ideascube /var/cache/ideascube
;;
esac
#DEBHELPER#
#!/bin/sh
set -e
case "$1" in
remove)
rm -rf /var/ideascube/static || :
rm -f /etc/nginx/sites-enabled/$DPKG_MAINTSCRIPT_PACKAGE
rm -f /etc/uwsgi/apps-enabled/$DPKG_MAINTSCRIPT_PACKAGE.ini
;;
purge)
rm -rf /var/ideascube || :
rm -rf /var/cache/ideascube || :
deluser --quiet ideascube > /dev/null || :
delgroup --quiet ideascube > /dev/null || :
;;
esac
#DEBHELPER#
#!/usr/bin/make -f
# Ensure Python will use the 'utf-8' codec
export LANG=C.UTF-8
export DH_VERBOSE=1
export DH_VIRTUALENV_ARGUMENTS=--python=/usr/bin/python3
export DH_VIRTUALENV_INSTALL_ROOT=/opt/venvs
export DH_UPGRADE_SETUPTOOLS=
export DH_UPGRADE_PIP=
export DH_PIP_EXTRA_ARGS=--no-binary=:all:
%:
dh $@ --with python3 --buildsystem dh_virtualenv
override_dh_auto_install:
dh_auto_install
find $(CURDIR)/debian/irfi -name '*.la' -exec rm -f '{}' \;
# https://github.com/spotify/dh-virtualenv/issues/209
override_dh_auto_test:
:
#!/bin/bash
NAME=irfi
# Set defaults.
DJANGO_SETTINGS_MODULE="$NAME.settings"
IDEASCUBE_ID=${IDEASCUBE_ID:-""}
STORAGE_ROOT=${STORAGE_ROOT:-"/var/ideascube"}
# Override with /etc/defautl/ideasube that may have
# been customized by user.
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Export them so django-admin can access them.
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export STORAGE_ROOT=$STORAGE_ROOT
export IDEASCUBE_ID=$IDEASCUBE_ID
/opt/venvs/$NAME/bin/django-admin "$@"
# the upstream component nginx needs to connect to
upstream ideascube {
server unix:///tmp/ideascube.sock;
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
# the domain name it will serve for
server_name ideasbox.lan www.ideasbox.lan ideasbox.local www.ideasbox.local koombook.lan www.koombook.lan koombook.local www.koombook.local bibliotecamovil.lan www.bibliotecamovil.lan;
charset utf-8;
# max upload size
client_max_body_size 500M;
# Django media
location /media/ {
alias /var/ideascube/main/media/;
expires 1y;
}
location /static/ {
alias /var/ideascube/static/;
expires 1y;
}
location ~ /.*/jsi18n/ {
uwsgi_pass ideascube;
include /var/ideascube/uwsgi_params;
expires 1y;
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass ideascube;
include /var/ideascube/uwsgi_params;
}
}
# serve the static sites
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name sites.ideasbox.lan sites.ideasbox.local sites.koombook.lan sites.koombook.local sites.bibliotecamovil.lan;
charset utf-8;
root /var/ideascube/nginx/;
}
auth sufficient pam_rootok.so
session required pam_systemd.so
[Allow ideascube to control the network]
Identity=unix-user:ideascube
Action=org.freedesktop.NetworkManager.network-control
ResultActive=yes
ResultInactive=yes
ResultAny=yes
[Allow ideascube to enable/disable the Wi-Fi]
Identity=unix-user:ideascube
Action=org.freedesktop.NetworkManager.enable-disable-wifi
ResultActive=yes
ResultInactive=yes
ResultAny=yes
[Allow ideascube to manage system-level connections]
Identity=unix-user:ideascube
Action=org.freedesktop.NetworkManager.settings.modify.system
ResultActive=yes
ResultInactive=yes
ResultAny=yes
[Allow ideascube to manage units]
Identity=unix-user:ideascube
Action=org.bsf.ideascube.pkexec.systemctl
ResultActive=yes
ResultInactive=yes
ResultAny=yes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>The Ideascube Project</vendor>
<vendor_url>https://framagit.org/ideascube/ideascube/</vendor_url>
<action id="org.bsf.ideascube.pkexec.systemctl">
<description>Manage systemd units with systemctl</description>
<message>Authentication is required for service management.</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>no</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/bin/systemctl</annotate>
</action>
</policyconfig>
[uwsgi]
autoload = false
uid = ideascube
gid = ideascube
pam = ideascube
# Django-related settings
# the base directory (full path)
chdir = /opt/venvs/irfi/lib/python3.4/site-packages/irfi/
# Django's wsgi file
module = irfi.wsgi
# the virtualenv (full path)
home = /opt/venvs/irfi/
# Load env vars from /etc/default.
# See http://uwsgi-docs.readthedocs.org/en/latest/ConfigLogic.html
# and http://uwsgi-docs.readthedocs.org/en/latest/ParsingOrder.html
# for-readline is uWsgi >= 2.01 only:
# http://uwsgi-docs.readthedocs.org/en/latest/Changelog-2.0.1.html
for-readline = /etc/default/irfi
env = %(_)
end-for =
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 4
# the socket (use the full path to be safe
socket = /tmp/ideascube.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# stats = /tmp/ideascube.stats.sock
# clear environment on exit
vacuum = true
plugins = pam,python3
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REQUEST_SCHEME $scheme;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
......@@ -8,9 +8,17 @@ https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "irfi.settings")
os.environ.setdefault("STORAGE_ROOT", "/var/ideascube")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "irfi.settings")
from django.conf import settings
if not settings.DEBUG:
from django.core.management import call_command
call_command('migrate', '--noinput', '--verbosity=1', '--database=default')
call_command('migrate', '--noinput', '--verbosity=1', '--database=transient')
call_command('collectstatic', '--noinput', '--verbosity=1')
application = get_wsgi_application()
......@@ -13,7 +13,7 @@ with open(os.path.join(here, 'README.rst'), 'r') as f:
setup(
name='ideascube',
name='irfi',
version=ideascube.__version__,
description=('This Django repository is the main application of the Ideas '
'Box server.'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment