diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8acf1d757cb69e0a8fac2ba7f0c08feee89162c7..ed070e970d10fef49e6718ed3a81de01aff3bb98 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,7 +41,7 @@ buildgui: - ./gitinfo.sh - ls -la src/gitinfo.json - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.mpcdf.mpg.de - - docker build -t $FRONTEND_TEST_IMAGE . + - docker build -t $FRONTEND_TEST_IMAGE --build-arg public_url=http://example.com/nomad/$CI_COMMIT_REF_NAME . - docker push $FRONTEND_TEST_IMAGE except: - /^dev-.*$/ diff --git a/gui/Dockerfile b/gui/Dockerfile index 85bbebe778ceb6b18afc8836c32dd6239b1fcaa7..2ac26fd119bf4c4c78f97d6ef2f3fd529b697c2c 100644 --- a/gui/Dockerfile +++ b/gui/Dockerfile @@ -28,13 +28,19 @@ COPY yarn.lock /nomad/app/yarn.lock RUN yarn COPY . /nomad/app -RUN yarn build +ARG public_url=http://example.com/nomad +ENV PUBLIC_URL $public_url +RUN yarn run build # production environment FROM nginx:1.13.9-alpine COPY --from=build /nomad/app/build /app/nomad COPY ./gui.conf /etc/nginx/conf.d/default.conf -CMD ["nginx", "-g", "daemon off;"] + +WORKDIR /app/nomad +CMD nginx -g "daemon off;" VOLUME /etc/nginx/conf.d VOLUME /nomad/app/config + +EXPOSE 8080/tcp diff --git a/gui/src/config.js b/gui/src/config.js index 3bc06cc0be201d8fd627682e023eaa301ba519d7..5a95d36474441d41ce0bd54394de14e575f2336c 100644 --- a/gui/src/config.js +++ b/gui/src/config.js @@ -5,11 +5,11 @@ import analytics from '@material-ui/core/colors/lightGreen' import secondary from '@material-ui/core/colors/blueGrey' import { createMuiTheme } from '@material-ui/core' -window.nomad_env = window.nomad_env || {} -export const apiBase = process.env.REACT_APP_API_BASE || window.nomad_env.apiBase -export const appBase = process.env.REACT_APP_APP_BASE || window.nomad_env.appBase -export const appStaticBase = process.env.REACT_APP_APP_STATIC_BASE || window.nomad_env.appStaticBase -export const debug = process.env.REACT_APP_DEBUG ? process.env.REACT_APP_DEBUG === 'true' : window.nomad_env.debug +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 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 genTheme = createMuiTheme({ palette: { diff --git a/ops/helm/nomad/templates/api-deployment.yaml b/ops/helm/nomad/templates/api-deployment.yaml index 065062e5c4b508470938fd8424b19027a58fcbb9..4a521b5a499ce4c9e599ad5401a3abada452cde8 100644 --- a/ops/helm/nomad/templates/api-deployment.yaml +++ b/ops/helm/nomad/templates/api-deployment.yaml @@ -43,11 +43,7 @@ spec: - name: NOMAD_API_PORT value: "{{ .Values.proxy.external.port }}" - name: NOMAD_API_BASE_PATH - {{- if .Values.proxy.external.useReleasePath }} - value: "{{ .Values.proxy.external.path }}/{{ .Release.Name }}/api" - {{- else }} value: "{{ .Values.proxy.external.path }}/api" - {{- end }} - name: NOMAD_API_SECRET value: "{{ .Values.api.secret }}" - name: NOMAD_RABBITMQ_HOST @@ -76,9 +72,5 @@ spec: volumes: - name: files-volume hostPath: - {{- if .Values.volumes.useReleasePath }} - path: {{ .Values.volumes.files }}/{{ .Release.Name }} - {{- else }} path: {{ .Values.volumes.files }} - {{- end }} type: Directory diff --git a/ops/helm/nomad/templates/proxy-deployment.yml b/ops/helm/nomad/templates/proxy-deployment.yml index b42af7315d107f9d018734917119a76858e17ab6..25dec0788ba4678bd098295de53d47596475c2bf 100644 --- a/ops/helm/nomad/templates/proxy-deployment.yml +++ b/ops/helm/nomad/templates/proxy-deployment.yml @@ -12,37 +12,21 @@ data: server { listen 80; server_name www.example.com; - {{- if .Values.proxy.external.useReleasePath }} - location {{ .Values.proxy.external.path }}/{{ .Release.Name }} { - {{- else }} location {{ .Values.proxy.external.path }} { - {{- end }} proxy_pass http://{{ include "nomad.fullname" . }}-gui:{{ .Values.gui.port }}; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } - {{- if .Values.proxy.external.useReleasePath }} - location {{ .Values.proxy.external.path }}/{{ .Release.Name }}/api { - {{- else }} location {{ .Values.proxy.external.path }}/api { - {{- end }} client_max_body_size 20g; proxy_set_header Host $host; proxy_pass_request_headers on; proxy_pass http://{{ include "nomad.fullname" . }}-api:{{ .Values.api.port }}; } - {{- if .Values.proxy.external.useReleasePath }} - location {{ .Values.proxy.external.path }}/{{ .Release.Name }}/kibana { - {{- else }} location {{ .Values.proxy.external.path }}/kibana { - {{- end }} - {{- if .Values.proxy.external.useReleasePath }} - rewrite ^{{ .Values.proxy.external.path}}/{{ .Release.Name }}/kibana/(.*)$ /$1 break; - {{- else }} rewrite ^{{ .Values.proxy.external.path}}/kibana/(.*)$ /$1 break; - {{- end }} proxy_pass http://{{ .Values.kibana.host }}:{{ .Values.kibana.port }}; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/ops/helm/nomad/templates/worker-deployment.yaml b/ops/helm/nomad/templates/worker-deployment.yaml index f24fcbaa5eb9e1b609a5810488eef85757f7991e..1c4ea159bc6a76c1a571b79ebba3f60105a9b1b5 100644 --- a/ops/helm/nomad/templates/worker-deployment.yaml +++ b/ops/helm/nomad/templates/worker-deployment.yaml @@ -64,9 +64,5 @@ spec: volumes: - name: files-volume hostPath: - {{- if .Values.volumes.useReleasePath }} - path: {{ .Values.volumes.files }}/{{ .Release.Name }} - {{- else }} path: {{ .Values.volumes.files }} - {{- end }} type: Directory diff --git a/ops/helm/nomad/values.yaml b/ops/helm/nomad/values.yaml index be72c7acd8b77352fef6b60df140ca4983ff0398..ed5b6dd19ef207092fa9fdbdb8404cd057070750 100644 --- a/ops/helm/nomad/values.yaml +++ b/ops/helm/nomad/values.yaml @@ -55,7 +55,6 @@ proxy: host: "localhost" port: 30001 ## Add a path segment with the release name to path, e.g. /nomad/liquid-thunder/... - useReleasePath: true path: "/nomad" ## configuration of the chart dependency for rabbitmq @@ -90,6 +89,4 @@ kibana: ## Everything concerning the data that is used by the service volumes: - ## Add a path segment with the release name to path, e.g. .../fs/liquid-thunder/... - useReleasePath: true files: /scratch/nomad-fair/fs diff --git a/requirements.txt b/requirements.txt index 7c0d4c40e2b1b6426af3cd16511592013adca626..00288d570d240e31dd9d023d6692bd7516d0e460 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ python-logstash gitpython gunicorn structlog +recommonmark m2r requests click