diff --git a/Dockerfile b/Dockerfile index 83561f4..e48f5d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ FROM nginx COPY nginx.conf /etc/nginx/conf.d/default.conf -COPY ./interface.html /usr/share/nginx/html/index.html +COPY ./www /usr/share/nginx/html diff --git a/k8s.yaml b/k8s.yaml new file mode 100644 index 0000000..be0e472 --- /dev/null +++ b/k8s.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-converter-deployment + namespace: converter + labels: + app: nginx-converter +spec: + replicas: 1 + selector: + matchLabels: + app: nginx-converter + template: + metadata: + labels: + app: nginx-converter + spec: + containers: + - name: nginx + image: git.danilkolesnikov.ru/danilko09/converter_nginx + ports: + - containerPort: 80 + - name: swagger-ui + image: swaggerapi/swagger-ui + ports: + - containerPort: 8080 + env: + - name: BASE_URL # <--- ADD THIS + value: "/docs" + - name: URLS + value: | + [ + { "url": "/app_openapi.json", "name": "Product matcher" }, + { "url": "/uc_openapi.json", "name": "Unit converter" }, + { "url": "/rc_openapi.json", "name": "Product matcher (region)" } + ] + - name: URLS_PRIMARY_NAME + value: "Product matcher (region)" diff --git a/nginx.conf b/nginx.conf index e76e8b1..0fc931b 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,3 +1,9 @@ +map $http_referer $openapi_backend { + "~*/uc/" http://10.100.10.70:9999/; + + "~*/app/" http://10.100.11.188:8901/; +} + server { listen 80; server_name localhost; @@ -8,10 +14,19 @@ server { } location /uc/ { - proxy_pass http://10.100.10.70:9999; + proxy_pass http://10.100.10.70:9999/; } location /app/ { - proxy_pass http://10.100.11.188:8901; + proxy_pass http://10.100.11.188:8903/; + } + + location /region_search/ { + proxy_pass http://10.100.11.188:8902/; + } + + location /docs/ { + proxy_pass http://localhost:8080; + proxy_set_header Host $host; } } diff --git a/www/app_openapi.json b/www/app_openapi.json new file mode 100644 index 0000000..b7acbb8 --- /dev/null +++ b/www/app_openapi.json @@ -0,0 +1,168 @@ +{ + "openapi": "3.1.0", + "info": { "title": "Product Matcher UI", "version": "1.0.0" }, + "servers": [{ "url": "/app" }], + "paths": { + "/health": { + "get": { + "summary": "Health", + "operationId": "health_health_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { "application/json": { "schema": {} } } + } + } + } + }, + "/": { + "get": { + "summary": "Home", + "operationId": "home__get", + "responses": { + "200": { + "description": "Successful Response", + "content": { "text/html": { "schema": { "type": "string" } } } + } + } + } + }, + "/search": { + "post": { + "summary": "Search Form", + "operationId": "search_form_search_post", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/Body_search_form_search_post" + } + } + } + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { "text/html": { "schema": { "type": "string" } } } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + } + } + }, + "/api/search": { + "post": { + "summary": "Search Api", + "operationId": "search_api_api_search_post", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/SearchRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { "application/json": { "schema": {} } } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Body_search_form_search_post": { + "properties": { + "query_text": { + "type": "string", + "title": "Query Text", + "default": "песчано-гравийная смесь фракция 0-40" + }, + "top_k": { "type": "integer", "title": "Top K", "default": 20 }, + "use_rerank": { + "anyOf": [{ "type": "string" }, { "type": "null" }], + "title": "Use Rerank" + }, + "rerank_strategy": { + "type": "string", + "title": "Rerank Strategy", + "default": "lexical" + } + }, + "type": "object", + "title": "Body_search_form_search_post" + }, + "HTTPValidationError": { + "properties": { + "detail": { + "items": { "$ref": "#/components/schemas/ValidationError" }, + "type": "array", + "title": "Detail" + } + }, + "type": "object", + "title": "HTTPValidationError" + }, + "SearchRequest": { + "properties": { + "query_text": { + "type": "string", + "title": "Query Text", + "default": "песчано-гравийная смесь фракция 0-40" + }, + "top_k": { + "type": "integer", + "maximum": 1000.0, + "minimum": 1.0, + "title": "Top K", + "default": 20 + }, + "use_rerank": { + "type": "boolean", + "title": "Use Rerank", + "default": false + }, + "rerank_strategy": { + "type": "string", + "title": "Rerank Strategy", + "default": "lexical" + } + }, + "type": "object", + "title": "SearchRequest" + }, + "ValidationError": { + "properties": { + "loc": { + "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] }, + "type": "array", + "title": "Location" + }, + "msg": { "type": "string", "title": "Message" }, + "type": { "type": "string", "title": "Error Type" }, + "input": { "title": "Input" }, + "ctx": { "type": "object", "title": "Context" } + }, + "type": "object", + "required": ["loc", "msg", "type"], + "title": "ValidationError" + } + } + } +} diff --git a/interface.html b/www/interface.html similarity index 73% rename from interface.html rename to www/interface.html index 6f4be12..b633f6b 100644 --- a/interface.html +++ b/www/interface.html @@ -497,15 +497,9 @@
Параметры поиска
-