Commit a34649b1 authored by Philip Elson's avatar Philip Elson 🐍
Browse files

Put an nginx reverse-proxy in front of the voila server to give us more...

Put an nginx reverse-proxy in front of the voila server to give us more flexibility in how we present the endpoint.
parent cf2ca077
Pipeline #2060226 passed with stage
in 1 minute and 13 seconds
......@@ -25,3 +25,12 @@ trigger_build_on_openshift:
- if: '$OPENSHIFT_BUILD_WEBHOOK_SECRET'
script:
- curl -X POST -k https://openshift.cern.ch:443/apis/build.openshift.io/v1/namespaces/cara/buildconfigs/cara-app/webhooks/${OPENSHIFT_BUILD_WEBHOOK_SECRET}/generic
deploy_to_test:
stage: deploy
rules:
- if: '$OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET'
when: manual
script:
- curl -X POST -k https://openshift-dev.cern.ch:443/apis/build.openshift.io/v1/namespaces/test-cara/buildconfigs/test-cara/webhooks/${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET}/generic
......@@ -7,6 +7,15 @@
## Development guide
### Building the docker image
**Simulate the docker build that takes place on openshift with:**
```
s2i build file://$(pwd) --context-dir=app-config/nginx/ centos/nginx-112-centos7 cara-nginx-app
s2i build file://$(pwd) --context-dir=./ centos/python-36-centos7 cara-voila-app
```
### Setting up the application
The https://cern.ch/cara application is running on CERN's OpenShift platform. In order to set it up for the first time, we followed the documentation at https://cern.service-now.com/service-portal?id=kb_article&n=KB0004498. In particular we:
......
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /opt/app-root/etc/nginx.d/*.conf;
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /opt/app-root/src;
# Load configuration files for the default server block.
include /opt/app-root/etc/nginx.default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location /voila-server/ {
proxy_pass http://cara-app:8080/voila-server/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
location /expert-app {
proxy_pass http://localhost:8080/voila-server/voila/render/app/cara.ipynb;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
}
\ No newline at end of file
voila app/ --port=8080
voila app/ --port=8080 --no-browser --base_url=/voila-server/ --Voila.tornado_settings="{'allow_origin': '*'}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment