diff --git a/configure_nginx.yml b/configure_nginx.yml index 0ec77d152c54ef8be727eb1b49e1ba2a095b0bae..73e48990cbd6f31d2d17ea41d88cbdc609285e7e 100755 --- a/configure_nginx.yml +++ b/configure_nginx.yml @@ -40,6 +40,7 @@ owner: root group: root mode: "0644" + notify: restart nginx - name: create symlinks for nginx vhosts confs file: @@ -61,6 +62,7 @@ group: root mode: "0644" with_dict: "{{ otree_users }}" + notify: restart nginx - name: create symlinks for nginx vhosts confs file: @@ -87,5 +89,5 @@ - name: restart nginx service: name: nginx - state: restarted + state: reloaded diff --git a/configure_otree.yml b/configure_otree.yml index addc912b849d39300affa6efdd84636eb875c3a8..91739712f846f28a6576123c62695520b97d4d50 100755 --- a/configure_otree.yml +++ b/configure_otree.yml @@ -134,7 +134,7 @@ chdir: "{{ home_path }}/{{ item.key }}/otree/" executable: /bin/bash environment: - DATABASE_URL: "{{ item.value.database }}" + DATABASE_URL: "postgres://{{ item.key }}:{{ item.value.admin_pw }}@localhost:5432/instance_{{ item.key }}" REDIS_URL: "{{ item.value.redis }}" OTREE_ADMIN_PASSWORD: "{{ item.value.admin_pw }}" OTREE_AUTH_LEVEL: "{{ item.value.auth_level }}" diff --git a/templates/nginx_default_site.conf.j2 b/templates/nginx_default_site.conf.j2 index 02e732dea238f740d3a9693fa82ba72374029f71..c30882b155736475476c4c8470df8e859407365a 100755 --- a/templates/nginx_default_site.conf.j2 +++ b/templates/nginx_default_site.conf.j2 @@ -21,7 +21,7 @@ server { ssl_certificate_key {{ ssl_certificate_key_path }}; location / { - return 301 {{ default_redirection }}; + return {% if default_redirection is defined %}301 {{ default_redirection }}{% else %}403{% endif %}; } } diff --git a/templates/supervisor_otree.conf.j2 b/templates/supervisor_otree.conf.j2 index dd1115949ed68233b5d6e112f7ec244b88d2842e..bf36ae2b0f103a76b3ab48a8ba26c89e7a301fc1 100755 --- a/templates/supervisor_otree.conf.j2 +++ b/templates/supervisor_otree.conf.j2 @@ -1,7 +1,7 @@ [program:{{ item.key }}] directory={{ home_path }}/{{ item.key }}/otree/ command=/bin/bash -c "source {{ home_path }}/{{ item.key }}/.venv_otree/bin/activate && otree runprodserver" -environment=DATABASE_URL="{{ item.value.database }}",REDIS_URL="{{ item.value.redis }}",OTREE_ADMIN_PASSWORD="{{ item.value.admin_pw }}",OTREE_AUTH_LEVEL="{{ item.value.auth_level }}",OTREE_SECRET_KEY="{{ item.value.secret_key }}",OTREE_PRODUCTION="{{ item.value.production }}",PORT={{ item.value.port }} +environment=DATABASE_URL="postgres://{{ item.key }}:{{ item.value.admin_pw }}@localhost:5432/instance_{{ item.key }}",REDIS_URL="{{ item.value.redis }}",OTREE_ADMIN_PASSWORD="{{ item.value.admin_pw }}",OTREE_AUTH_LEVEL="{{ item.value.auth_level }}",OTREE_SECRET_KEY="{{ item.value.secret_key }}",OTREE_PRODUCTION="{{ item.value.production }}",PORT={{ item.value.port }} autostart=true autorestart=true startretries=3