From 1dac21bd2f93ea1d67314e6678d4e086b1ac3c24 Mon Sep 17 00:00:00 2001 From: Marco Mariani <marco.mariani@nexedi.com> Date: Thu, 12 Jun 2014 11:23:31 +0200 Subject: [PATCH] abilian: add and test production conf template --- .../extranet_spr/instance-environment.cfg.in | 2 +- .../extranet_spr/instance-extranet.cfg.in | 14 +++++- software/abilian/extranet_spr/software.cfg | 15 ++++-- .../extranet_spr/template/production.py.in | 46 +++++++++++++++++++ 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 software/abilian/extranet_spr/template/production.py.in diff --git a/software/abilian/extranet_spr/instance-environment.cfg.in b/software/abilian/extranet_spr/instance-environment.cfg.in index 1ff19d1cb..b9b773033 100644 --- a/software/abilian/extranet_spr/instance-environment.cfg.in +++ b/software/abilian/extranet_spr/instance-environment.cfg.in @@ -12,7 +12,7 @@ PGUSER=postgres ABILIAN_CONFIG=${abilian-config:location}/${abilian-config:filename} EXTRANET_INSTANCE_PATH=$${directories:extranet_spr-instance} EXTRANET_INSTANCE_HOST=$${instance-parameters:ipv6-random} -ABILIAN_CONFIG_EXTRA_PYTHON=$${config-staging-py:rendered} +ABILIAN_CONFIG_EXTRA_PYTHON=$${config-production-py:rendered} ABILIAN_CONFIG_EXTRA_JSON=$${json-extra-configuration:json-output}:$${buildout:directory}/partition-parameters.json LD_LIBRARY_PATH=${cairo:location}/lib:${glib:location}/lib:${pango:location}/lib:${cups:location}/lib:${dbus:location}/lib:${dbus-glib:location}/lib:${fontconfig:location}/lib # abilian/services/conversion.py does not like it, if PATH does not exist diff --git a/software/abilian/extranet_spr/instance-extranet.cfg.in b/software/abilian/extranet_spr/instance-extranet.cfg.in index 68d407c44..98868ef5e 100644 --- a/software/abilian/extranet_spr/instance-extranet.cfg.in +++ b/software/abilian/extranet_spr/instance-extranet.cfg.in @@ -5,6 +5,7 @@ parts = extranet-service extranet-promise config-staging-py + config-production-py csrf-secret-key @@ -32,6 +33,10 @@ template = inline: echo "Configuration file $${config-staging-py:rendered} does not exist (yet?)" >&2 exit 30 } + [ -f "$${config-production-py:rendered}" ] || { + echo "Configuration file $${config-production-py:rendered} does not exist (yet?)" >&2 + exit 40 + } exec {{abilian}} run rendered = $${directories:services}/abilian-start mode = 700 @@ -40,7 +45,6 @@ context = raw abilian ${buildout:directory}/bin/abilian - [extranet-promise] recipe = slapos.cookbook:check_port_listening path = $${directories:promises}/extranet @@ -57,6 +61,14 @@ mode = 600 # section config config-staging +[config-production-py] +recipe = slapos.recipe.template:jinja2 +template = ${config-production-py-template:location}/${config-production-py-template:filename} +rendered = $${buildout:directory}/etc/production.py +mode = 600 + + + [csrf-secret-key] recipe = slapos.cookbook:generate.password #no need to write other than in the json parameter file diff --git a/software/abilian/extranet_spr/software.cfg b/software/abilian/extranet_spr/software.cfg index 2480028c8..37f8b8194 100644 --- a/software/abilian/extranet_spr/software.cfg +++ b/software/abilian/extranet_spr/software.cfg @@ -63,6 +63,7 @@ parts = instance-postgres instance-redis config-staging-py-template + config-production-py-template abilian-config @@ -249,14 +250,14 @@ mode = 0644 recipe = slapos.recipe.template url = ${:_profile_base_location_}/instance-extranet.cfg.in output = ${buildout:directory}/instance-extranet.cfg -md5sum = c4e4727a36c5552631e50f98c4079344 +md5sum = d39a2a7348866130ef4c63857e0f2945 mode = 0644 [instance-environment] recipe = slapos.recipe.template url = ${:_profile_base_location_}/instance-environment.cfg.in output = ${buildout:directory}/instance-environment.cfg -md5sum = 25ba374fe46091e25d1bc8197feb8f53 +md5sum = a595fecd06cd4d4f806fddb7f686e8db mode = 0644 @@ -281,8 +282,14 @@ download-only = true mode = 0644 - - +[config-production-py-template] +recipe = hexagonit.recipe.download +url = ${:_profile_base_location_}/template/${:filename} +md5sum = 3fe482f39895fe1beb6a4dbf0abb6ad4 +location = ${buildout:parts-directory}/${:_buildout_section_name_} +filename = production.py.in +download-only = true +mode = 0644 [versions] diff --git a/software/abilian/extranet_spr/template/production.py.in b/software/abilian/extranet_spr/template/production.py.in new file mode 100644 index 000000000..f3c84f398 --- /dev/null +++ b/software/abilian/extranet_spr/template/production.py.in @@ -0,0 +1,46 @@ +# coding=utf-8 +""" +""" +from __future__ import absolute_import + +SERVER_NAME = 'extranet2.systematic-paris-region.org' +PRODUCTION = True +DEBUG = False +TESTING = False +CSRF_ENABLED = True + +LOGGING_CONFIG_FILE = 'logging-production.yml' + +SQL_QUERIES_COUNT_ALERT = 150 + +#SQLALCHEMY_DATABASE_URI = +SQLALCHEMY_ECHO = False + +#API_KEY = +#SECRET_KEY = +#SALT = + +WHOOSH_BASE = 'data/whoosh' + +SITE_NAME = u'SPR' + +#SENTRY_DSN = + +MAIL_SENDER = u'extranet-admin@systematic-paris-region.org' +BULK_MAIL_SENDER = u'noreply@systematic-paris-region.org' +MAIL_FAIL_SILENTLY = False + +PREFERRED_URL_SCHEME = 'https' + +#UNOCONV_LOCATION = + +# celery settings +#BROKER_URL = +#CELERY_RESULT_BACKEND = +CELERYD_CONCURRENCY = 2 +CELERYD_PREFETCH_MULTIPLIER = 1 + +# in particular periodic tasks should be listed here +CELERY_IMPORTS = [ + 'extranet_spr.apps.notifications.views', + ] -- 2.30.9