Add 'debian/' from commit 'f84ef5280b608506bf9c3bf9ccfee0604817170d'

git-subtree-dir: debian
git-subtree-mainline: 31f484c627
git-subtree-split: f84ef5280b
This commit is contained in:
Jérôme Schneider 2015-05-12 14:47:07 +02:00
commit 750792b662
18 changed files with 454 additions and 0 deletions

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
fargo (0.1-1) stable; urgency=low
* Initial release. (Closes: #XXXXXX)
-- EO Admin <admin@entrouvert.com> Wed, 11 Feb 2015 11:24:07 +0100

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
7

32
debian/control vendored Normal file
View File

@ -0,0 +1,32 @@
Source: fargo
Maintainer: Entr'ouvert <info@entrouvert.com>
Section: python
Priority: optional
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.7), debhelper (>= 7.4.3),
python-django (>= 1.7)
Standards-Version: 3.9.1
XS-Python-Version: >= 2.7, << 3.0
Package: fargo
Architecture: all
Pre-Depends: python-django (>= 1.7), postgresql
Depends: ${misc:Depends}, ${python:Depends},
python (>= 2.7),
python-fargo (= ${binary:Version}),
python-psycopg2,
gunicorn,
python-django-tenant-schemas,
python-hobo,
python-django-mellon
Recommends: postgresql-client, python-memcache,
memcached, python-raven, python-entrouvert
Suggests: nginx
Description: Fargo
Package: python-fargo
Architecture: all
Pre-Depends: python-django (>= 1.7)
Depends: ${misc:Depends}, ${python:Depends},
python (>= 2.7), python-django-sekizai
Description: Fargo Python files

5
debian/db.conf.template vendored Normal file
View File

@ -0,0 +1,5 @@
export DATABASE_ENGINE='django.db.backends.postgresql_psycopg2'
export DATABASE_NAME='_DBC_DBNAME_'
export DATABASE_USER='_DBC_DBUSER_'
export DATABASE_PASSWORD='_DBC_DBPASS_'
export DATABASE_HOST='localhost'

43
debian/debian_config.py vendored Normal file
View File

@ -0,0 +1,43 @@
import os.path
# Debian defaults
DEBUG = False
PROJECT_NAME = 'fargo'
# SAML2 authentication
INSTALLED_APPS += ('mellon',)
#
# hobotization (multitenant)
#
execfile('/usr/lib/hobo/debian_config_common.py')
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'syslog': {
'format': '%(levelname)s %(name)s.%(funcName)s: %(message)s',
},
},
'handlers': {
'syslog': {
'level': 'INFO',
'address': '/dev/log',
'class': 'logging.handlers.SysLogHandler',
'formatter': 'syslog',
},
},
'loggers': {
'fargo': {
'level': 'INFO',
'handlers': ['syslog', ],
'propagate': False,
},
},
}
CONFIG_FILE='/etc/fargo/settings.py'
if os.path.exists(CONFIG_FILE):
execfile(CONFIG_FILE)

26
debian/fargo-manage vendored Normal file
View File

@ -0,0 +1,26 @@
#!/bin/sh
NAME=fargo
MANAGE=/usr/lib/$NAME/manage.py
# load Debian default configuration
export FARGO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
# check user
if test x$1 = x"--forceuser"
then
shift
elif test $(id -un) != "$NAME"
then
echo "error: must use $0 with user ${NAME}"
exit 1
fi
if test $# -eq 0
then
python ${MANAGE} help
exit 1
fi
python $MANAGE "$@"

3
debian/fargo.cron.hourly vendored Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
sudo -u fargo /usr/bin/fargo-manage clearsessions

11
debian/fargo.dirs vendored Normal file
View File

@ -0,0 +1,11 @@
/usr/lib/fargo
/usr/share/fargo
/var/lib/fargo/static
/var/lib/fargo/collectstatic
/var/lib/fargo/media
/var/lib/fargo/templates
/var/lib/fargo/locale
/var/lib/fargo/tenants
/var/run/fargo
/var/log/fargo
/etc/fargo

202
debian/fargo.init vendored Normal file
View File

