commit a6b9c49dfaaf807171a937453d0389e3bed2a326
Author: Schwobik <michal.schwob@seznam.cz>
Date:   Mon Apr 11 19:46:06 2022 +0200

    Added config for Loadbalancer nginx server
    re #9333

diff --git a/backend/app-service.yaml b/backend/app-service.yaml
index 83d948e..88c2825 100644
--- a/backend/app-service.yaml
+++ b/backend/app-service.yaml
@@ -15,5 +15,6 @@ spec:
       targetPort: 8080
   selector:
     io.kompose.service: app
+  type: LoadBalancer
 status:
   loadBalancer: {}
diff --git a/frontend/package.json b/frontend/package.json
index 9851cc8..11b9d77 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -33,7 +33,7 @@
     "build": "react-scripts build",
     "test": "react-scripts test",
     "eject": "react-scripts eject",
-    "gen:swagger": "swagger-typescript-api -p http://localhost:8080/v3/api-docs -o ./src/swagger --modular"
+    "gen:swagger": "swagger-typescript-api -p http://147.228.110.32:8080/v3/api-docs -o ./src/swagger --modular"
   },
   "eslintConfig": {
     "extends": [
diff --git a/frontend/src/swagger/CatalogItems.ts b/frontend/src/swagger/CatalogItems.ts
deleted file mode 100644
index cfd3c2e..0000000
--- a/frontend/src/swagger/CatalogItems.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-/* eslint-disable */
-/* tslint:disable */
-/*
- * ---------------------------------------------------------------
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
- * ##                                                           ##
- * ## AUTHOR: acacode                                           ##
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
- * ---------------------------------------------------------------
- */
-
-import { CatalogItemDto } from "./data-contracts";
-import { ContentType, HttpClient, RequestParams } from "./http-client";
-
-export class CatalogItems<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
-  /**
-   * No description
-   *
-   * @tags catalog-controller
-   * @name GetCatalogItem
-   * @summary returns catalog item with given ID
-   * @request GET:/catalog-items/{id}
-   */
-  getCatalogItem = (id: string, params: RequestParams = {}) =>
-    this.request<CatalogItemDto, any>({
-      path: `/catalog-items/${id}`,
-      method: "GET",
-      format: "json",
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags catalog-controller
-   * @name UpdateCatalogItem
-   * @summary updates catalog item with given ID
-   * @request PUT:/catalog-items/{id}
-   */
-  updateCatalogItem = (id: string, data: CatalogItemDto, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/catalog-items/${id}`,
-      method: "PUT",
-      body: data,
-      type: ContentType.Json,
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags catalog-controller
-   * @name DeleteCatalogItem
-   * @summary deletes catalog item with given ID
-   * @request DELETE:/catalog-items/{id}
-   */
-  deleteCatalogItem = (id: string, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/catalog-items/${id}`,
-      method: "DELETE",
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags catalog-controller
-   * @name GetCatalog
-   * @summary returns catalog items based on filter
-   * @request GET:/catalog-items
-   */
-  getCatalog = (query?: { name?: string; country?: string; type?: string }, params: RequestParams = {}) =>
-    this.request<CatalogItemDto[], any>({
-      path: `/catalog-items`,
-      method: "GET",
-      query: query,
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags catalog-controller
-   * @name AddCatalogItem
-   * @summary creates new catalog item
-   * @request POST:/catalog-items
-   */
-  addCatalogItem = (data: CatalogItemDto, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/catalog-items`,
-      method: "POST",
-      body: data,
-      type: ContentType.Json,
-      ...params,
-    });
-}
diff --git a/frontend/src/swagger/TitlePage.ts b/frontend/src/swagger/TitlePage.ts
deleted file mode 100644
index 0d657e1..0000000
--- a/frontend/src/swagger/TitlePage.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-/* eslint-disable */
-/* tslint:disable */
-/*
- * ---------------------------------------------------------------
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
- * ##                                                           ##
- * ## AUTHOR: acacode                                           ##
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
- * ---------------------------------------------------------------
- */
-
-import { TitlePageDto } from "./data-contracts";
-import { ContentType, HttpClient, RequestParams } from "./http-client";
-
-export class TitlePage<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
-  /**
-   * No description
-   *
-   * @tags title-page-controller
-   * @name GetTitlePage
-   * @summary returns title page
-   * @request GET:/title-page
-   */
-  getTitlePage = (params: RequestParams = {}) =>
-    this.request<TitlePageDto, any>({
-      path: `/title-page`,
-      method: "GET",
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags title-page-controller
-   * @name UpdateTitlePage
-   * @summary updates/creates title page
-   * @request POST:/title-page
-   */
-  updateTitlePage = (data: TitlePageDto, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/title-page`,
-      method: "POST",
-      body: data,
-      type: ContentType.Json,
-      ...params,
-    });
-}
diff --git a/frontend/src/swagger/Users.ts b/frontend/src/swagger/Users.ts
deleted file mode 100644
index 27d5c1b..0000000
--- a/frontend/src/swagger/Users.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-/* eslint-disable */
-/* tslint:disable */
-/*
- * ---------------------------------------------------------------
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
- * ##                                                           ##
- * ## AUTHOR: acacode                                           ##
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
- * ---------------------------------------------------------------
- */
-
-import { PasswordDto, PermissionDto, UserDto } from "./data-contracts";
-import { ContentType, HttpClient, RequestParams } from "./http-client";
-
-export class Users<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
-  /**
-   * No description
-   *
-   * @tags user-controller
-   * @name GetAllUsers
-   * @summary returns all users
-   * @request GET:/users
-   */
-  getAllUsers = (params: RequestParams = {}) =>
-    this.request<UserDto[], any>({
-      path: `/users`,
-      method: "GET",
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags user-controller
-   * @name RegisterNewUser
-   * @summary registers new user
-   * @request POST:/users
-   */
-  registerNewUser = (data: UserDto, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/users`,
-      method: "POST",
-      body: data,
-      type: ContentType.Json,
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags user-controller
-   * @name UpdatePermissions
-   * @summary changes permissions to given user
-   * @request PATCH:/users/{username}/permissions
-   */
-  updatePermissions = (username: string, data: PermissionDto, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/users/${username}/permissions`,
-      method: "PATCH",
-      body: data,
-      type: ContentType.Json,
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags user-controller
-   * @name ResetPassword
-   * @summary changes password to given user
-   * @request PATCH:/users/{username}/password
-   */
-  resetPassword = (username: string, data: PasswordDto, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/users/${username}/password`,
-      method: "PATCH",
-      body: data,
-      type: ContentType.Json,
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags user-controller
-   * @name ChangePassword
-   * @summary changes password to logged-in user
-   * @request PATCH:/users/password
-   */
-  changePassword = (query: { oldPassword: string }, data: PasswordDto, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/users/password`,
-      method: "PATCH",
-      query: query,
-      body: data,
-      type: ContentType.Json,
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags user-controller
-   * @name RefreshToken
-   * @summary returns a new access token and a refresh token to user
-   * @request GET:/users/token
-   */
-  refreshToken = (params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/users/token`,
-      method: "GET",
-      ...params,
-    });
-  /**
-   * No description
-   *
-   * @tags user-controller
-   * @name DeleteUser
-   * @summary deletes user with given username
-   * @request DELETE:/users/{username}
-   */
-  deleteUser = (username: string, params: RequestParams = {}) =>
-    this.request<void, any>({
-      path: `/users/${username}`,
-      method: "DELETE",
-      ...params,
-    });
-}
diff --git a/frontend/src/swagger/data-contracts.ts b/frontend/src/swagger/data-contracts.ts
deleted file mode 100644
index c8808aa..0000000
--- a/frontend/src/swagger/data-contracts.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-/* eslint-disable */
-/* tslint:disable */
-/*
- * ---------------------------------------------------------------
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
- * ##                                                           ##
- * ## AUTHOR: acacode                                           ##
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
- * ---------------------------------------------------------------
- */
-
-export interface CatalogItemDto {
-  /** @format uuid */
-  id?: string;
-  name?: string;
-
-  /** @format int32 */
-  certainty?: number;
-
-  /** @format double */
-  longitude?: number;
-
-  /** @format double */
-  latitude?: number;
-  bibliography?: string[];
-  countries?: string[];
-  writtenForms?: string[];
-  alternativeNames?: string[];
-  types?: string[];
-}
-
-export interface PasswordDto {
-  password: string;
-  confirmationPassword: string;
-}
-
-export interface PermissionDto {
-  canRead?: boolean;
-  canWrite?: boolean;
-  canDelete?: boolean;
-}
-
-export interface UserDto {
-  name?: string;
-  email: string;
-  permissions?: PermissionDto;
-  passwords: PasswordDto;
-}
-
-export interface TitlePageDto {
-  title?: string;
-  content?: string;
-}
diff --git a/frontend/src/swagger/http-client.ts b/frontend/src/swagger/http-client.ts
deleted file mode 100644
index ab33905..0000000
--- a/frontend/src/swagger/http-client.ts
+++ /dev/null
@@ -1,218 +0,0 @@
-/* eslint-disable */
-/* tslint:disable */
-/*
- * ---------------------------------------------------------------
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API        ##
- * ##                                                           ##
- * ## AUTHOR: acacode                                           ##
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
- * ---------------------------------------------------------------
- */
-
-export type QueryParamsType = Record<string | number, any>;
-export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
-
-export interface FullRequestParams extends Omit<RequestInit, "body"> {
-  /** set parameter to `true` for call `securityWorker` for this request */
-  secure?: boolean;
-  /** request path */
-  path: string;
-  /** content type of request body */
-  type?: ContentType;
-  /** query params */
-  query?: QueryParamsType;
-  /** format of response (i.e. response.json() -> format: "json") */
-  format?: ResponseFormat;
-  /** request body */
-  body?: unknown;
-  /** base url */
-  baseUrl?: string;
-  /** request cancellation token */
-  cancelToken?: CancelToken;
-}
-
-export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
-
-export interface ApiConfig<SecurityDataType = unknown> {
-  baseUrl?: string;
-  baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
-  securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
-  customFetch?: typeof fetch;
-}
-
-export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
-  data: D;
-  error: E;
-}
-
-type CancelToken = Symbol | string | number;
-
-export enum ContentType {
-  Json = "application/json",
-  FormData = "multipart/form-data",
-  UrlEncoded = "application/x-www-form-urlencoded",
-}
-
-export class HttpClient<SecurityDataType = unknown> {
-  public baseUrl: string = "http://localhost:8080";
-  private securityData: SecurityDataType | null = null;
-  private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
-  private abortControllers = new Map<CancelToken, AbortController>();
-  private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);
-
-  private baseApiParams: RequestParams = {
-    credentials: "same-origin",
-    headers: {},
-    redirect: "follow",
-    referrerPolicy: "no-referrer",
-  };
-
-  constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
-    Object.assign(this, apiConfig);
-  }
-
-  public setSecurityData = (data: SecurityDataType | null) => {
-    this.securityData = data;
-  };
-
-  private encodeQueryParam(key: string, value: any) {
-    const encodedKey = encodeURIComponent(key);
-    return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`;
-  }
-
-  private addQueryParam(query: QueryParamsType, key: string) {
-    return this.encodeQueryParam(key, query[key]);
-  }
-
-  private addArrayQueryParam(query: QueryParamsType, key: string) {
-    const value = query[key];
-    return value.map((v: any) => this.encodeQueryParam(key, v)).join("&");
-  }
-
-  protected toQueryString(rawQuery?: QueryParamsType): string {
-    const query = rawQuery || {};
-    const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
-    return keys
-      .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))
-      .join("&");
-  }
-
-  protected addQueryParams(rawQuery?: QueryParamsType): string {
-    const queryString = this.toQueryString(rawQuery);
-    return queryString ? `?${queryString}` : "";
-  }
-
-  private contentFormatters: Record<ContentType, (input: any) => any> = {
-    [ContentType.Json]: (input: any) =>
-      input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
-    [ContentType.FormData]: (input: any) =>
-      Object.keys(input || {}).reduce((formData, key) => {
-        const property = input[key];
-        formData.append(
-          key,
-          property instanceof Blob
-            ? property
-            : typeof property === "object" && property !== null
-            ? JSON.stringify(property)
-            : `${property}`,
-        );
-        return formData;
-      }, new FormData()),
-    [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
-  };
-
-  private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
-    return {
-      ...this.baseApiParams,
-      ...params1,
-      ...(params2 || {}),
-      headers: {
-        ...(this.baseApiParams.headers || {}),
-        ...(params1.headers || {}),
-        ...((params2 && params2.headers) || {}),
-      },
-    };
-  }
-
-  private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
-    if (this.abortControllers.has(cancelToken)) {
-      const abortController = this.abortControllers.get(cancelToken);
-      if (abortController) {
-        return abortController.signal;
-      }
-      return void 0;
-    }
-
-    const abortController = new AbortController();
-    this.abortControllers.set(cancelToken, abortController);
-    return abortController.signal;
-  };
-
-  public abortRequest = (cancelToken: CancelToken) => {
-    const abortController = this.abortControllers.get(cancelToken);
-
-    if (abortController) {
-      abortController.abort();
-      this.abortControllers.delete(cancelToken);
-    }
-  };
-
-  public request = async <T = any, E = any>({
-    body,
-    secure,
-    path,
-    type,
-    query,
-    format,
-    baseUrl,
-    cancelToken,
-    ...params
-  }: FullRequestParams): Promise<HttpResponse<T, E>> => {
-    const secureParams =
-      ((typeof secure === "boolean" ? secure : this.baseApiParams.secure) &&
-        this.securityWorker &&
-        (await this.securityWorker(this.securityData))) ||
-      {};
-    const requestParams = this.mergeRequestParams(params, secureParams);
-    const queryString = query && this.toQueryString(query);
-    const payloadFormatter = this.contentFormatters[type || ContentType.Json];
-    const responseFormat = format || requestParams.format;
-
-    return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
-      ...requestParams,
-      headers: {
-        ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
-        ...(requestParams.headers || {}),
-      },
-      signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
-      body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
-    }).then(async (response) => {
-      const r = response as HttpResponse<T, E>;
-      r.data = null as unknown as T;
-      r.error = null as unknown as E;
-
-      const data = !responseFormat
-        ? r
-        : await response[responseFormat]()
-            .then((data) => {
-              if (r.ok) {
-                r.data = data;
-              } else {
-                r.error = data;
-              }
-              return r;
-            })
-            .catch((e) => {
-              r.error = e;
-              return r;
-            });
-
-      if (cancelToken) {
-        this.abortControllers.delete(cancelToken);
-      }
-
-      if (!response.ok) throw data;
-      return data;
-    });
-  };
-}
diff --git a/nginx/Dockerfile.dev b/nginx/Dockerfile.dev
new file mode 100644
index 0000000..85ae399
--- /dev/null
+++ b/nginx/Dockerfile.dev
@@ -0,0 +1,2 @@
+FROM nginx
+COPY ./default.conf /etc/nginx/conf.d/default.conf
\ No newline at end of file
diff --git a/nginx/default.conf b/nginx/default.conf
new file mode 100644
index 0000000..759f067
--- /dev/null
+++ b/nginx/default.conf
@@ -0,0 +1,27 @@
+upstream client {
+    server client:3000;
+}
+
+upstream api {
+    server api:5000;
+}
+
+server {
+    listen 80;
+
+    location / {
+        proxy_pass http://client;
+    }
+
+    location /sockjs-node {
+        proxy_pass http://client;
+        proxy_http_version 1.1;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "Upgrade";
+    }
+
+    location /api {
+        rewrite /api/(.*) /$1 break;
+        proxy_pass http://api;
+    }
+}
