# HG changeset patch # User Thierry Florac # Date 1545912827 -3600 # Node ID 31b1b24e105c95c90e776aa98c11845d2aa4b375 # Parent 7d06fc8ea7826efd39aa45b44cc33420c2bea5a7 Added option to handle Apache's HTTPS configuration diff -r 7d06fc8ea782 -r 31b1b24e105c cookiecutter.json --- a/cookiecutter.json Wed Nov 21 09:40:36 2018 +0100 +++ b/cookiecutter.json Thu Dec 27 13:13:47 2018 +0100 @@ -3,6 +3,7 @@ "project_name": "PyAMS", "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}", "virtual_hostname": "{{ cookiecutter.project_slug }}.mydomain.com", + "use_https": true, "webapp_name": "webapp", "webapp_port": 6543, "eggs_directory": "eggs", diff -r 7d06fc8ea782 -r 31b1b24e105c {{cookiecutter.project_slug}}/etc/apache2.2/{{cookiecutter.project_slug}}.conf --- a/{{cookiecutter.project_slug}}/etc/apache2.2/{{cookiecutter.project_slug}}.conf Wed Nov 21 09:40:36 2018 +0100 +++ b/{{cookiecutter.project_slug}}/etc/apache2.2/{{cookiecutter.project_slug}}.conf Thu Dec 27 13:13:47 2018 +0100 @@ -5,6 +5,19 @@ ServerAdmin webmaster@localhost ServerName {{ cookiecutter.virtual_hostname }} +{%- if cookiecutter.use_https.lower() in ('true','on','yes','1') %} + + RewriteEngine on + RewriteRule (.*) https://{{ cookiecutter.virtual_hostname}}$1 + + + + + + ServerAdmin webmaster@localhost + ServerName {{ cookiecutter.virtual_hostname }} +{%- endif %} + DocumentRoot $((INSTALL))/var/htdocs ErrorLog {{ cookiecutter.logs_directory }}/{{ cookiecutter.project_slug }}-error.log @@ -28,4 +41,23 @@ Allow from all +{%- if cookiecutter.use_notifications.lower() in ('true','on','yes','1') %} + + RewriteEngine on + + RewriteCond %{HTTP:Upgrade} =websocket [NC] + RewriteRule /(.*) ws://{{ cookiecutter.pyams_ws_notify }}/$1 [P,L] +{%- endif %} + +{%- if cookiecutter.use_https.lower() in ('true','on','yes','1') %} + + SSLEngine on +{%- if cookiecutter.use_notifications.lower() in ('true','on','yes','1') %} + SSLProxyEngine on +{%- endif %} + + SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem + SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key +{%- endif %} + diff -r 7d06fc8ea782 -r 31b1b24e105c {{cookiecutter.project_slug}}/etc/apache2.4/{{cookiecutter.project_slug}}.conf --- a/{{cookiecutter.project_slug}}/etc/apache2.4/{{cookiecutter.project_slug}}.conf Wed Nov 21 09:40:36 2018 +0100 +++ b/{{cookiecutter.project_slug}}/etc/apache2.4/{{cookiecutter.project_slug}}.conf Thu Dec 27 13:13:47 2018 +0100 @@ -5,6 +5,19 @@ ServerAdmin webmaster@localhost ServerName {{ cookiecutter.virtual_hostname }} +{%- if cookiecutter.use_https.lower() in ('true','on','yes','1') %} + + RewriteEngine on + RewriteRule (.*) https://{{ cookiecutter.virtual_hostname}}$1 + + + + + + ServerAdmin webmaster@localhost + ServerName {{ cookiecutter.virtual_hostname }} +{%- endif %} + DocumentRoot $((INSTALL))/var/htdocs ErrorLog {{ cookiecutter.logs_directory }}/{{ cookiecutter.project_slug }}-error.log @@ -26,4 +39,23 @@ Require all granted +{%- if cookiecutter.use_notifications.lower() in ('true','on','yes','1') %} + + RewriteEngine on + + RewriteCond %{HTTP:Upgrade} =websocket [NC] + RewriteRule /(.*) ws://{{ cookiecutter.pyams_ws_notify }}/$1 [P,L] +{%- endif %} + +{%- if cookiecutter.use_https.lower() in ('true','on','yes','1') %} + + SSLEngine on +{%- if cookiecutter.use_notifications.lower() in ('true','on','yes','1') %} + SSLProxyEngine on +{%- endif %} + + SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem + SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key +{%- endif %} + diff -r 7d06fc8ea782 -r 31b1b24e105c {{cookiecutter.project_slug}}/etc/development.ini --- a/{{cookiecutter.project_slug}}/etc/development.ini Wed Nov 21 09:40:36 2018 +0100 +++ b/{{cookiecutter.project_slug}}/etc/development.ini Thu Dec 27 13:13:47 2018 +0100 @@ -231,9 +231,15 @@ # pyams_content.config.forms_tool_factory = pyams_content.shared.form.manager.FormsManager # pyams_content.config.forms_tool_name = forms +# pyams_content.config.resources_tool_factory = pyams_content.shared.resource.manager.ResourceManager +# pyams_content.config.resources_tool_name = resources + # pyams_content.config.news_tool_factory = pyams_content.shared.news.manager.NewsManager # pyams_content.config.news_tool_name = news +# pyams_content.config.topics_tool_factory = pyams_content.shared.topic.manager.TopicManager +# pyams_content.config.topics_tool_name = topics + ## Shared contents configuration ## Default factories are defined into PyAMS_content package via factory adapters. ## You can override default factory by defining these settings or by providing your own adapters. diff -r 7d06fc8ea782 -r 31b1b24e105c {{cookiecutter.project_slug}}/etc/production.ini --- a/{{cookiecutter.project_slug}}/etc/production.ini Wed Nov 21 09:40:36 2018 +0100 +++ b/{{cookiecutter.project_slug}}/etc/production.ini Thu Dec 27 13:13:47 2018 +0100 @@ -226,9 +226,15 @@ # pyams_content.config.forms_tool_factory = pyams_content.shared.form.manager.FormsManager # pyams_content.config.forms_tool_name = forms +# pyams_content.config.resources_tool_factory = pyams_content.shared.resource.manager.ResourceManager +# pyams_content.config.resources_tool_name = resources + # pyams_content.config.news_tool_factory = pyams_content.shared.news.manager.NewsManager # pyams_content.config.news_tool_name = news +# pyams_content.config.topics_tool_factory = pyams_content.shared.topic.manager.TopicManager +# pyams_content.config.topics_tool_name = topics + ## Shared contents configuration ## Default factories are defined into PyAMS_content package via factory adapters. ## You can override default factory by defining these settings or by providing your own adapters.