diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bf6a852 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9-alpine as python + +RUN mkdir /root/DTS-aggregator +WORKDIR /root/DTS-aggregator + +COPY ["./", "./"] + +RUN pip install -r requirements.txt + +EXPOSE 5000 + +CMD ["flask", "run", "--host=0.0.0.0"] \ No newline at end of file diff --git a/README.md b/README.md index 7ee5696..462c0c0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # DTS aggregator -An aggregator of known [DTS](https://w3id.org/dts/) APIs, implemented as a DTS API and running as a [Flask](https://flask.palletsprojects.com/) application. - -**What does it mean?** This registry is itself a DTS collection of DTS APIs. - -A demo version of the DTS aggregator is accessible at . +An aggregator of known [DTS](https://w3id.org/dts/) APIs, implemented as a DTS API and running as a [Flask](https://flask.palletsprojects.com/) application (this just means that the registry itself is a DTS collection of DTS APIs). A list of known APIs is maintained in [`registry.json`](./registry.json). Are you aware of a DTS API that is not listed there? Please add it to the registry file and open a Pull Request. @@ -22,3 +18,17 @@ pip install -r requirements.txt ```bash flask run ``` + +## Run the aggregator on a container (Docker/Podman) + +Navigate to the aggregator root folder, then run : + +```bash +docker build -t dts-agg-image . +``` + +start container with : + +```bash +docker run --rm --name dts-agg -itd -p 5000:5000 dts-agg-image +``` \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py index b4947c6..90e711e 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -24,7 +24,8 @@ def count_total_items(baseuri: str) -> int: """ h = {"User-Agent": "DTS Client"} entry_request = requests.get(baseuri, headers=h) - ENDPOINTS = entry_request.json() + if entry_request.status_code == 200: + ENDPOINTS = entry_request.json() try: ROOT_COLLECTION = requests.get( diff --git a/registry.json b/registry.json index bf5f41e..ff5be54 100644 --- a/registry.json +++ b/registry.json @@ -11,7 +11,7 @@ } }, { - "endpoint": "http://dev.chartes.psl.eu/api/nautilus/dts", + "endpoint": "https://dev.chartes.psl.eu/dts", "protocol": "dts", "status": "demo", "label": "École des Chartes Demo", @@ -40,16 +40,6 @@ "name": "Frank Grieshaber" } }, - { - "endpoint": "https://dts.perseids.org/", - "label":"Perseids", - "protocol": "dts", - "status": "experimental", - "contact": { - "email": "mailto:Zachary.Fletcher@tufts.edu", - "name": "Zachary Fletcher" - } - }, { "endpoint": "https://teipublisher.com/exist/apps/vangogh/api/dts", "label":"Van Gogh Letters (TEIPublisher demo)", @@ -69,5 +59,15 @@ "email": "mailto:thibault.clerice@chartes.psl.eu", "name": "Thibault Clérice" } - } + }, + { + "endpoint": "https://www.briefedition.alfred-escher.ch/exist/apps/escher/api/dts/", + "protocol": "dts", + "status": "production", + "label": "Alfred Escher-Briefedition", + "contact": { + "email": "mailto:staatsarchivzh@ji.zh.ch", + "name": "Staatsarchiv | Kanton Zürich" + } + } ]} diff --git a/requirements.txt b/requirements.txt index 1e670c7..7c08aeb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -flask>=1.1.1,<=2.0.0 +flask>=3.0.0 flask-cors>=3.0.8,<=4.0.0 gunicorn requests