Merge branch 'feature/running-calculator-webservice' into 'master'
Enable the cara-webservice in the Openshift deployment. See merge request cara/cara!27
This commit is contained in:
commit
400f520e02
6 changed files with 31 additions and 5 deletions
|
|
@ -26,6 +26,7 @@ trigger_build_on_openshift:
|
|||
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
|
||||
- curl -X POST -k https://openshift.cern.ch:443/apis/build.openshift.io/v1/namespaces/cara/buildconfigs/cara-router/webhooks/${OPENSHIFT_BUILD_WEBHOOK_SECRET}/generic
|
||||
- curl -X POST -k https://openshift.cern.ch:443/apis/build.openshift.io/v1/namespaces/cara/buildconfigs/cara-webservice/webhooks/${OPENSHIFT_BUILD_WEBHOOK_SECRET}/generic
|
||||
|
||||
|
||||
deploy_to_test:
|
||||
|
|
@ -39,3 +40,4 @@ deploy_to_test:
|
|||
script:
|
||||
- curl -X POST -k https://openshift-dev.cern.ch:443/apis/build.openshift.io/v1/namespaces/test-cara/buildconfigs/cara-app/webhooks/${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET}/generic
|
||||
- curl -X POST -k https://openshift-dev.cern.ch:443/apis/build.openshift.io/v1/namespaces/test-cara/buildconfigs/cara-router/webhooks/${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET}/generic
|
||||
- curl -X POST -k https://openshift-dev.cern.ch:443/apis/build.openshift.io/v1/namespaces/test-cara/buildconfigs/cara-webservice/webhooks/${OPENSHIFT_TEST_BUILD_WEBHOOK_SECRET}/generic
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ Then visit http://localhost:8080/calculator.
|
|||
**Simulate the docker build that takes place on openshift with:**
|
||||
|
||||
```
|
||||
s2i build file://$(pwd) --copy --context-dir=app-config/nginx/ centos/nginx-112-centos7 cara-nginx-app
|
||||
s2i build file://$(pwd) --copy --context-dir=./ centos/python-36-centos7 cara-voila-app
|
||||
s2i build file://$(pwd) --copy --keep-symlinks --context-dir ./app-config/nginx/ centos/nginx-112-centos7 cara-nginx-app
|
||||
s2i build file://$(pwd) --copy --keep-symlinks --env APP_NAME=cara-voila --context-dir ./ centos/python-36-centos7 cara-voila-app
|
||||
s2i build file://$(pwd) --copy --keep-symlinks --env APP_NAME=cara-webservice --context-dir ./ centos/python-36-centos7 cara-webservice
|
||||
cd app-config
|
||||
docker-compose up
|
||||
```
|
||||
|
|
|
|||
|
|
@ -8,4 +8,5 @@ services:
|
|||
image: cara-nginx-app
|
||||
ports:
|
||||
- "8080:8080"
|
||||
|
||||
cara-webservice:
|
||||
image: cara-webservice
|
||||
|
|
|
|||
|
|
@ -70,5 +70,20 @@ http {
|
|||
# Redirect this (and all other) URLs to the new scheme.
|
||||
absolute_redirect off;
|
||||
rewrite ^/voila/(.*)$ /voila-server/voila/$1 redirect;
|
||||
|
||||
location /calculator/ {
|
||||
# cara-webservice is the name of the tornado server (for the calculator)
|
||||
# in each of docker-compose, test-cara.web.cern.ch and cara.web.cern.ch.
|
||||
proxy_pass http://cara-webservice:8080/calculator/;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
app.sh
9
app.sh
|
|
@ -1,2 +1,9 @@
|
|||
voila app/ --port=8080 --no-browser --base_url=/voila-server/ --Voila.tornado_settings="{'allow_origin': '*'}"
|
||||
env
|
||||
if [[ "$APP_NAME" == "cara-webservice" ]]; then
|
||||
echo "Starting the cara webservice"
|
||||
python -m cara.apps.calculator
|
||||
elif [[ "$APP_NAME" == "cara-voila" ]]; then
|
||||
echo "Starting the voila service"
|
||||
voila app/ --port=8080 --no-browser --base_url=/voila-server/ --Voila.tornado_settings="{'allow_origin': '*'}"
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ def make_app(debug=False, prefix='/calculator'):
|
|||
static_dir = Path(__file__).absolute().parent / 'static'
|
||||
urls = [
|
||||
(
|
||||
prefix + r'()', StaticFileHandler, {'path': static_dir / 'form.html'}
|
||||
prefix + r'/?()', StaticFileHandler, {'path': static_dir / 'form.html'}
|
||||
),
|
||||
(
|
||||
prefix + r'/report', ConcentrationModel
|
||||
|
|
|
|||
Loading…
Reference in a new issue