Skip to content
Snippets Groups Projects
Commit a8581aa2 authored by Martin Weise's avatar Martin Weise
Browse files

Merge branch 'dev' into 393-frontend-needs-yaml-configuration-for-cloud-environments

parents e77b0749 d0cc05bf
No related branches found
No related tags found
4 merge requests!231CI: Remove build for log-service,!228Better error message handling in the frontend,!223Release of version 1.4.0,!211Added more configuration options for frontend
......@@ -58,6 +58,41 @@ since RabbitMQ maintains state inside the container.
We maintain a rapid prototype deployment option through Docker Compose (v2.17.0 and newer). This deployment creates the
core infrastructure and a single Docker container for all user-generated databases.
=== ":simple-linux: Linux"
Download and install [Docker Engine](https://docs.docker.com/desktop/install/linux-install/) for your Linux
distribution. Although the installation might work, we *do not* recommend Docker Desktop.
Ensure the Docker daemon is running at all times:
systemctl enable docker --now
Install DBRepo with the default configuration:
curl -sSL https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/install.sh | bash
=== ":simple-windows: Windows"
Open `cmd.exe` as administrator and install WSL2 and the Debian subsystem:
wsl --install Debian
Open `optionalfeatures` by typing into the open terminal window or searching for it and enable "Windows Subsystem
for Linux":
<figure markdown>
![Data ingest](images/optionalfeatures.png){ .img-border }
<figcaption>Enable Subsystem for Linux in Windows Features</figcaption>
</figure>
Install [Docker Desktop](https://docs.docker.com/desktop/install/windows-install/) on the Windows host machine.
Open Docker Desktop and go to settings (:fontawesome-solid-gear:) > General > Tick "Use WSL2 based engine" if not
already ticked.
Open the Debian container by typing "Debian" into the search, you should see a terminal window.
Install DBRepo with the default configuration from the Debian container:
curl -sSL https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/install.sh | bash
View the logs:
......
......@@ -31,7 +31,7 @@ The helm chart depends on four components:
## Configuration before the installation
Define an admin user that the services can use to communicate with
the [authentication service](../system-services-authentication). You will need to manually create this user later after
the [Authentication Service](../system-services-authentication). You will need to manually create this user later after
the installation.
## Configuration after the installation
......@@ -55,6 +55,10 @@ the [authentication service](../system-services-authentication) as `admin` and:
3. Assign this user the role `admin`.
4. Delete the user `admin`.
Then import the DBRepo realm by clicking the dropdown "master" > Create Realm and import
the [`dbrepo-realm.json`](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/dbrepo-authentication-service/dbrepo-realm.json)
by uploading the file *or* copying the contents and click "Create".
### Backup
tbd
......
.docs/images/optionalfeatures.png

13.7 KiB

......@@ -282,10 +282,8 @@ CREATE TABLE IF NOT EXISTS `mdb_concepts`
name VARCHAR(255) null,
description TEXT null,
created timestamp NOT NULL DEFAULT NOW(),
created_by character varying(36) NOT NULL,
PRIMARY KEY (id),
UNIQUE (uri(200)),
FOREIGN KEY (created_by) REFERENCES mdb_users (id)
UNIQUE (uri(200))
) WITH SYSTEM VERSIONING;
CREATE TABLE IF NOT EXISTS `mdb_units`
......@@ -295,10 +293,8 @@ CREATE TABLE IF NOT EXISTS `mdb_units`
name VARCHAR(255) null,
description TEXT null,
created timestamp NOT NULL DEFAULT NOW(),
created_by character varying(36) NOT NULL,
PRIMARY KEY (id),
UNIQUE (uri(200)),
FOREIGN KEY (created_by) REFERENCES mdb_users (id)
UNIQUE (uri(200))
) WITH SYSTEM VERSIONING;
CREATE TABLE IF NOT EXISTS `mdb_columns_concepts`
......
FROM python:3.10-alpine
RUN adduser -D alpine
RUN apk add bash curl && adduser -D alpine
WORKDIR /home/alpine
......@@ -12,6 +12,7 @@ RUN pip install pipenv && \
COPY ./app ./app
COPY ./scripts ./scripts
COPY ./us-yml ./us-yml
COPY config.py wsgi.py ./
ENV FLASK_APP=wsgi.py
......
......@@ -2,7 +2,7 @@
import os
import logging
from flasgger import LazyJSONEncoder
from flasgger import LazyJSONEncoder, Swagger
from flask import Flask
from opensearchpy import OpenSearch
from config import Config
......@@ -41,7 +41,55 @@ def create_app(config_class=Config):
metrics = PrometheusMetrics(app)
metrics.info("app_info", "Application info", version="0.0.1")
app.config["SWAGGER"] = {"openapi": "3.0.0", "title": "Swagger UI", "uiversion": 3}
app.config["SWAGGER"] = {"openapi": "3.0.1", "title": "Swagger UI", "uiversion": 3}
swagger_config = {
"headers": [],
"specs": [
{
"endpoint": "api-search",
"route": "/api-search.json",
"rule_filter": lambda rule: rule.endpoint.startswith('actuator'),
"model_filter": lambda tag: True, # all in
}
],
"static_url_path": "/flasgger_static",
"swagger_ui": True,
"specs_route": "/swagger-ui/",
}
template = {
"openapi": "3.0.0",
"info": {
"title": "Database Repository Search Service API",
"description": "Service that searches the search database",
"version": "1.3.0",
"contact": {
"name": "Prof. Andreas Rauber",
"email": "andreas.rauber@tuwien.ac.at"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
},
},
"externalDocs": {
"description": "Sourcecode Documentation",
"url": "https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services"
},
"servers": [
{
"url": "http://localhost:4000",
"description": "Generated server url"
},
{
"url": "https://test.dbrepo.tuwien.ac.at",
"description": "Sandbox"
}
]
}
swagger = Swagger(app, config=swagger_config, template=template)
# https://flask-jwt-extended.readthedocs.io/en/stable/options/
app.config["JWT_ALGORITHM"] = "HS256"
app.config["JWT_DECODE_ISSUER"] = os.getenv("JWT_ISSUER")
......
from flask import Blueprint
api_bp = Blueprint("api", __name__, url_prefix="/api/search")
api_bp = Blueprint("api", __name__)
from app.api import routes
......@@ -56,7 +56,13 @@ def general_filter(index, results):
return results
@api_bp.route("<string:index>", methods=["GET"], endpoint="endpoint")
@api_bp.route("/health", methods=["GET"], endpoint="actuator_health")
@swag_from("us-yml/get_health") # ToDo: get the SWAG right
def health():
return {"status": "UP"}
@api_bp.route("/api/search/<string:index>", methods=["GET"], endpoint="search_get_index")
@swag_from("us-yml") # ToDo: get the SWAG right
def get_index(index):
"""
......@@ -91,7 +97,7 @@ def get_index(index):
return {"results": results, "total": total_number_of_results, "status": 200}
@api_bp.route("<string:index>/fields", methods=["GET"], endpoint="blabla")
@api_bp.route("/api/search/<string:index>/fields", methods=["GET"], endpoint="search_get_index_fields")
def get_fields(index):
"""
returns a list of attributes of the data for a specific index.
......@@ -120,7 +126,7 @@ def get_fields(index):
return {"fields": fields, "status": 200}
@api_bp.route("", methods=["POST"], endpoint="endpoint2")
@api_bp.route("/api/search", methods=["POST"], endpoint="search_fuzzy_search")
def search():
"""
Main endpoint for general searching.
......
summary: Return a healthcheck
description: |
Return UP if the instance is ready to serve connections.
consumes:
- application/json
produces:
- application/json
parameters: []
definitions:
Health:
type: object
properties:
status:
type: string
description: UP
responses:
200:
description: OK, service is up and running
schema:
$ref: "#/definitions/Column"
404:
description: Service is not yet ready
tags:
- actuator
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment