Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
ledsoft committed Nov 29, 2023
2 parents a20da4f + debd061 commit 51911cc
Show file tree
Hide file tree
Showing 27 changed files with 7,230 additions and 20,746 deletions.
11 changes: 11 additions & 0 deletions .env.internal-auth
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
RECORD_MANAGER_API_URL=http://localhost:1235/record-manager/services/record-manager-server
RECORD_MANAGER_APP_TITLE=Record Manager
RECORD_MANAGER_DEV_SERVER_PORT=3000
RECORD_MANAGER_PROD_SERVER_PORT=8080
RECORD_MANAGER_LANGUAGE=cs
RECORD_MANAGER_NAVIGATOR_LANGUAGE=true
RECORD_MANAGER_BASENAME=/
RECORD_MANAGER_EXTENSIONS=kodi
RECORD_MANAGER_AUTHENTICATION=internal
RECORD_MANAGER_AUTH_SERVER_URL=
RECORD_MANAGER_AUTH_CLIENT_ID=record-manager-ui
5 changes: 4 additions & 1 deletion .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Publish Docker Image
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
# Last fragment of identifier of the docker image
Expand All @@ -13,7 +15,8 @@ env:

jobs:
build-and-publish:

# Skip if PR is from a fork
if: github.event_name != 'pull_request' || github.event.repository.full_name == github.event.pull_request.head.repo.full_name
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BASE STAGE
# Prepare node, copy package.json
FROM node:14 AS base
FROM node:16 AS base
WORKDIR /usr/src/app
COPY package.json package-lock.json ./

