tests: passerelle etape 1
This commit is contained in:
parent
205bc449d6
commit
021b647e3d
|
@ -0,0 +1,7 @@
|
|||
<services>
|
||||
<service name="download_url">
|
||||
<param name="host">repos.entrouvert.org</param>
|
||||
<param name="protocol">http</param>
|
||||
<param name="path">/passerelle.git/snapshot/passerelle-5bed322.tar.gz</param>
|
||||
</service>
|
||||
</services>
|
|
@ -0,0 +1,34 @@
|
|||
# This file is sourced by "execfile" from passerelle.settings
|
||||
|
||||
SECRET_KEY = file('/etc/passerelle/secret').read()
|
||||
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
|
||||
STATIC_ROOT = '/usr/share/passerelle/static'
|
||||
STATIC_URL = '/passerelle/static/'
|
||||
MEDIA_ROOT = '/var/lib/passerelle/media'
|
||||
MEDIA_URL = '/passerelle/media/'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'passerelle',
|
||||
}
|
||||
}
|
||||
|
||||
# add solis and makorepost just before gadjo
|
||||
INSTALLED_APPS = INSTALLED_APPS[:-1] + (
|
||||
'solis',
|
||||
'makorepost',
|
||||
'gadjo',
|
||||
)
|
||||
|
||||
# where to find templates for makorepost objects
|
||||
MAKO_TEMPLATES_DIRS = (
|
||||
os.path.join(PACKAGE_PATH, 'apps', 'makorepost', 'templates.mako'),
|
||||
os.path.join(PACKAGE_PATH, 'apps', 'solis', 'templates.mako'),
|
||||
)
|
||||
MAKO_TEMPLATES_MODULES = None # store generated Mako module files in this directory (optional)
|
||||
|
||||
execfile('/etc/passerelle/config.py')
|
|
@ -0,0 +1,41 @@
|
|||
# Configuration for passerelle.
|
||||
# You can override Passerelle default settings here
|
||||
|
||||
# Passerelle 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/
|
||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
||||
|
||||
# This file is sourced by "execfile" from /usr/lib/passerelle/cg14_config.py
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = False
|
||||
|
||||
# mailto for fatal errors (500)
|
||||
ADMINS = (
|
||||
('admin passerelle', 'passerelle-admin@calvados.fr'),
|
||||
# ('User 1', 'watchdog@example.net'),
|
||||
# ('User 2', 'janitor@example.net'),
|
||||
)
|
||||
MANAGERS = ADMINS
|
||||
|
||||
# ALLOWED_HOSTS must be correct in production
|
||||
ALLOWED_HOSTS = ['*'] # cg14: we are behind a pile of reverse proxies... :/
|
||||
#See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
#ALLOWED_HOSTS = [
|
||||
# 'teleservices.calvados.fr',
|
||||
# 'teleservices.calvados.fr.',
|
||||
# 'internal-reverse-proxy-name',
|
||||
# 'internal-reverse-proxy-name.',
|
||||
#]
|
||||
|
||||
# Passerelle use a postgresql database
|
||||
# Default: a local database named "passerelle"
|
||||
# DATABASES['default']['name'] = 'passerelle'
|
||||
# DATABASES['default']['user'] = 'passerelle'
|
||||
# DATABASES['default']['password'] = '******'
|
||||
# DATABASES['default']['host'] = 'localhost'
|
||||
# DATABASES['default']['port'] = '5432'
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
# CG14 /etc/passerelle/local_settings.py
|
||||
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
# traceback recipients if DEBUG=False
|
||||
ADMINS = (
|
||||
# ('root', 'root@localhost'),
|
||||
('admin passerelle', 'passerelle-admin@calvados.fr'),
|
||||
)
|
||||
MANAGERS = ADMINS
|
||||
|
||||
# we're behind a pile of reverse-proxies...
|
||||
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
# Local time zone for this installation. Choices can be found here:
|
||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||
# although not all choices may be available on all operating systems.
|
||||
# In a Windows environment this must be set to your system time zone.
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
|
||||
# Language code for this installation. All choices can be found here:
|
||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
|
||||
#
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'passerelle',
|
||||
}
|
||||
}
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.admin',
|
||||
'passerelle.base',
|
||||
'passerelle.datasources',
|
||||
'passerelle.repost',
|
||||
'solis',
|
||||
'makorepost',
|
||||
'south',
|
||||
)
|
||||
|
||||
MEDIA_ROOT = '/var/lib/passerelle/media'
|
||||
MEDIA_URL = '/passerelle/media/'
|
||||
|
||||
STATIC_ROOT = '/usr/share/passerelle/static'
|
||||
STATIC_URL = '/passerelle/static/'
|
||||
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
NAME=passerelle
|
||||
MANAGE="/usr/lib/$NAME/manage.py --config=/usr/lib/${NAME}/cg14_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} "$@"
|
||||
|
|
@ -27,40 +27,57 @@ PIDFILE=/var/run/$NAME/$NAME.pid
|
|||
LOGFILE=/var/log/$NAME/gunicorn.log
|
||||
USER=passerelle
|
||||
GROUP=passerelle
|
||||
MANAGEPY=/usr/bin/${NAME}_manage.py
|
||||
MANAGE=/usr/bin/${NAME}-manage
|
||||
STARTLOG=/var/log/passerelle/start.log
|
||||
|
||||
lockfile=/var/lock/subsys/$NAME
|
||||
|
||||
GUNICORN_OPTIONS="--bind 127.0.0.1:8484 --workers=3"
|
||||
DJANGO_SETTINGS_MODULE=passerelle.settings
|
||||
DJANGO_CONFIG_FILE=/usr/lib/$NAME/cg14_config.py
|
||||
|
||||
DAEMON_OPTIONS="--bind 127.0.0.1:8484 --workers=3"
|
||||
|
||||
[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
||||
|
||||
do_create_secret() {
|
||||
SECRET_FILE=/etc/passerelle/secret
|
||||
if [ ! -f $SECRET_FILE ]; then
|
||||
echo "Generating Django secret..."
|
||||
cat /dev/urandom | tr -dc [:alnum:]-_\!\%\^:\; | head -c70 > $SECRET_FILE
|
||||
chown root:passerelle $SECRET_FILE
|
||||
chmod 0440 $SECRET_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
do_migrate() {
|
||||
# install new applications, if any, migrate others if needed
|
||||
echo "Applying new migrations (syncdb --migrate)..."
|
||||
$SCRIPTNAME manage syncdb --migrate --verbosity=2 --traceback --noinput
|
||||
}
|
||||
|
||||
do_collectstatic() {
|
||||
echo "Collect static files..."
|
||||
chown -R passerelle:passerelle /usr/share/passerelle/static
|
||||
$SCRIPTNAME manage collectstatic --clear --verbosity=2 --traceback --noinput
|
||||
chown -R root:root /usr/share/passerelle/static
|
||||
}
|
||||
|
||||
start() {
|
||||
[ -x $DAEMON ] || exit 5
|
||||
|
||||
# CG14 HACK -- first launch after South installation : fake migrations
|
||||
# (to be removed)
|
||||
if test ! -f /etc/passerelle/migrate-fake-done; then
|
||||
# install south tables
|
||||
$SCRIPTNAME manage syncdb --noinput && \
|
||||
$SCRIPTNAME manage migrate --fake --noinput && \
|
||||
touch /etc/passerelle/migrate-fake-done
|
||||
fi
|
||||
if test ! -f /etc/passerelle/migrate-fake-done; then
|
||||
echo "ERR: migrate --fake failed"
|
||||
echo "ERR: /etc/passerelle/migrate-fake-done file"
|
||||
exit 1
|
||||
fi
|
||||
date > $STARTLOG
|
||||
do_create_secret >> $STARTLOG 2>&1
|
||||
do_migrate >> $STARTLOG 2>&1
|
||||
do_collectstatic >> $STARTLOG 2>&1
|
||||
|
||||
# install new applications, if any
|
||||
$SCRIPTNAME manage syncdb --migrate --noinput
|
||||
|
||||
echo $"Starting $NAME: "
|
||||
echo $"Starting $NAME (via gunicorn): "
|
||||
daemon $DAEMON --daemon \
|
||||
--pid $PIDFILE \
|
||||
--user $USER --group $GROUP \
|
||||
--error-logfile $LOGFILE \
|
||||
$GUNICORN_OPTIONS \
|
||||
--env DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE \
|
||||
--env DJANGO_CONFIG_FILE=$DJANGO_CONFIG_FILE \
|
||||
$DAEMON_OPTIONS \
|
||||
passerelle.wsgi:application
|
||||
retval=$?
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
|
@ -129,9 +146,9 @@ case "$1" in
|
|||
manage)
|
||||
shift
|
||||
if [ $(id -un) != $USER ]; then
|
||||
sudo -H -u $USER $MANAGEPY "$@"
|
||||
sudo -H -u $USER $MANAGE "$@"
|
||||
else
|
||||
$MANAGEPY "$@"
|
||||
$MANAGE "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
%define tag 0.3.0
|
||||
%define commit 9863723
|
||||
%define tag 0.5.0
|
||||
%define commit 5bed322
|
||||
# si possible, minor = nombre de commit depuis le tag (à la "git describe")
|
||||
%define minor 1
|
||||
%define minor 33
|
||||
|
||||
# si minor == 0
|
||||
#%define version %{tag}
|
||||
|
@ -19,18 +19,20 @@ Summary: Uniform access to multiple data sources and services.
|
|||
Group: Development/Languages
|
||||
License: AGPL
|
||||
URL: https://dev.entrouvert.org/projects/passerelle
|
||||
Source0: passerelle-9863723_with-initial-base-migration.tar.gz
|
||||
Source0: passerelle-%{commit}.tar.gz
|
||||
Source1: passerelle.init
|
||||
Source2: local_settings.py
|
||||
Source2: config.py
|
||||
Source3: synchro-wcs-suivi.sh
|
||||
Source4: synchro-wcs-suivi.conf
|
||||
Source5: synchro-cron.sh
|
||||
Source6: wcs-au-quotidien.cron.d
|
||||
Source7: passerelle-manage
|
||||
Source8: cg14_config.py
|
||||
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: python2-devel python-django python-setuptools-devel
|
||||
Requires: python-django python-South python-django-jsonresponse python-django-model-utils python-gunicorn python-Mako python-raven
|
||||
Requires: python-django python-South python-django-jsonresponse python-django-model-utils python-gunicorn python-Mako python-raven python-django-gadjo python-requests python-django-jsonfield
|
||||
|
||||
%description
|
||||
Passerelle provides an uniform access to multiple data sources and services.
|
||||
|
@ -44,6 +46,8 @@ getent passwd passerelle >/dev/null || useradd -r -g passerelle -s /sbin/nologin
|
|||
install -d -m 0750 -o passerelle -g passerelle /var/run/passerelle
|
||||
install -d -m 0750 -o passerelle -g passerelle /var/log/passerelle
|
||||
install -d -m 0750 -o passerelle -g passerelle /var/lib/passerelle/media
|
||||
install -d -m 0750 -o passerelle -g passerelle /usr/share/lib/passerelle/static
|
||||
chown -R passerelle:passerelle /usr/share/lib/passerelle/static
|
||||
exit 0
|
||||
|
||||
%build
|
||||
|
@ -51,20 +55,21 @@ exit 0
|
|||
|
||||
%install
|
||||
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
|
||||
install -d -m 0755 $RPM_BUILD_ROOT/usr/lib/passerelle
|
||||
mv $RPM_BUILD_ROOT/usr/bin/manage.py $RPM_BUILD_ROOT/usr/lib/passerelle/manage.py
|
||||
install -D -p -m 755 %{SOURCE8} $RPM_BUILD_ROOT/usr/lib/passerelle/cg14_config.py
|
||||
install -D -p -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/bin/passerelle-manage
|
||||
install -d -m 0755 $RPM_BUILD_ROOT/etc/passerelle
|
||||
install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/passerelle/local_settings.py
|
||||
install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/passerelle/config.py
|
||||
install -D -p -m 755 %{SOURCE3} $RPM_BUILD_ROOT/etc/passerelle/synchro-wcs-suivi.sh
|
||||
install -D -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT/etc/passerelle/synchro-wcs-suivi.conf
|
||||
install -D -p -m 755 %{SOURCE5} $RPM_BUILD_ROOT/etc/passerelle/synchro-cron.sh
|
||||
install -D -p -m 644 %{SOURCE6} $RPM_BUILD_ROOT/etc/cron.d/wcs-au-quotidien
|
||||
ln -s /etc/passerelle/local_settings.py $RPM_BUILD_ROOT/%{python_sitelib}/passerelle/local_settings.py
|
||||
install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/rc.d/init.d/passerelle
|
||||
install -d -m 0755 $RPM_BUILD_ROOT/usr/share/passerelle/static
|
||||
install -d -m 0755 $RPM_BUILD_ROOT/usr/share/passerelle/templates.mako
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add passerelle
|
||||
/usr/bin/passerelle_manage.py collectstatic --noinput
|
||||
|
||||
%preun
|
||||
if [ $1 -eq 0 ]; then
|
||||
|
@ -84,11 +89,12 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%{python_sitelib}/passerelle
|
||||
%{python_sitelib}/passerelle-*.egg-info
|
||||
%{_sysconfdir}/rc.d/init.d/passerelle
|
||||
/usr/share/passerelle/static
|
||||
/usr/bin/passerelle_manage.py
|
||||
/usr/bin/passerelle-manage
|
||||
/usr/lib/passerelle/manage.py
|
||||
/usr/lib/passerelle/cg14_config.py
|
||||
/etc/passerelle/synchro-cron.sh
|
||||
/etc/passerelle/synchro-wcs-suivi.sh
|
||||
%config /etc/passerelle/local_settings.py
|
||||
%config /etc/passerelle/config.py
|
||||
%config /etc/passerelle/synchro-wcs-suivi.conf
|
||||
%config /etc/cron.d/wcs-au-quotidien
|
||||
%doc LICENSE
|
||||
|
|
|
@ -15,7 +15,7 @@ HOME=/
|
|||
# * * * * * user-name command to be executed
|
||||
|
||||
# production
|
||||
10,30,50 * * * * wcs-au-quotidien /etc/passerelle/synchro-cron.sh
|
||||
# 10,30,50 * * * * wcs-au-quotidien /etc/passerelle/synchro-cron.sh
|
||||
|
||||
# test/recette
|
||||
# 0,5,10,15,20,25,30,35,40,45,50,55 * * * * wcs-au-quotidien /etc/passerelle/synchro-cron.sh
|
||||
|
|
Reference in New Issue