Commit 1713fb49 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Yet another attempt to fix the gui subdirectory problem.

parent 1f865b1a
Pipeline #46583 passed with stages
in 18 minutes and 19 seconds
......@@ -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-.*$/
......
......@@ -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
......
......@@ -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
}
}
......@@ -51,5 +51,5 @@
"eslint-plugin-standard": "^3.1.0",
"serve": "^10.0.0"
},
"homepage": "."
"homepage": "http://example.com/fairdi/nomad/latest/gui"
}
// 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
window.nomadEnv = {
'apiBase': '/fairdi/nomad/latest/api',
'kibanaBase': '/fairdi/kibana'
}
......@@ -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.
......
......@@ -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>
......
......@@ -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>
......
......@@ -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: {
......
import 'pace-js'
import './pace.css'
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
......
......@@ -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,
......
......@@ -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}
......
......@@ -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;
......
......@@ -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
......
......@@ -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 }};
......
Supports Markdown
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