@ -0,0 +1,202 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: fargo
# Required-Start: $network $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Fargo is a versatile identity provider
# Description: Fargo is a versatile identity provider
### END INIT INFO
# Author: Jérôme Schneider <jschneider@entrouvert.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=fargo
NAME=fargo
DAEMON=/usr/bin/gunicorn
PID_DIR=/var/run/$NAME
CACHE_DIR=/var/cache/$NAME
LOG_DIR=/var/log/$NAME
PIDFILE=$PID_DIR/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
MANAGE=/usr/bin/$NAME-manage
SOCKFILE=$PID_DIR/$NAME.sock
BIND=unix:$SOCKFILE
FARGO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
USER=fargo
GROUP=fargo
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
DAEMON_ARGS="--pid $PIDFILE \
--user $USER --group $GROUP \
--daemon \
--access-logfile $LOG_DIR/gunicorn-access.log \
--log-file $LOG_DIR/gunicorn-error.log \
--bind=$BIND \
--workers=10 \
--worker-class=sync \
--timeout=60 \
fargo.wsgi:application"
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Create pid directory
if [ ! -d $PID_DIR ]; then
install -d -m 755 -o $USER -g $GROUP $PID_DIR
fi
# Create cache directory
if [ ! -d $CACHE_DIR ]; then
install -d -m 755 -o $USER -g $GROUP $CACHE_DIR
fi
export FARGO_SETTINGS_FILE
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE $SOCKFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name `basename $DAEMON`
return 0
}
do_migrate() {
log_action_msg "Applying new migrations(migrate_schemas) .."
su $USER -p -c "$MANAGE migrate_schemas"
log_action_msg ".. done"
}
do_collectstatic() {
log_action_msg "Collecting static files .."
su $USER -p -c "$MANAGE collectstatic --noinput"
log_action_msg ".. done"
}
case "$1" in
start)
log_daemon_msg "Starting $DESC " "$NAME"
do_migrate
do_collectstatic
do_start
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg $?
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_migrate
do_collectstatic
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
collectstatic)
do_collectstatic
;;
migrate)
do_migrate
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac

5
debian/fargo.install vendored Normal file
View File

@ -0,0 +1,5 @@
debian/debian_config.py /usr/lib/fargo/
debian/fargo-manage /usr/bin
debian/db.conf.template /usr/share/fargo/
debian/nginx.conf /usr/share/fargo/
manage.py /usr/lib/fargo/

58
debian/fargo.postinst vendored Normal file
View File

@ -0,0 +1,58 @@
#!/bin/sh
#
# Postinst script for fargo
#
set -e
NAME=fargo
USER=$NAME
GROUP=$NAME
CONFIG_DIR="/etc/$NAME"
SECRET_KEY="$CONFIG_DIR/secret"
case "$1" in
configure)
if ! getent group $GROUP > /dev/null 2>&1; then
echo -n "Adding group $GROUP.." >&2
addgroup --quiet --system $GROUP
echo "..done" >&2
fi
if ! getent passwd $USER > /dev/null 2>&1; then
echo -n "Adding user $USER.." >&2
adduser --quiet --system --gecos "Fargo daemon" \
--ingroup $GROUP \
--no-create-home --home /var/lib/$NAME \
$USER
echo "..done" >&2
fi
if [ ! -f $SECRET_KEY ]; then
echo -n "Generating a secret key.." >&2
echo -n "`</dev/urandom tr -dc [:alnum:]-_\!\%\^:\; | head -c70`" > "$SECRET_KEY"
chmod 0600 $SECRET_KEY
chown $USER $SECRET_KEY
echo "..done" >&2
fi
chown -R $USER:$GROUP \
/var/lib/fargo/collectstatic \
/var/lib/fargo/media \
/var/lib/fargo/tenants \
/var/run/fargo
;;
reconfigure|abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

32
debian/fargo.postrm vendored Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# postrm script for fargo
#
# see: dh_installdeb(1)
set -e
case "$1" in purge)
deluser --quiet --system fargo > /dev/null || true
rm -f /var/lib/fargo/secret_key
rm -rf /var/lib/fargo/collectstatic/*
# source debconf stuff
. /usr/share/debconf/confmodule
# source dbconfig-common shell library, and call the hook function
if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/postrm.pgsql
dbc_go fargo $@
fi
DBCONF=/etc/fargo/db.conf
if [ "$1" = "purge" ]; then
rm -f $DBCONF
if which ucf >/dev/null 2>&1; then
ucf --purge $DBCONF
fi
fi
;;
esac
exit 0

12
debian/nginx.conf vendored Normal file
View File

@ -0,0 +1,12 @@
access_log /var/log/nginx/fargo-access.log combined;
error_log /var/log/nginx/fargo-error.log;
location /fargo/static {
alias /var/lib/fargo/collectstatic;
}
location /fargo {
proxy_pass http://unix:/var/run/fargo/fargo.sock;
proxy_set_header Host $http_host;
proxy_set_header SCRIPT_NAME /fargo
}

2
debian/python-fargo.dirs vendored Normal file
View File

@ -0,0 +1,2 @@
/usr/share/python-fargo/
/usr/share/python-fargo/themes/

2
debian/python-fargo.docs vendored Normal file
View File

@ -0,0 +1,2 @@
AUTHORS.txt
COPYING

1
debian/python-fargo.install vendored Normal file
View File

@ -0,0 +1 @@
usr/lib

13
debian/rules vendored Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/make -f
fargo=$(CURDIR)/debian/fargo
python_fargo=$(CURDIR)/debian/python-fargo
%:
dh $@ --with python2
override_dh_install:
dh_install
mv $(CURDIR)/debian/tmp/usr/bin/manage.py $(python_fargo)/usr/share/python-fargo/manage.py

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)