debian: repackaging, multitenant only (#6297)
This commit is contained in:
parent
b8ef5e8429
commit
d73d4d859c
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
NAME=combo
|
||||
MANAGE="/usr/lib/$NAME/manage.py"
|
||||
MANAGE=/usr/lib/$NAME/manage.py
|
||||
|
||||
# load Debian default configuration
|
||||
export COMBO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
/etc/combo-multitenant
|
||||
/var/lib/combo-multitenant/collected-static
|
||||
/var/lib/combo-multitenant/locale
|
||||
/var/lib/combo-multitenant/media
|
||||
/var/lib/combo-multitenant/static
|
||||
/var/lib/combo-multitenant/templates
|
||||
/var/lib/combo-multitenant/tenants
|
||||
/var/log/combo-multitenant
|
|
@ -1 +0,0 @@
|
|||
debian/multitenant/nginx-example.conf
|
|
@ -1,194 +0,0 @@
|
|||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: combo-multitenant
|
||||
# Required-Start: $network $local_fs
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Portal Management System (multitenant flavor)
|
||||
# Description: Portal Management System for Entr'ouvert
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Entr'ouvert <info@entrouvert.com>
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="Portal Management System (multitenant flavor)"
|
||||
NAME=combo-multitenant
|
||||
DAEMON=/usr/bin/gunicorn
|
||||
RUN_DIR=/run/$NAME
|
||||
PIDFILE=$RUN_DIR/$NAME.pid
|
||||
LOG_DIR=/var/log/$NAME
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
BIND=unix:$RUN_DIR/$NAME.sock
|
||||
WORKERS=5
|
||||
TIMEOUT=10
|
||||
|
||||
COMBO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
|
||||
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
|
||||
|
||||
USER=$NAME
|
||||
GROUP=$NAME
|
||||
|
||||
# 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=${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=$WORKERS \
|
||||
--worker-class=sync \
|
||||
--timeout=$TIMEOUT \
|
||||
--name $NAME \
|
||||
combo.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 /run directory
|
||||
if [ ! -d $RUN_DIR ]; then
|
||||
install -d -m 755 -o $USER -g $GROUP $RUN_DIR
|
||||
fi
|
||||
|
||||
# environment for wsgi
|
||||
export COMBO_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
|
||||
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 .."
|
||||
su $USER -p -c "$MANAGE_SCRIPT migrate_schemas"
|
||||
log_action_msg ".. done"
|
||||
}
|
||||
|
||||
do_collectstatic() {
|
||||
log_action_msg "Collect static files.."
|
||||
su $USER -p -c "$MANAGE_SCRIPT 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_collectstatic
|
||||
do_migrate
|
||||
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
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
debian/multitenant/combo-multitenant-manage /usr/bin
|
||||
debian/multitenant/settings.py /etc/combo-multitenant
|
||||
debian/multitenant/debian_config.py /usr/lib/combo-multitenant
|
|
@ -1,45 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
NAME="combo-multitenant"
|
||||
USER=$NAME
|
||||
GROUP=$NAME
|
||||
CONFIG_DIR="/etc/$NAME"
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
|
||||
# make sure the administrative user exists
|
||||
if ! getent passwd $USER >/dev/null; then
|
||||
adduser --disabled-password --quiet --system \
|
||||
--no-create-home --home /var/lib/$NAME \
|
||||
--gecos "$NAME software user" --group $GROUP
|
||||
fi
|
||||
# ensure dirs ownership
|
||||
chown $USER:$GROUP /var/log/$NAME
|
||||
chown $USER:$GROUP /var/lib/$NAME/collected-static
|
||||
chown $USER:$GROUP /var/lib/$NAME/tenants
|
||||
# create a secret file
|
||||
SECRET_FILE=$CONFIG_DIR/secret
|
||||
if [ ! -f $SECRET_FILE ]; then
|
||||
echo -n "Generating Django secret..." >&2
|
||||
cat /dev/urandom | tr -dc [:alnum:]-_\!\%\^:\; | head -c70 > $SECRET_FILE
|
||||
chown root:$GROUP $SECRET_FILE
|
||||
chmod 0440 $SECRET_FILE
|
||||
fi
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
/etc/combo
|
||||
/var/lib/combo/collected-static
|
||||
/var/lib/combo/locale
|
||||
/var/lib/combo/media
|
||||
/var/lib/combo/static
|
||||
/var/lib/combo/templates
|
||||
/usr/lib/combo
|
||||
/var/lib/combo/collectstatic
|
||||
/var/lib/combo/tenants
|
||||
/var/log/combo
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
COPYING
|
||||
README
|
||||
debian/nginx-example.conf
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Portal Management System
|
||||
# Description: Portal Management System for Entr'ouvert
|
||||
# Description: Portal Management System
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Entr'ouvert <info@entrouvert.com>
|
||||
|
@ -21,7 +21,7 @@ LOG_DIR=/var/log/$NAME
|
|||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
BIND=unix:$RUN_DIR/$NAME.sock
|
||||
WORKERS=5
|
||||
TIMEOUT=10
|
||||
TIMEOUT=30
|
||||
|
||||
COMBO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
|
||||
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
|
||||
|
@ -30,7 +30,7 @@ USER=$NAME
|
|||
GROUP=$NAME
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x $DAEMON ] || exit 0
|
||||
[ -x $MANAGE_SCRIPT ] || exit 0
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
@ -118,15 +118,15 @@ do_reload() {
|
|||
}
|
||||
|
||||
do_migrate() {
|
||||
log_action_msg "Applying new migrations .."
|
||||
su $USER -p -c "$MANAGE_SCRIPT migrate --noinput"
|
||||
log_action_msg ".. done"
|
||||
log_action_msg "Applying migrations (migrate_schemas).."
|
||||
su $USER -p -c "$MANAGE_SCRIPT migrate_schemas"
|
||||
log_action_msg "done"
|
||||
}
|
||||
|
||||
do_collectstatic() {
|
||||
log_action_msg "Collect static files.."
|
||||
log_action_msg "Collect static files (collectstatic).."
|
||||
su $USER -p -c "$MANAGE_SCRIPT collectstatic --noinput"
|
||||
log_action_msg ".. done"
|
||||
log_action_msg "done"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
@ -191,4 +191,3 @@ case "$1" in
|
|||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
debian/combo-manage /usr/bin
|
||||
debian/settings.py /etc/combo
|
||||
debian/debian_config.py /usr/lib/combo
|
||||
debian/combo-manage /usr/bin
|
||||
debian/settings.py /etc/combo
|
||||
debian/debian_config.py /usr/lib/combo
|
||||
|
|
|
@ -14,12 +14,12 @@ case "$1" in
|
|||
if ! getent passwd $USER >/dev/null; then
|
||||
adduser --disabled-password --quiet --system \
|
||||
--no-create-home --home /var/lib/$NAME \
|
||||
--gecos "$NAME software user" --group $GROUP
|
||||
--gecos "$NAME user" --group $USER
|
||||
fi
|
||||
# ensure dirs ownership
|
||||
chown $USER:$GROUP /var/log/$NAME
|
||||
chown $USER:$GROUP /var/lib/$NAME/collected-static
|
||||
chown $USER:$GROUP /var/lib/$NAME/media
|
||||
chown $USER:$GROUP /var/lib/$NAME/collectstatic
|
||||
chown $USER:$GROUP /var/lib/$NAME/tenants
|
||||
# create a secret file
|
||||
SECRET_FILE=$CONFIG_DIR/secret
|
||||
if [ ! -f $SECRET_FILE ]; then
|
||||
|
@ -42,4 +42,3 @@ esac
|
|||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
|
@ -17,14 +17,6 @@ Description: Portal Management System (Python module)
|
|||
|
||||
Package: combo
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends},
|
||||
python-combo (= ${binary:Version}),
|
||||
gunicorn
|
||||
Recommends: nginx, postgresql, python-psycopg2, python-django-mellon
|
||||
Description: Portal Management System
|
||||
|
||||
Package: combo-multitenant
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends},
|
||||
python-combo (= ${binary:Version}),
|
||||
python-hobo,
|
||||
|
@ -33,4 +25,4 @@ Depends: ${misc:Depends},
|
|||
python-django-mellon,
|
||||
gunicorn
|
||||
Recommends: nginx, postgresql
|
||||
Description: Portal Management System (multitenant flavor)
|
||||
Description: Portal Management System
|
||||
|
|
|
@ -2,19 +2,98 @@
|
|||
|
||||
import os
|
||||
|
||||
ETC_DIR = '/etc/combo'
|
||||
VAR_DIR = '/var/lib/combo'
|
||||
from django.conf import global_settings
|
||||
|
||||
STATIC_ROOT = os.path.join(VAR_DIR, 'collected-static')
|
||||
STATICFILES_DIRS = (os.path.join(VAR_DIR, 'static'),)
|
||||
TEMPLATE_DIRS = (os.path.join(VAR_DIR, 'templates'),)
|
||||
LOCALE_PATHS = (os.path.join(VAR_DIR, 'locale'),) + LOCALE_PATHS
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = False
|
||||
|
||||
PROJECT_NAME = 'combo'
|
||||
|
||||
EMAIL_SUBJECT_PREFIX = '[%s] ' % PROJECT_NAME
|
||||
|
||||
# collecstatic destination
|
||||
STATIC_ROOT = os.path.join(VAR_DIR, 'collectstatic')
|
||||
|
||||
ETC_DIR = '/etc/%s' % PROJECT_NAME
|
||||
VAR_DIR = '/var/lib/%s' % PROJECT_NAME
|
||||
|
||||
# SAML2 authentication
|
||||
INSTALLED_APPS += ('mellon',)
|
||||
|
||||
SECRET_KEY = file('/etc/%s/secret' % PROJECT_NAME).read()
|
||||
|
||||
# Browsers may ensure that cookies are only sent under an HTTPS connection
|
||||
CSRF_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_SECURE = True
|
||||
|
||||
|
||||
#
|
||||
# multitenant adaptations
|
||||
#
|
||||
|
||||
TENANT_BASE = os.path.join(VAR_DIR, 'tenants')
|
||||
TENANT_MODEL = 'multitenant.Tenant'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'combo'
|
||||
'ENGINE': 'tenant_schemas.postgresql_backend',
|
||||
'NAME': PROJECT_NAME,
|
||||
}
|
||||
}
|
||||
|
||||
DATABASE_ROUTERS = (
|
||||
'tenant_schemas.routers.TenantSyncRouter',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.multitenant.middleware.TenantMiddleware',
|
||||
'hobo.multitenant.middleware.TenantSettingsMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
|
||||
TENANT_SETTINGS_MIDDLEWARE_LOADERS = (
|
||||
'hobo.multitenant.settings_loaders.TemplateVars',
|
||||
)
|
||||
|
||||
# templates in <tenant>/templates
|
||||
TEMPLATE_LOADERS = (
|
||||
'hobo.multitenant.template_loader.FilesystemLoader',
|
||||
) + global_settings.TEMPLATE_LOADERS
|
||||
TENANT_TEMPLATE_DIRS = (TENANT_BASE,)
|
||||
|
||||
# /media in <tenant>/media
|
||||
DEFAULT_FILE_STORAGE = 'hobo.multitenant.storage.TenantFileSystemStorage'
|
||||
|
||||
# SAML2: search IdP in <tenant>
|
||||
MELLON_ADAPTER = ('hobo.multitenant.mellon.MellonAdapter',)
|
||||
|
||||
# cache by tenant
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'hobo.multitenant.cache.TenantCache',
|
||||
# add a real Django cache backend, with its parameters if needed
|
||||
'REAL_BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
}
|
||||
}
|
||||
|
||||
# multitenant SHARED_APPS/TENAN_APPS/INSTALLED_APPS organization
|
||||
SHARED_APPS = (
|
||||
'hobo.multitenant',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.admin',
|
||||
)
|
||||
|
||||
TENANT_APPS = INSTALLED_APPS
|
||||
|
||||
INSTALLED_APPS = ('hobo.multitenant', 'hobo.agent.common') + INSTALLED_APPS
|
||||
|
||||
|
||||
#
|
||||
# local settings
|
||||
#
|
||||
|
||||
execfile(os.path.join(ETC_DIR, 'settings.py'))
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
NAME=combo-multitenant
|
||||
MANAGE="/usr/lib/combo/manage.py"
|
||||
|
||||
# load Debian default configuration
|
||||
export COMBO_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} "$@"
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
# This file is sourced by "execfile" from combo.settings
|
||||
|
||||
import os
|
||||
|
||||
from django.conf import global_settings
|
||||
|
||||
ETC_DIR = '/etc/combo-multitenant'
|
||||
VAR_DIR = '/var/lib/combo-multitenant'
|
||||
|
||||
STATIC_ROOT = os.path.join(VAR_DIR, 'collected-static')
|
||||
STATICFILES_DIRS = (os.path.join(VAR_DIR, 'static'),)
|
||||
TEMPLATE_DIRS = (os.path.join(VAR_DIR, 'templates'),)
|
||||
LOCALE_PATHS = (os.path.join(VAR_DIR, 'locale'),) + LOCALE_PATHS
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'tenant_schemas.postgresql_backend',
|
||||
'NAME': 'combo_multitenant'
|
||||
}
|
||||
}
|
||||
|
||||
DATABASE_ROUTERS = (
|
||||
'tenant_schemas.routers.TenantSyncRouter',
|
||||
)
|
||||
|
||||
TENANT_BASE = os.path.join(VAR_DIR, 'tenants')
|
||||
TENANT_MODEL = 'multitenant.Tenant'
|
||||
TENANT_TEMPLATE_DIRS = (TENANT_BASE,)
|
||||
|
||||
SHARED_APPS = (
|
||||
'hobo.multitenant',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.admin',
|
||||
)
|
||||
|
||||
INSTALLED_APPS += ('mellon',)
|
||||
|
||||
TENANT_APPS = INSTALLED_APPS
|
||||
|
||||
INSTALLED_APPS = ('hobo.multitenant', 'hobo.agent.common') + INSTALLED_APPS
|
||||
|
||||
TEMPLATE_LOADERS = ('hobo.multitenant.template_loader.FilesystemLoader',) + global_settings.TEMPLATE_LOADERS
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'hobo.multitenant.middleware.TenantMiddleware',
|
||||
'hobo.multitenant.middleware.JSONSettingsMiddleware',
|
||||
'hobo.middleware.context.TemplateVarsMiddleware',
|
||||
'hobo.middleware.utils.StoreRequestMiddleware',
|
||||
) + MIDDLEWARE_CLASSES
|
||||
|
||||
MELLON_ADAPTER = ('hobo.multitenant.mellon.MellonAdapter',)
|
||||
|
||||
DEFAULT_FILE_STORAGE = 'hobo.multitenant.storage.TenantFileSystemStorage'
|
||||
|
||||
execfile(os.path.join(ETC_DIR, 'settings.py'))
|
|
@ -1,59 +0,0 @@
|
|||
server {
|
||||
listen 443;
|
||||
server_name *-combo.example.org;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
||||
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
|
||||
|
||||
access_log /var/log/nginx/combo.example.org-access.log combined;
|
||||
error_log /var/log/nginx/combo.example.org-error.log;
|
||||
|
||||
location ~ ^/static/(.+)$ {
|
||||
root /;
|
||||
try_files /var/lib/combo-multitenant/tenants/$host/static/$1
|
||||
/var/lib/combo-multitenant/collected-static/$1
|
||||
=404;
|
||||
}
|
||||
|
||||
location ~ ^/media/(.+)$ {
|
||||
alias /var/lib/combo-multitenant/tenants/$host/media/$1;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://unix:/var/run/combo-multitenant/combo-multitenant.sock;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-SSL on;
|
||||
proxy_set_header X-Forwarded-Protocol ssl;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name *-combo.example.org;
|
||||
|
||||
access_log /var/log/nginx/combo.example.org-access.log combined;
|
||||
error_log /var/log/nginx/combo.example.org-error.log;
|
||||
|
||||
location ~ ^/static/(.+)$ {
|
||||
root /;
|
||||
try_files /var/lib/combo-multitenant/tenants/$host/static/$1
|
||||
/var/lib/combo-multitenant/collected-static/$1
|
||||
=404;
|
||||
}
|
||||
|
||||
location ~ ^/media/(.+)$ {
|
||||
alias /var/lib/combo-multitenant/tenants/$host/media/$1;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://unix:/var/run/combo-multitenant/combo-multitenant.sock;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
# Configuration for combo.
|
||||
# You can override Combo default settings here
|
||||
|
||||
# Combo is a Django application: for the full list of settings and their
|
||||
# values, see https://docs.djangoproject.com/en/1.7/ref/settings/
|
||||
# For more information on settings see
|
||||
# https://docs.djangoproject.com/en/1.7/topics/settings/
|
||||
|
||||
# WARNING! Quick-start development settings unsuitable for production!
|
||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
||||
|
||||
# This file is sourced by "execfile" from /usr/lib/combo-multitenant/debian_config.py
|
||||
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = file('/etc/combo-multitenant/secret').read()
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = False
|
||||
|
||||
ADMINS = (
|
||||
# ('User 1', 'watchdog@example.net'),
|
||||
# ('User 2', 'janitor@example.net'),
|
||||
)
|
||||
|
||||
# ALLOWED_HOSTS must be correct in production!
|
||||
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = [
|
||||
'*',
|
||||
]
|
||||
|
||||
# Databases
|
||||
# Default: a local database named "combo"
|
||||
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
||||
# Warning: don't change ENGINE
|
||||
# DATABASES['default']['NAME'] = 'combo-multitenant'
|
||||
# DATABASES['default']['USER'] = 'combo_multitenant'
|
||||
# DATABASES['default']['PASSWORD'] = '******'
|
||||
# DATABASES['default']['HOST'] = 'localhost'
|
||||
# DATABASES['default']['PORT'] = '5432'
|
||||
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
|
||||
# Email configuration
|
||||
EMAIL_SUBJECT_PREFIX = '[Combo] '
|
||||
# SERVER_EMAIL = 'root@combo.example.org'
|
||||
# DEFAULT_FROM_EMAIL = 'webmaster@combo.example.org'
|
||||
|
||||
# SMTP configuration
|
||||
# EMAIL_HOST = 'localhost'
|
||||
# EMAIL_HOST_USER = ''
|
||||
# EMAIL_HOST_PASSWORD = ''
|
||||
# EMAIL_PORT = 25
|
||||
|
||||
# HTTPS Security
|
||||
# CSRF_COOKIE_SECURE = True
|
||||
# SESSION_COOKIE_SECURE = True
|
|
@ -1,6 +1,6 @@
|
|||
server {
|
||||
listen 443;
|
||||
server_name combo.example.org;
|
||||
server_name *-combo.example.org;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
||||
|
@ -9,8 +9,15 @@ server {
|
|||
access_log /var/log/nginx/combo.example.org-access.log combined;
|
||||
error_log /var/log/nginx/combo.example.org-error.log;
|
||||
|
||||
location /static {
|
||||
alias /var/lib/combo/collected-static;
|
||||
location ~ ^/static/(.+)$ {
|
||||
root /;
|
||||
try_files /var/lib/combo/tenants/$host/static/$1
|
||||
/var/lib/combo/collectstatic/$1
|
||||
=404;
|
||||
}
|
||||
|
||||
location ~ ^/media/(.+)$ {
|
||||
alias /var/lib/combo/tenants/$host/media/$1;
|
||||
}
|
||||
|
||||
location / {
|
||||
|
@ -26,13 +33,20 @@ server {
|
|||
|
||||
server {
|
||||
listen 80;
|
||||
server_name combo.example.org;
|
||||
server_name *-combo.example.org;
|
||||
|
||||
access_log /var/log/nginx/combo.example.org-access.log combined;
|
||||
error_log /var/log/nginx/combo.example.org-error.log;
|
||||
|
||||
location /static {
|
||||
alias /var/lib/combo/collected-static;
|
||||
location ~ ^/static/(.+)$ {
|
||||
root /;
|
||||
try_files /var/lib/combo/tenants/$host/static/$1
|
||||
/var/lib/combo/collectstatic/$1
|
||||
=404;
|
||||
}
|
||||
|
||||
location ~ ^/media/(.+)$ {
|
||||
alias /var/lib/combo/tenants/$host/media/$1;
|
||||
}
|
||||
|
||||
location / {
|
||||
|
@ -42,4 +56,3 @@ server {
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
|
|
@ -1 +1,2 @@
|
|||
usr/lib/python*/*-packages
|
||||
usr/bin/manage.py /usr/lib/combo
|
||||
usr/lib/python2*/*-packages
|
||||
|
|
|
@ -4,11 +4,5 @@
|
|||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
PYTHON_COMBO_DIR=$(CURDIR)/debian/python-combo
|
||||
|
||||
%:
|
||||
dh $@ --with python2
|
||||
|
||||
override_dh_install:
|
||||
dh_install
|
||||
mv $(CURDIR)/debian/tmp/usr/bin/manage.py $(PYTHON_COMBO_DIR)/usr/lib/combo/manage.py
|
||||
|
|
|
@ -11,18 +11,14 @@
|
|||
|
||||
# This file is sourced by "execfile" from /usr/lib/combo/debian_config.py
|
||||
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = file('/etc/combo/secret').read()
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = False
|
||||
|
||||
ADMINS = (
|
||||
# ('User 1', 'watchdog@example.net'),
|
||||
# ('User 2', 'janitor@example.net'),
|
||||
)
|
||||
#ADMINS = (
|
||||
# # ('User 1', 'watchdog@example.net'),
|
||||
# # ('User 2', 'janitor@example.net'),
|
||||
#)
|
||||
|
||||
# ALLOWED_HOSTS must be correct in production!
|
||||
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
|
@ -30,10 +26,10 @@ ALLOWED_HOSTS = [
|
|||
'*',
|
||||
]
|
||||
|
||||
# Combo use a postgresql database by default
|
||||
# Databases
|
||||
# Default: a local database named "combo"
|
||||
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
||||
# DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
|
||||
# Warning: don't change ENGINE
|
||||
# DATABASES['default']['NAME'] = 'combo'
|
||||
# DATABASES['default']['USER'] = 'combo'
|
||||
# DATABASES['default']['PASSWORD'] = '******'
|
||||
|
@ -44,7 +40,7 @@ LANGUAGE_CODE = 'fr-fr'
|
|||
TIME_ZONE = 'Europe/Paris'
|
||||
|
||||
# Email configuration
|
||||
EMAIL_SUBJECT_PREFIX = '[Combo] '
|
||||
# EMAIL_SUBJECT_PREFIX = '[combo] '
|
||||
# SERVER_EMAIL = 'root@combo.example.org'
|
||||
# DEFAULT_FROM_EMAIL = 'webmaster@combo.example.org'
|
||||
|
||||
|
|
Loading…
Reference in New Issue