diff --git a/.docs/docker/_footer.md b/.docs/docker/_footer.md new file mode 100644 index 0000000000000000000000000000000000000000..eb8216a67fb75f9eafb6500732e7824724796d55 --- /dev/null +++ b/.docs/docker/_footer.md @@ -0,0 +1,10 @@ +# License + +View [license information](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/blob/master/LICENSE) +for the software contained in this image. + +As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc +from the base distribution, along with any direct or indirect dependencies of the primary software being contained). + +As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies +with any relevant licenses for all software contained within. \ No newline at end of file diff --git a/.docs/docker/_header.md b/.docs/docker/_header.md new file mode 100644 index 0000000000000000000000000000000000000000..456fb2c206c4e2a2eb8615c1b9c1268bd978fd1c --- /dev/null +++ b/.docs/docker/_header.md @@ -0,0 +1,41 @@ +# Quick Reference + +* **Maintained by**: + + [the DBRepo Maintainers](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/graphs/dev) + +* **Where to get help**: + + [the official documentation](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/latest/), + +# Supported tags + +* [`1.3`](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/blob/master/dbrepo-DIR/Dockerfile/) +* [`latest`](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/blob/dev/dbrepo-DIR/Dockerfile/) + +# Non-supported tags + +* `1.2` +* `1.1` + +# Quick reference (cont.) + +* **Where to file issues**: + + Send us an [email](https://tiss.tuwien.ac.at/person/287722.html) + +* **Supported architectures:** + + `amd64` + +* **Source of this description:** + + [docs repo's `.docs/docker` directory](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/tree/dev/.docs/docker) + ([history](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/commits/dev/.docs/docker)) + +# What is DBRepo? + +We present a database repository system that allows researchers to ingest data into a central, versioned repository +through common interfaces, provides efficient access to arbitrary subsets of data even when the underlying data store is +evolving, allows reproducing of query results and supports findable-, accessible-, interoperable- and reusable (FAIR) +data. diff --git a/.docs/docker/body.md b/.docs/docker/body.md new file mode 100644 index 0000000000000000000000000000000000000000..4f28b77219d5d5db2c881707a1f68fcc77a22fc4 --- /dev/null +++ b/.docs/docker/body.md @@ -0,0 +1,4 @@ +## FRIENDLY_NAME + +More documentation can be found on +the [system description](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/latest/DOC/). \ No newline at end of file diff --git a/.docs/docker/client/Dockerhub.py b/.docs/docker/client/Dockerhub.py new file mode 100644 index 0000000000000000000000000000000000000000..254a30ae7b49fca21b2a1c2603eaa24cd1bb2fd7 --- /dev/null +++ b/.docs/docker/client/Dockerhub.py @@ -0,0 +1,51 @@ +import requests as rq +import os + + +class Dockerhub: + """A simple Dockerhub client""" + baseurl = "https://hub.docker.com" + username = "" + registry = os.getenv("CI_REGISTRY_URL", "docker.io") + workpath = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) + headers = { + "Content-Type": "application/json", + "Authorization": None + } + + def __init__(self): + self.username = os.getenv("CI_REGISTRY_USER", "mweise") + print("docker username: %s" % self.username) + response = rq.post(self.baseurl + "/v2/users/login", { + "username": self.username, + "password": os.getenv("CI_REGISTRY_PASSWORD", "rMC7ysaYZJbPqi8vSUM5AzTJsuPH4U") + }) + if response.status_code == 200: + self.headers["Authorization"] = "Bearer " + response.json()["token"] + else: + raise "Failed to authenticate" + + def modify_description(self, component: {}): + header = self.__read__(self.workpath + "/_header.md", component) + footer = self.__read__(self.workpath + "/_footer.md", component) + body = self.__read__(self.workpath + "/body.md", component) + url = self.baseurl + "/v2/repositories/dbrepo/" + component["dir"] + "/" + print("dispatch update: %s" % url) + response = rq.patch(url, headers=self.headers, + json={ + "description": f"Official DBRepo {component['name']} image", + "full_description": header + "\n\n" + body + "\n\n" + footer, + "registry": self.registry + }) + if response.status_code == 200: + return response.json() + else: + print(response) + + def __read__(self, path, component): + with open(path, "r") as f: + return ' '.join([line for line in f.readlines()]).replace( + "DIR", component["dir"]).replace( + "DOC", component["doc"]).replace( + "FRIENDLY_NAME", component["name"] + ) diff --git a/.docs/docker/client/__init__.py b/.docs/docker/client/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.docs/docker/release.py b/.docs/docker/release.py new file mode 100644 index 0000000000000000000000000000000000000000..d29dc4ec271f906187412c8cebb6111c106b0d01 --- /dev/null +++ b/.docs/docker/release.py @@ -0,0 +1,50 @@ +#!/bin/env python3 +from client.Dockerhub import Dockerhub +from dotenv import load_dotenv + +load_dotenv() + +dockerhub = Dockerhub() + +components = [ + { + "name": "Analyse Service", + "doc": "system-services-analyse", + "dir": "analyse-service" + }, + { + "name": "Authentication Service", + "doc": "system-services-authentication", + "dir": "authentication-service" + }, + { + "name": "Broker Service", + "doc": "system-services-broker", + "dir": "broker-service" + }, + { + "name": "Data Service", + "doc": "system-services-data", + "dir": "data-service" + }, + { + "name": "Metadata Service", + "doc": "system-services-metadata", + "dir": "metadata-service" + }, + { + "name": "Metadata Database", + "doc": "system-metadata-db", + "dir": "metadata-db" + }, + { + "name": "User Interface", + "doc": "system-other-ui", + "dir": "ui" + } +] + +if __name__ == "__main__": + for component in components: + response = dockerhub.modify_description(component) + print(response) diff --git a/.docs/docker/setup.py b/.docs/docker/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..5eda1103d1838fac042ea1656bdf9fd592002ea7 --- /dev/null +++ b/.docs/docker/setup.py @@ -0,0 +1,10 @@ +from distutils.core import setup + +setup(name='dockerhub-client', + version='1.0', + description='Dockerhub Maintenance Client', + author='Martin Weise', + author_email='martin.weise@tuwien.ac.at', + url='https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/latest/', + packages=['dockerhub-client'], + ) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 461eeaaea80674f4f36936b3ebb8045d2abd91f3..ddaad34cd8ada548c664651bb4a15e629bb718f3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -561,11 +561,12 @@ docs-latest: script: - apt-get update && apt-get install -y git make - git fetch && git checkout dev - - pip install -r ./.docs/requirements.txt + - pip install -r ./requirements.txt - mkdir -p ./final - mkdocs build && cp -r ./site ./final/latest - cp ./.docs/redirect.html ./final/index.html - cp -r ./swagger/latest ./final/latest/swagger + - python3 .docs/docker/release.py cache: paths: - ./final @@ -592,6 +593,7 @@ docs-version: - mkdir -p ./final - mkdocs build && cp -r ./site ./final/1.3 - cp -r ./swagger/1.3 ./final/1.3/swagger + - python3 .docs/docker/release.py cache: paths: - ./final