[cubicweb/pyramid] add generation pyramid.ini file
authorArthur Lutz <arthur.lutz@logilab.fr>
Tue, 29 Nov 2016 15:24:17 +0100
changeset 92 2598a63800b3
parent 91 737b2752633a
child 93 c864a52ea401
[cubicweb/pyramid] add generation pyramid.ini file
cubicweb/instances.sls
cubicweb/pyramid/init.sls
cubicweb/pyramid/pyramid.ini
pillar.example
--- a/cubicweb/instances.sls	Tue Nov 29 15:23:43 2016 +0100
+++ b/cubicweb/instances.sls	Tue Nov 29 15:24:17 2016 +0100
@@ -4,18 +4,19 @@
  {% for name, config in vhost.iteritems() %}
    {% if 'cwapp_uwsgi_options' in config %}
   - cubicweb.uwsgi
+   {% break %}
    {% endif %}
  {% endfor %}
 {% endfor %}
 
 
 {% for extrasrc in salt['pillar.get']('extra_sources', ()) %}
-{% if 'https' in  extrasrc %}
+  {% if 'https' in  extrasrc %}
 apt-transport-https:
   pkg:
     - installed
-{% break %}
-{% endif %}
+  {% break %}
+  {% endif %}
 {% endfor %}
 
 {% for vhostname, vhost in pillar['cubicweb_apps'].iteritems() %}
@@ -39,6 +40,10 @@
     - base-url: {{config.cwapp.get('basepath', '/')}}
     - require:
       - pkg: cw-{{vhostname}}-{{name}}
+    {% if 'cwapp_uwsgi_options' in config %}
+    - watch:
+        - service: uwsgi
+    {% endif %}
   pkg.installed:
     - pkgs:
         {% for pkg in config.cwapp.cubes.values() -%}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/pyramid/init.sls	Tue Nov 29 15:24:17 2016 +0100
@@ -0,0 +1,18 @@
+{% for vhostname, vhost in pillar['cubicweb_apps'].iteritems() %}
+ {% for name, config in vhost.iteritems() %}
+/etc/cubicweb.d/{{ name }}/pyramid.ini:
+  file.managed:
+    - source: salt://pyramid/pyramid.ini
+    - template: jinja
+    - context:
+        config: {{ config }}
+        name: {{ name }}
+    {% if 'cwapp_uwsgi_options' in config %}
+    - watch:
+        - service: uwsgi
+
+include:
+  - cubicweb.uwsgi
+    {% endif %}
+  {% endfor %}
+{% endfor %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cubicweb/pyramid/pyramid.ini	Tue Nov 29 15:24:17 2016 +0100
@@ -0,0 +1,14 @@
+[main]
+cubicweb.includes =
+    pyramid_cubicweb.auth
+    pyramid_cubicweb.login
+{% for include in config.pyramid.includes %}
+    {{ include }}
+{% endfor %}
+
+cubicweb.profile = no
+cubicweb.sessions.secret = {{ config.pyramid.sessions_secret }}
+cubicweb.auth.authtkt.session.secret = {{ config.pyramid.authtk_session_secret }}
+cubicweb.auth.authtkt.session.secure = False
+cubicweb.auth.authtkt.persistent.secret = {{ config.pyramid.authtk_persistent_secret }}
+cubicweb.auth.authtkt.persistent.secure = False
\ No newline at end of file
--- a/pillar.example	Tue Nov 29 15:23:43 2016 +0100
+++ b/pillar.example	Tue Nov 29 15:24:17 2016 +0100
@@ -66,6 +66,12 @@
       cwapp_uwsgi_options:
         workers: 2
         threads: 8
+      pyramid:
+        sessions_secret: CHANGEME
+        authtk_sessions_secret: CHANGEME
+        authtk_persistent_secret: CHANGEME
+        #includes:
+        #  - cubes.app.extra
     demo2:
       database:
         name: cw_demo2