diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7841bd024eaff3cc9342bbcc8ee780da5bb00914..f0b6c710d1c8429aa8121f8b5a4951e7cc0a35e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,7 +52,7 @@ buildgui: script: - cd gui - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.mpcdf.mpg.de - - docker build -t $FRONTEND_TEST_IMAGE . + - docker build --build-arg public_url=$(case $CI_COMMIT_REF_NAME in "migration") echo "/fairdi/nomad/migration/gui" ;; *) echo "/fairdi/nomad/latest/gui" ;; esac) -t $FRONTEND_TEST_IMAGE . - docker push $FRONTEND_TEST_IMAGE except: - /^dev-.*$/ diff --git a/gui/Dockerfile b/gui/Dockerfile index 6c6d207a991390f13e6c603ad410e8534928e057..e555d5bdac1dc705f0e353e5e8f9798aa149830a 100644 --- a/gui/Dockerfile +++ b/gui/Dockerfile @@ -28,6 +28,8 @@ COPY yarn.lock /nomad/app/yarn.lock RUN yarn COPY . /nomad/app +ARG public_url +ENV PUBLIC_URL=$public_url RUN yarn run build # production environment diff --git a/gui/gui.conf b/gui/gui.conf index 51064407ee378b641feecfce3a56e1a39490dd4c..571d5299a3c728e8db9daf0bca97e4c25f535544 100644 --- a/gui/gui.conf +++ b/gui/gui.conf @@ -2,8 +2,8 @@ server { listen 8080; server_name www.example.com; - location /nomad { + location /fairdi/nomad/latest/gui { root /app/; - try_files $uri /nomad/index.html; # fall back to index.html to support routing + try_files $uri $uri/ /nomad/index.html; # fall back to index.html to support routing } } diff --git a/gui/package.json b/gui/package.json index 746cf0d70fa4c75a4a8863210c9e4ef7b1dc54c5..a39b5c0287e4b1a9b3098c7d62820b993d27312a 100644 --- a/gui/package.json +++ b/gui/package.json @@ -51,5 +51,5 @@ "eslint-plugin-standard": "^3.1.0", "serve": "^10.0.0" }, - "homepage": "." + "homepage": "http://example.com/fairdi/nomad/latest/gui" } diff --git a/gui/public/config/env.js b/gui/public/config/env.js deleted file mode 100644 index e334470f3f7bc32fb9b0928a6d01daf81fc3f18a..0000000000000000000000000000000000000000 --- a/gui/public/config/env.js +++ /dev/null @@ -1,8 +0,0 @@ -// this is a public file and must only contain configuration that can be publically -// available -window.nomadEnv = { - "apiBase": "/nomad/api", - "appBase": "/nomad", - "appStaticBase": "/nomad", - "appDebug": false -}; \ No newline at end of file diff --git a/gui/public/env.js b/gui/public/env.js new file mode 100644 index 0000000000000000000000000000000000000000..2200d29f9abe7faaeb23cc4dabcc1fec3182f826 --- /dev/null +++ b/gui/public/env.js @@ -0,0 +1,4 @@ +window.nomadEnv = { + 'apiBase': '/fairdi/nomad/latest/api', + 'kibanaBase': '/fairdi/kibana' +} diff --git a/gui/public/index.html b/gui/public/index.html index dd001d158e3ef7311a0cb650bb1bb330a8b1b5c9..eea3e8e72d9a4553eadbc66d18dd4d1cf56378c7 100644 --- a/gui/public/index.html +++ b/gui/public/index.html @@ -7,7 +7,7 @@ } </script> <script src="https://unpkg.com/pace-js@1.0.2/pace.min.js"></script> - <link href="config/pace.css" rel="stylesheet" /> + <link href="%PUBLIC_URL%/pace.css" rel="stylesheet" /> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> @@ -37,7 +37,7 @@ <noscript> You need to enable JavaScript to run this app. </noscript> - <script src="%PUBLIC_URL%/config/env.js"></script> + <script src="%PUBLIC_URL%/env.js"></script> <div id="root"></div> <!-- This HTML file is a template. diff --git a/gui/public/me.jpg b/gui/public/me.jpg deleted file mode 100644 index 3e2bc4c2099fd6d18d5b05280a7a58a8f8f246d1..0000000000000000000000000000000000000000 Binary files a/gui/public/me.jpg and /dev/null differ diff --git a/gui/src/pace.css b/gui/public/pace.css similarity index 100% rename from gui/src/pace.css rename to gui/public/pace.css diff --git a/gui/src/components/App.js b/gui/src/components/App.js index 49bfe278f0bd205583d26bf7919b0818705d803a..a7c16fafbe6911e5b7ecd5f6c2108ff72be5dfde 100644 --- a/gui/src/components/App.js +++ b/gui/src/components/App.js @@ -81,7 +81,7 @@ export default class App extends React.Component { return ( <MuiThemeProvider theme={genTheme}> <ErrorSnacks> - <BrowserRouter basename={appBase}> + <BrowserRouter basename={process.env.PUBLIC_URL}> <HelpProvider> <ApiProvider> <Navigation> diff --git a/gui/src/components/uploads/Upload.js b/gui/src/components/uploads/Upload.js index a75bdfcb2ba685af536ec723db48ae7321dcc590..dc8201bb9fe9960ac8d03cfb0e9bbbed791a9e1c 100644 --- a/gui/src/components/uploads/Upload.js +++ b/gui/src/components/uploads/Upload.js @@ -9,7 +9,6 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore' import ReactJson from 'react-json-view' import { compose } from 'recompose' import { withErrors } from '../errors' -import { debug } from '../../config' import { withRouter } from 'react-router' class Upload extends React.Component { @@ -483,10 +482,10 @@ class Upload extends React.Component { </Typography> : '' } {upload.calcs ? this.renderCalcTable() : ''} - {debug - ? <div className={classes.detailsContent}> - <ReactJson src={upload} enableClipboard={false} collapsed={0} /> - </div> : ''} + + <div className={classes.detailsContent}> + <ReactJson src={upload} enableClipboard={false} collapsed={0} /> + </div> </ExpansionPanelDetails> </ExpansionPanel> </div> diff --git a/gui/src/config.js b/gui/src/config.js index 384b616d1dabaee3f112ae2c5202b03f0776f79e..c35dbaf378301d61cf0e59ed6535c8edbf9c59b6 100644 --- a/gui/src/config.js +++ b/gui/src/config.js @@ -6,11 +6,9 @@ import secondary from '@material-ui/core/colors/blueGrey' import { createMuiTheme } from '@material-ui/core' window.nomadEnv = window.nomadEnv || {} -export const apiBase = process.env.REACT_APP_API_BASE || window.nomadEnv.apiBase -export const appBase = process.env.REACT_APP_APP_BASE || window.nomadEnv.appBase -export const kibanaBase = process.env.REACT_KIBANA_BASE || window.nomadEnv.kibanaBase -export const appStaticBase = process.env.REACT_APP_APP_STATIC_BASE || window.nomadEnv.appStaticBase -export const debug = process.env.REACT_APP_DEBUG ? process.env.REACT_APP_DEBUG === 'true' : window.nomadEnv.debug +export const apiBase = window.nomadEnv.apiBase +export const appBase = process.env.PUBLIC_URL +export const kibanaBase = window.nomadEnv.kibanaBase const createTheme = themeData => createMuiTheme({ typography: { diff --git a/gui/src/index.js b/gui/src/index.js index 7d7569c31cadb80b010e1f674d4e642ecb692164..6e6600f06a933e399ee27c473e5044cbdb105b4c 100644 --- a/gui/src/index.js +++ b/gui/src/index.js @@ -1,6 +1,3 @@ -import 'pace-js' -import './pace.css' - import React from 'react' import ReactDOM from 'react-dom' import './index.css' diff --git a/gui/src/nomad-cube.png b/gui/src/nomad-cube.png deleted file mode 100644 index 8840b236be5d242043d1b016f11df516210375fb..0000000000000000000000000000000000000000 Binary files a/gui/src/nomad-cube.png and /dev/null differ diff --git a/nomad/config.py b/nomad/config.py index e51c6f790f9a7fee29379234f57ae4e987f62a6a..99f0c43e341002d70a37ea0af8dbe6d9143453bf 100644 --- a/nomad/config.py +++ b/nomad/config.py @@ -116,7 +116,7 @@ logstash = NomadConfig( services = NomadConfig( api_host='localhost', api_port=8000, - api_base_path='/nomad/api', + api_base_path='/fairdi/nomad/latest/api', api_secret='defaultApiSecret', admin_password='password', disable_reset=True, diff --git a/ops/docker-compose/nomad/docker-compose.yml b/ops/docker-compose/nomad/docker-compose.yml index 0f01aa7fffbbf9ace2d114a95ea794639a89ab9f..93cd8586648bed2e6c168463544a0f165c31ef4c 100644 --- a/ops/docker-compose/nomad/docker-compose.yml +++ b/ops/docker-compose/nomad/docker-compose.yml @@ -89,7 +89,7 @@ services: container_name: nomad_api environment: <<: *nomad_backend_env - NOMAD_SERVICES_API_BASE_PATH: /nomad/api + NOMAD_SERVICES_API_BASE_PATH: /fairdi/nomad/latest/api NOMAD_SERVICES_API_HOST: ${EXTERNAL_HOST} NOMAD_SERVICES_API_PORT: ${EXTERNAL_PORT} NOMAD_SERVICES_API_SECRET: ${API_SECRET} diff --git a/ops/docker-compose/nomad/nginx.conf b/ops/docker-compose/nomad/nginx.conf index 31a39f2b05726c53f2536deb6f450bf18a0576a9..754bd97215286f0de5becbb6886577f555aecfc5 100644 --- a/ops/docker-compose/nomad/nginx.conf +++ b/ops/docker-compose/nomad/nginx.conf @@ -2,20 +2,20 @@ server { listen 80; server_name www.example.com; - location /nomad { + location /fairdi/nomad/latest/gui { proxy_pass http://gui:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } - location /nomad/api { + location /fairdi/nomad/latest/api { client_max_body_size 20g; proxy_set_header Host $host; proxy_pass_request_headers on; proxy_pass http://api:8000; } - location ~ ^/nomad/kibana/(.*)$ { + location ~ ^/fairdi/kibana/(.*)$ { resolver 127.0.0.11 ipv6=off; # docker embedded DNS proxy_pass http://elk:5601/$1$is_args$args; # fix: https://github.com/elastic/kibana/issues/13533 proxy_set_header Host $host; diff --git a/ops/helm/nomad/templates/gui-deployment.yml b/ops/helm/nomad/templates/gui-deployment.yml index 59a0a4c345884b1b775a4f2059649bf6a7a2dfff..84ea58fc84a827de116a9b0273d1eedab81c1fe5 100644 --- a/ops/helm/nomad/templates/gui-deployment.yml +++ b/ops/helm/nomad/templates/gui-deployment.yml @@ -12,19 +12,16 @@ data: server { listen 8080; server_name www.example.com; - location {{ .Values.proxy.external.path }} { + location {{ .Values.proxy.external.path }}/gui { root /app/; - rewrite ^{{ .Values.proxy.external.path }}/(.*)$ /nomad/$1 break; - try_files $uri {{ .Values.proxy.external.path }}/index.html; + rewrite ^{{ .Values.proxy.external.path }}/gui/(.*)$ /nomad/$1 break; + try_files $uri $uri/ {{ .Values.proxy.external.path }}/gui/index.html; } } env.js: | window.nomadEnv = { "apiBase": "{{ .Values.proxy.external.path }}/api", - "appBase": "{{ .Values.proxy.external.path }}", - "appStaticBase": "{{ .Values.proxy.external.path }}", - "kibanaBase": "{{ .Values.proxy.external.kibanaPath }}", - "appDebug": false + "kibanaBase": "{{ .Values.proxy.external.kibanaPath }}" }; --- apiVersion: apps/v1 @@ -58,8 +55,9 @@ spec: - mountPath: /etc/nginx/conf.d readOnly: true name: nginx-conf - - mountPath: /app/nomad/config + - mountPath: /app/nomad/env.js readOnly: true + subPath: env.js name: nomad-app - mountPath: /var/log/nginx name: log diff --git a/ops/helm/nomad/templates/proxy-deployment.yml b/ops/helm/nomad/templates/proxy-deployment.yml index 756de1ae3c3b3ef99550385111c8ce10a286abfa..bc8035c3b960f0781658f66bd728d7a7105d71a0 100644 --- a/ops/helm/nomad/templates/proxy-deployment.yml +++ b/ops/helm/nomad/templates/proxy-deployment.yml @@ -12,7 +12,7 @@ data: server { listen 80; server_name www.example.com; - location {{ .Values.proxy.external.path }} { + location {{ .Values.proxy.external.path }}/gui { proxy_pass http://{{ include "nomad.fullname" . }}-gui:{{ .Values.gui.port }}; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; @@ -41,7 +41,7 @@ data: } location {{ .Values.proxy.external.path }}/api/raw { - proxy_buffering off; + proxy_buffering off; proxy_set_header Host $host; proxy_pass_request_headers on; proxy_pass http://{{ include "nomad.fullname" . }}-api:{{ .Values.api.port }};