From 4895d6cbe351e6c1ceb31c587fb4778f1979eb60 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Tue, 13 Jun 2023 16:39:25 +0200 Subject: [PATCH] Updated the docs --- .gitignore | 2 +- dockerhub/client/Dockerhub.py | 7 ++-- dockerhub/release.py | 5 ++- docs/get-started.md | 56 ++++++++++++++++++++++++++------ docs/system.md | 2 +- misc/architecture.drawio | 61 ++++++++++++++++++++++++++++++++--- mkdocs.yml | 1 + 7 files changed, 114 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 26771e2..7a23556 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,7 @@ id_rsa .idea/ ## Docker Hub -dockerhub/.env +.env ## Virtual Environment venv/ diff --git a/dockerhub/client/Dockerhub.py b/dockerhub/client/Dockerhub.py index 0f2d394..d8ede6e 100644 --- a/dockerhub/client/Dockerhub.py +++ b/dockerhub/client/Dockerhub.py @@ -5,7 +5,7 @@ class Dockerhub: """A simple Dockerhub client""" baseurl = "https://hub.docker.com" username = "" - registry = "registry-1.docker.io" + registry = "docker.io" workpath = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) headers = { "Content-Type": "application/json", @@ -14,6 +14,7 @@ class Dockerhub: def __init__(self): self.username = os.getenv("DOCKER_USERNAME") + print("docker username: %s" % self.username) response = rq.post(self.baseurl + "/v2/users/login", { "username": self.username, "password": os.getenv("DOCKER_PASSWORD") @@ -28,7 +29,9 @@ class Dockerhub: header = self.__read__(self.workpath + "/_header.md").replace('REPOSITORY', repository) footer = self.__read__(self.workpath + "/_footer.md").replace('REPOSITORY', repository) body = self.__read__(self.workpath + "/fda-" + repository + ".md") - response = rq.patch(self.baseurl + "/v2/repositories/" + self.username + "/" + repository + "/", headers=self.headers, + url = self.baseurl + "/v2/repositories/dbrepo/" + repository + "/" + print("dispatch update: %s" % url) + response = rq.patch(url, headers=self.headers, json={ "description": "Official repository of DBRepo.", "full_description": header + "\n\n" + body + "\n\n" + footer, diff --git a/dockerhub/release.py b/dockerhub/release.py index 9ea3e8c..42335de 100755 --- a/dockerhub/release.py +++ b/dockerhub/release.py @@ -8,8 +8,7 @@ dockerhub = Dockerhub() if __name__ == "__main__": for component in ["analyse-service", "authentication-service", "broker-service", "container-service", - "database-service", "discovery-service", "gateway-service", "identifier-service", - "metadata-db", "metadata-service", "query-service", "table-service", "ui", "semantics-service", - "search-service"]: + "database-service", "identifier-service", "metadata-db", "metadata-service", "query-service", + "table-service", "ui", "semantics-service", "user-service"]: response = dockerhub.modify_description(component) print(response) diff --git a/docs/get-started.md b/docs/get-started.md index 5992112..2d75002 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -18,7 +18,7 @@ hide: ### Hardware For this small, local, test deployment any modern hardware would suffice, we recommend a dedicated virtual machine with -the following settings. Note that most of the CPU and RAM resources will be needed for starting the infrastructure, +the following settings. Note that most of the CPU and RAM resources will be needed for starting the infrastructure, this is because of Docker. - 8 CPU cores @@ -35,24 +35,28 @@ we only consider Debian. ### Docker Compose -We maintain a rapid prototype deployment option through Docker Compose. +We maintain a rapid prototype deployment option through Docker Compose (v2.17.0 and newer). Download the -latest [`docker-compose.yml`](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/docker-compose.prod.yml) +latest [`docker-compose.yml`](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/docker-compose.prod.yml), +nginx reverse proxy +conf [`dbrepo.conf`](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/dbrepo.conf) and [`.env`](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/.env.unix.example): - curl -o docker-compose.yml \ - https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/docker-compose.prod.yml - curl -o .env \ - https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/.env.unix.example + curl -o docker-compose.yml https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/docker-compose.prod.yml + curl -o dbrepo.conf https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/dbrepo.conf + curl -o .env https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/.env.unix.example Start the services: - docker-compose up -d + docker compose pull + docker compose up -d View the logs: - docker-compose logs -f + docker compose logs -f + +You should now be able to view the front end at <a href="http://127.0.0.1:80" target="_blank">http://127.0.0.1:80</a> Please be warned that the default configuration is not intended for public deployments. It is only intended to have a running system within minutes to play around within the system and explore features. @@ -94,6 +98,40 @@ running system within minutes to play around within the system and explore featu [simple guide](http://nginx.org/en/docs/http/configuring_https_servers.html) on how to install a SSL/TLS certificate on NGINX. +##### Migration from 1.2 to 1.3 + +In case you have a previous deployment from version 1.2, shut down the containers and back them up manually. You can do +this by using the `busybox` image. Replace `deadbeef` with your container name or hash: + +```console +export NAME=dbrepo-userdb-xyz +docker run --rm --volumes-from $NAME -v /home/$USER/backup:/backup busybox tar pcvfz /backup/$NAME.tar.gz /var/lib/mysql +``` + +!!! danger "Wipe all traces of DBRepo from your system" + + To erase all traces of DBRepo from your computer or virtual machine, the following commands delete all containers, + volumes and networks that are present, execute the following **dangerous** command. It will **wipe** all information + about DBRepo from your system (excluding the images). + + ```console + docker container stop $(docker container ls -aq -f name=^/dbrepo-.*) || true + docker container rm $(docker container ls -aq -f name=^/dbrepo-.*) || true + docker volume rm $(docker volume ls -q -f name=^dbrepo-.*) || true + docker network rm $(docker network ls -q -f name=^dbrepo-.*) || true + ``` + +You can restore the volume *after* downloading the new 1.3 images and creating the infrastructure: + +```console +export NAME=dbrepo-userdb-xyz +export PORT=12345 +docker container create -h $NAME --name $NAME -p $PORT:3306 -e MARIADB_ROOT_PASSWORD=mariadb --network userdb -v /backup mariadb:10.5 +docker run --rm --volumes-from $NAME -v /home/$USER/backup/.tar.gz:/backup/$NAME.tar.gz busybox sh -c 'cd /backup && tar xvfz /backup/$NAME.tar.gz && cp -r /backup/var/lib/mysql/* /var/lib/mysql' +``` + +Future releases will be backwards compatible and will come with migration scripts. + ### Kubernetes We maintain a RKE2 Kubernetes deployment from version 1.3 onwards. More on that when the release date is fixed. diff --git a/docs/system.md b/docs/system.md index 23b1373..93e9623 100644 --- a/docs/system.md +++ b/docs/system.md @@ -66,7 +66,7 @@ the authentication will be through Keycloak. * Temporary passwords By default, the Authentication Service comes with a self-signed certificate valid 3 months from build date. For -deployment it is *highly encouraged* to use your own certificate, properly issued by a trusted PKI, e.g. GEÁNT. For +deployment it is *highly encouraged* to use your own certificate, properly issued by a trusted PKI, e.g. GÉANT. For local deployments you can use the self-signed certificate. You need to accept the risk in most browsers when visiting the [admin panel](https://localhost:8443/admin/). diff --git a/misc/architecture.drawio b/misc/architecture.drawio index a688ab9..9e10ff5 100644 --- a/misc/architecture.drawio +++ b/misc/architecture.drawio @@ -1,6 +1,6 @@ -<mxfile host="Electron" modified="2023-06-01T06:09:08.990Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.1.2 Chrome/106.0.5249.199 Electron/21.4.3 Safari/537.36" etag="-Z1STi4cUE9hBolYebCG" version="21.1.2" type="device" pages="3"> +<mxfile host="Electron" modified="2023-06-06T08:55:21.186Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.1.2 Chrome/106.0.5249.199 Electron/21.4.3 Safari/537.36" etag="RoMWSCJjkYZ4h8t0DaKr" version="21.1.2" type="device" pages="4"> <diagram name="Deployment" id="BS_rNRZWEkVqn4O3IFNu"> - <mxGraphModel dx="1434" dy="822" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="840" pageHeight="509" math="0" shadow="0"> + <mxGraphModel dx="2074" dy="1182" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="840" pageHeight="509" math="0" shadow="0"> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> @@ -206,7 +206,7 @@ </mxGraphModel> </diagram> <diagram id="mvBsv1rP8O80Qe3yGnn_" name="Architecture"> - <mxGraphModel dx="1434" dy="822" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0"> + <mxGraphModel dx="2074" dy="1182" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0"> <root> <mxCell id="0" /> <mxCell id="1" parent="0" /> @@ -556,7 +556,7 @@ </mxGraphModel> </diagram> <diagram name="Frontend" id="GYXS_N4ymJ7hX3zLKvDC"> - <mxGraphModel dx="1434" dy="822" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="583" pageHeight="413" math="0" shadow="0"> + <mxGraphModel dx="2074" dy="1182" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="583" pageHeight="413" math="0" shadow="0"> <root> <mxCell id="ihsuRJ9dWuDPEHVUeUyY-0" /> <mxCell id="ihsuRJ9dWuDPEHVUeUyY-1" parent="ihsuRJ9dWuDPEHVUeUyY-0" /> @@ -643,4 +643,57 @@ </root> </mxGraphModel> </diagram> + <diagram id="-TYUtxSewH07omKFn9Rp" name="Kubernetes"> + <mxGraphModel dx="1430" dy="815" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0"> + <root> + <mxCell id="0" /> + <mxCell id="1" parent="0" /> + <mxCell id="z5OKJBfVE0389Lpc2gJH-7" value="80, 443" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="z5OKJBfVE0389Lpc2gJH-1" target="z5OKJBfVE0389Lpc2gJH-2"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-1" value="Ingress" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=ing" vertex="1" parent="1"> + <mxGeometry x="20" y="390" width="50" height="48" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="z5OKJBfVE0389Lpc2gJH-2" target="z5OKJBfVE0389Lpc2gJH-4"> + <mxGeometry relative="1" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-2" value="dbrepo-ui" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=svc" vertex="1" parent="1"> + <mxGeometry x="130" y="390" width="50" height="48" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-4" value="pod" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=pod" vertex="1" parent="1"> + <mxGeometry x="240" y="390" width="50" height="48" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-13" value="Namespace dbrepo" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=ns" vertex="1" parent="1"> + <mxGeometry x="40" width="50" height="48" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-14" value="dbrepo-<br>metadata-db" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=svc" vertex="1" parent="1"> + <mxGeometry x="130" y="610" width="50" height="48" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" target="z5OKJBfVE0389Lpc2gJH-18"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="180" y="634" as="sourcePoint" /> + </mxGeometry> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;endArrow=none;endFill=0;" edge="1" parent="1" source="z5OKJBfVE0389Lpc2gJH-17"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="192.66666666666663" y="634.3333333333334" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-17" value="pod" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=pod" vertex="1" parent="1"> + <mxGeometry x="240" y="530" width="50" height="48" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-18" value="pod" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=pod" vertex="1" parent="1"> + <mxGeometry x="240" y="610" width="50" height="48" as="geometry" /> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=classic;startFill=1;endArrow=none;endFill=0;" edge="1" parent="1" source="z5OKJBfVE0389Lpc2gJH-20"> + <mxGeometry relative="1" as="geometry"> + <mxPoint x="192.66666666666663" y="633.6666666666666" as="targetPoint" /> + </mxGeometry> + </mxCell> + <mxCell id="z5OKJBfVE0389Lpc2gJH-20" value="pod" style="sketch=0;html=1;dashed=0;whitespace=wrap;fillColor=#2875E2;strokeColor=#ffffff;points=[[0.005,0.63,0],[0.1,0.2,0],[0.9,0.2,0],[0.5,0,0],[0.995,0.63,0],[0.72,0.99,0],[0.5,1,0],[0.28,0.99,0]];verticalLabelPosition=bottom;align=center;verticalAlign=top;shape=mxgraph.kubernetes.icon;prIcon=pod" vertex="1" parent="1"> + <mxGeometry x="240" y="690" width="50" height="48" as="geometry" /> + </mxCell> + </root> + </mxGraphModel> + </diagram> </mxfile> diff --git a/mkdocs.yml b/mkdocs.yml index e308b20..f23e3b6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -31,6 +31,7 @@ theme: repo: fontawesome/brands/git-alt palette: scheme: default + primary: custom font: code: Roboto Mono toggle: -- GitLab