Expand Down
4 changes: 3 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ module.exports = {
"plugins": [
"lodash",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
"@babel/plugin-transform-runtime",
"@babel/plugin-transform-nullish-coalescing-operator",
"@babel/plugin-transform-modules-commonjs"
],
"presets": [
[
Expand Down
18 changes: 18 additions & 0 deletions deploy/internal-auth/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Public origin of URL where Record Manager UI will run, e.g. https://kbss.fel.cvut.cz, https://kbss.fel.cvut.cz:8080, http://localhost.
#PUBLIC_ORIGIN=http://localhost

# Path to root Record Manager application (by default it is set to "/record-manager")
#RECORD_MANAGER_ROOT_PATH=/record-manager-example

# Prefix for name of all docker containers
RECORD_SET_NAME=iauth-example

# Host machine port that provides main entrypoint for the application. The application will be locally accessible at http://localhost:$INTERNAL_HOST_PORT/$RECORD_MANAGER_ROOT_PATH (by default it is set to "1235")
#INTERNAL_HOST_PORT=1235

# URL to form generation service
FORMGEN_SERVICE_URL=http://s-pipes-engine:8080/s-pipes/service?_pId=clone-form

RECORD_MANAGER_APP_TITLE=Record Manager

LANGUAGE=en
86 changes: 86 additions & 0 deletions deploy/internal-auth/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
version: '3.9'

# Provide access to record-manager-ui that runs locally in dev mode
x-access-for-local-development: &local-dev-env
cors.allowedOrigins: "http://localhost:3000"

services:
nginx:
image: nginx:latest
container_name: ${RECORD_SET_NAME:-rm}-nginx
volumes:
- ./nginx/template-variables.conf:/etc/nginx/templates/variables.conf.template:ro
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/error.html:/usr/share/nginx/html/error.html:ro
ports:
- "127.0.0.1:${INTERNAL_HOST_PORT:-1235}:80"
restart: always
depends_on:
- record-manager
- record-manager-server
- s-pipes-engine
- db-server
environment:
RECORD_MANAGER_ORIGIN: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}"
RECORD_MANAGER_ROOT_PATH: "${RECORD_MANAGER_ROOT_PATH:-/record-manager}"

record-manager:
image: ghcr.io/kbss-cvut/kbss-cvut/record-manager-ui:latest
container_name: ${RECORD_SET_NAME:-rm}-record-manager
expose:
- "80"
restart: always
depends_on:
- record-manager-server
environment:
API_URL: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}${RECORD_MANAGER_ROOT_PATH:-/record-manager}/services/record-manager-server"
APP_INFO: "${RECORD_MANAGER_APP_INFO:-}"
APP_TITLE: "${RECORD_MANAGER_APP_TITLE:-Record Manager}"
LANGUAGE: "${LANGUAGE:-en}"
NAVIGATOR_LANGUAGE: "false"
BASENAME: "${RECORD_MANAGER_ROOT_PATH:-/record-manager}"

record-manager-server:
image: ghcr.io/kbss-cvut/kbss-cvut/record-manager:latest
container_name: ${RECORD_SET_NAME:-rm}-record-manager-server
expose:
- "8080"
restart: always
depends_on:
- s-pipes-engine
- db-server
environment:
<<: *local-dev-env
appContext: "${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}${RECORD_MANAGER_ROOT_PATH:-/record-manager}"
repositoryUrl: "http://db-server:7200/repositories/record-manager-app"
formGenRepositoryUrl: "http://db-server:7200/repositories/record-manager-formgen"
formGenServiceUrl: "${FORMGEN_SERVICE_URL}"

s-pipes-engine:
image: ghcr.io/kbss-cvut/s-pipes/s-pipes-engine:latest
container_name: ${RECORD_SET_NAME:-rm}-s-pipes-engine
expose:
- "8080"
restart: always
depends_on:
- db-server
environment:
FORMGEN_REPOSITORY_URL: "http://db-server:7200/repositories/record-manager-formgen"
volumes:
- ./s-pipes-engine/scripts:/scripts/root

db-server:
build:
context: ../shared/db-server
container_name: ${RECORD_SET_NAME:-rm}-db-server
environment:
GDB_JAVA_OPTS: "-Dgraphdb.external-url=${PUBLIC_ORIGIN:-http://localhost:${INTERNAL_HOST_PORT:-1235}}${RECORD_MANAGER_ROOT_PATH:-/record-manager}/services/db-server"
expose:
- "7200"
restart: always
volumes:
- ../shared/db-server/init-data/forms:/root/graphdb-import/forms:ro
- db-server:/opt/graphdb/home

volumes:
db-server:
38 changes: 38 additions & 0 deletions deploy/internal-auth/nginx/error.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!-- Record manager Nginx reverse proxy-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
<!--# echo var="status" default="" -->
| Record manager
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--# if expr="$status = 502" -->
<meta http-equiv="refresh" content="2">
<!--# endif -->
</head>
<style type="text/css">
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #fff;
height: 100vh;
margin: 0;
background: #263238 linear-gradient(5deg, #057fa5 0%, #263238 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
<body>
<!--# if expr="$status = 502" -->
<h1>The application is currently being updated</h1>
<p>You will be redirected to the new version in a few seconds.</p>
<p>If you see this message for more than a minute, something has gone wrong.</p>
<!--# else -->
<h1>Sorry, something went wrong.</h1>
<p><!--# echo var="status" default="" --></p>
<!--# endif -->
</body>
</html>
77 changes: 77 additions & 0 deletions deploy/internal-auth/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {

client_max_body_size 100M;

include mime.types;
default_type application/octet-stream;

map $status $status_text {
400 'Bad Request';
401 'Unauthorized';
403 'Forbidden';
404 'Not Found';
405 'Method Not Allowed';
406 'Not Acceptable';
413 'Payload Too Large';
414 'URI Too Long';
431 'Request Header Fields Too Large';
500 'Internal Server Error';
501 'Not Implemented';
502 'Bad Gateway';
503 'Service Unavailable';
504 'Gateway Timeout';
}

include /etc/nginx/conf.d/variables.conf;

server {
listen 80;
server_name localhost;

error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
415 416 417 418 421 422 423 424 426 428 429 431 451 500 501 502 503
504 505 506 507 508 510 511 /error.html;

location = /error.html {
ssi on;
internal;
root /usr/share/nginx/html;
}

location = /record-manager {
return 302 $record_manager_origin$record_manager_root_path/;
}

location /record-manager/ {
proxy_pass http://record-manager/; # keep the trailing slash to cut off matched prefix
}

location /record-manager/services/record-manager-server/ {
proxy_pass http://record-manager-server:8080/record-manager/; # keep the trailing slash to cut off matched prefix
proxy_cookie_path /record-manager $record_manager_root_path/services;
}

location = /record-manager/services/db-server {
return 302 $record_manager_origin$record_manager_root_path/services/db-server/;
}

location /record-manager/services/db-server/ {
proxy_pass http://db-server:7200/; # keep the trailing slash to cut off matched prefix
}

location /record-manager/services/s-pipes/ {
proxy_pass http://s-pipes-engine:8080/; # keep the trailing slash to cut off matched prefix
}

location /health-check {
return 200;
access_log off;
}
}
}
7 changes: 7 additions & 0 deletions deploy/internal-auth/nginx/template-variables.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
map $host $record_manager_origin {
default "$RECORD_MANAGER_ORIGIN";
}

map $host $record_manager_root_path {
default "$RECORD_MANAGER_ROOT_PATH";
}
Loading

0 comments on commit 51911cc

Please sign in to comment.