From ddf8ba0c55efb70c72dd392664df5fd545c26aa8 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Tue, 18 Feb 2020 11:39:49 +0100 Subject: [PATCH] Working on dockerization. --- .gitignore | 1 + backend/nginx/conf/nginx.conf | 42 +++++++++++++++++++ backend/supervisord/supervisord.conf | 4 ++ dockerfiles/wba/Dockerfile | 15 +++---- dockerfiles/wba/files/wba/dist/index.html | 6 +++ .../wba/files/wba/nginx/conf/nginx.conf | 41 ++++++++++++++++++ dockerfiles/wba/files/wba/nginx/run/.keep | 0 dockerfiles/wba/files/wba/nginx/tmp/.keep | 0 .../wba/files/wba/supervisord/run/.keep | 0 .../files/wba/supervisord/supervisord.conf | 8 ++++ 10 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 backend/nginx/conf/nginx.conf create mode 100644 backend/supervisord/supervisord.conf create mode 100644 dockerfiles/wba/files/wba/dist/index.html create mode 100644 dockerfiles/wba/files/wba/nginx/conf/nginx.conf create mode 100644 dockerfiles/wba/files/wba/nginx/run/.keep create mode 100644 dockerfiles/wba/files/wba/nginx/tmp/.keep create mode 100644 dockerfiles/wba/files/wba/supervisord/run/.keep create mode 100644 dockerfiles/wba/files/wba/supervisord/supervisord.conf diff --git a/.gitignore b/.gitignore index f8d63e5..9d1b2c1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ package-lock.json /frontend/dist/ /backend/server.pem /testdata/ +/backend/supervisord/supervisord.log diff --git a/backend/nginx/conf/nginx.conf b/backend/nginx/conf/nginx.conf new file mode 100644 index 0000000..5a530be --- /dev/null +++ b/backend/nginx/conf/nginx.conf @@ -0,0 +1,42 @@ +error_log /dev/null; +pid nginx.pid; +daemon off; + +events { + +} + +http { + include /pstore/data/data_science/app/modules/nginx-1.17.8/conf/mime.types; + + access_log /dev/null; + + + server { + listen 50080; + server_name rkalbhpc002.kau.roche.com; + + client_body_temp_path tmp/client_body_temp; + fastcgi_temp_path tmp/fastcgi_temp; + proxy_temp_path tmp/proxy_temp; + scgi_temp_path tmp/scgi_temp; + uwsgi_temp_path tmp/uwsgi_temp; + + if ( $request_uri ~ \.(js|css|html|woff|ttf|svg|woff2|eot|svg)$ ) { + break; + } + if ( $request_uri ~ ^/fetch-blocks$ ) { + break; + } + rewrite .* /index.html; + + location / { + root /pstore/home/adaszews/workspace/arvados-workbench-advanced/frontend/dist; + index index.html; + } + + location /fetch-blocks { + proxy_pass http://localhost:12358/fetch-blocks; + } + } +} diff --git a/backend/supervisord/supervisord.conf b/backend/supervisord/supervisord.conf new file mode 100644 index 0000000..9089d9e --- /dev/null +++ b/backend/supervisord/supervisord.conf @@ -0,0 +1,4 @@ +[supervisord] + +[program:wba-nginx] +command=/pstore/data/data_science/app/modules/nginx-1.17.8/sbin/nginx -p /pstore/home/adaszews/workspace/arvados-workbench-advanced/backend/nginx diff --git a/dockerfiles/wba/Dockerfile b/dockerfiles/wba/Dockerfile index ada0d14..62bbf90 100644 --- a/dockerfiles/wba/Dockerfile +++ b/dockerfiles/wba/Dockerfile @@ -1,13 +1,10 @@ FROM alpine:3.11.3 -RUN apk update && apk add nginx && \ - mv /etc/nginx/nginx.conf tmp.conf && \ - echo "daemon off;" >/etc/nginx/nginx.conf && \ - echo "" >>/etc/nginx/nginx.conf && \ - cat tmp.conf >>/etc/nginx/nginx.conf && \ - rm tmp.conf && \ - mkdir /run/nginx +RUN apk update && \ + apk add nginx gettext supervisor -COPY files/default.conf /etc/nginx/conf.d/default.conf +COPY files/wba /wba -RUN apk add gettext +RUN chown -R nginx /wba/nginx/tmp /wba/nginx/run + +ENTRYPOINT /bin/sh -c "cd /wba/supervisord/run && /usr/bin/supervisord -c /wba/supervisord/supervisord.conf" diff --git a/dockerfiles/wba/files/wba/dist/index.html b/dockerfiles/wba/files/wba/dist/index.html new file mode 100644 index 0000000..6b31c83 --- /dev/null +++ b/dockerfiles/wba/files/wba/dist/index.html @@ -0,0 +1,6 @@ + + + + Hello, world! + + diff --git a/dockerfiles/wba/files/wba/nginx/conf/nginx.conf b/dockerfiles/wba/files/wba/nginx/conf/nginx.conf new file mode 100644 index 0000000..751c07d --- /dev/null +++ b/dockerfiles/wba/files/wba/nginx/conf/nginx.conf @@ -0,0 +1,41 @@ +error_log /dev/null; +pid run/nginx.pid; +daemon off; + +events { + +} + +http { + include /etc/nginx/mime.types; + + access_log /dev/null; + + server { + listen ${PORT0}; + server_name wba.ecaas.emea.roche.com; + + client_body_temp_path tmp/client_body_temp; + fastcgi_temp_path tmp/fastcgi_temp; + proxy_temp_path tmp/proxy_temp; + scgi_temp_path tmp/scgi_temp; + uwsgi_temp_path tmp/uwsgi_temp; + + if ( $request_uri ~ \.(js|css|html|woff|ttf|svg|woff2|eot|svg)$ ) { + break; + } + if ( $request_uri ~ ^/fetch-blocks$ ) { + break; + } + rewrite .* /index.html; + + location / { + root /wba/dist; + index index.html; + } + + location /fetch-blocks { + proxy_pass http://localhost:12358/fetch-blocks; + } + } +} diff --git a/dockerfiles/wba/files/wba/nginx/run/.keep b/dockerfiles/wba/files/wba/nginx/run/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/wba/files/wba/nginx/tmp/.keep b/dockerfiles/wba/files/wba/nginx/tmp/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/wba/files/wba/supervisord/run/.keep b/dockerfiles/wba/files/wba/supervisord/run/.keep new file mode 100644 index 0000000..e69de29 diff --git a/dockerfiles/wba/files/wba/supervisord/supervisord.conf b/dockerfiles/wba/files/wba/supervisord/supervisord.conf new file mode 100644 index 0000000..ec5975a --- /dev/null +++ b/dockerfiles/wba/files/wba/supervisord/supervisord.conf @@ -0,0 +1,8 @@ +[supervisord] +logfile=/dev/null +nodaemon=true +user=root + +[program:wba-nginx] +command=/usr/sbin/nginx -p /wba/nginx -c conf/nginx.conf +user=nginx