From ffa2e53994a3562cacfcd8c075d568aa504dc919 Mon Sep 17 00:00:00 2001 From: Phil Elson Date: Tue, 3 Nov 2020 12:38:38 +0100 Subject: [PATCH] Prepare the repository for having a separate calculator app. --- app-config/docker-compose.yml | 2 -- app-config/nginx/404.html | 1 + app-config/nginx/calculator-static | 1 + app-config/nginx/nginx.conf | 8 ++++++++ cara/apps/__init__.py | 4 ++++ cara/apps/calculator/__init__.py | 0 cara/apps/calculator/static/form.html | 0 cara/{apps.py => apps/expert.py} | 0 8 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 app-config/nginx/404.html create mode 120000 app-config/nginx/calculator-static create mode 100644 cara/apps/__init__.py create mode 100644 cara/apps/calculator/__init__.py create mode 100644 cara/apps/calculator/static/form.html rename cara/{apps.py => apps/expert.py} (100%) diff --git a/app-config/docker-compose.yml b/app-config/docker-compose.yml index 675b6829..917660ea 100644 --- a/app-config/docker-compose.yml +++ b/app-config/docker-compose.yml @@ -2,8 +2,6 @@ version: "3.8" services: cara-app: image: cara-voila-app - # ports: - # - "8080:8081" links: - cara-router cara-router: diff --git a/app-config/nginx/404.html b/app-config/nginx/404.html new file mode 100644 index 00000000..2000eebc --- /dev/null +++ b/app-config/nginx/404.html @@ -0,0 +1 @@ +Page not found! diff --git a/app-config/nginx/calculator-static b/app-config/nginx/calculator-static new file mode 120000 index 00000000..5605de12 --- /dev/null +++ b/app-config/nginx/calculator-static @@ -0,0 +1 @@ +../../cara/apps/calculator/static \ No newline at end of file diff --git a/app-config/nginx/nginx.conf b/app-config/nginx/nginx.conf index 660f5616..b32341d5 100644 --- a/app-config/nginx/nginx.conf +++ b/app-config/nginx/nginx.conf @@ -46,6 +46,8 @@ http { } location /voila-server/ { + # cara-app is the name of the voila server in each of docker-compose, + # test-cara.web.cern.ch and cara.web.cern.ch. proxy_pass http://cara-app:8080/voila-server/; proxy_set_header Host $host; @@ -58,6 +60,12 @@ http { proxy_read_timeout 86400; } rewrite ^/expert-app$ /voila-server/voila/render/cara.ipynb last; + + # Give the static content of the calculator app a sensible name which is + # consistent with the static directory of the calculator webserver used + # for development. + rewrite ^/calculator/static/(.*)$ /calculator-static/$1 last; + # Before implementing the nginx router we could access /voila/render/cara.ipynb. # Redirect this (and all other) URLs to the new scheme. rewrite ^/voila/(.*)$ /voila-server/voila/$1 redirect; diff --git a/cara/apps/__init__.py b/cara/apps/__init__.py new file mode 100644 index 00000000..da903ca1 --- /dev/null +++ b/cara/apps/__init__.py @@ -0,0 +1,4 @@ +from .expert import ExpertApplication + + +__all__ = ['ExpertApplication'] diff --git a/cara/apps/calculator/__init__.py b/cara/apps/calculator/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/cara/apps/calculator/static/form.html b/cara/apps/calculator/static/form.html new file mode 100644 index 00000000..e69de29b diff --git a/cara/apps.py b/cara/apps/expert.py similarity index 100% rename from cara/apps.py rename to cara/apps/expert.py