diff --git a/.gitignore b/.gitignore index 2e5e0e6..80b43e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ __pycache__ +# data of containers /data/* +# ignore local venv /bin/ /lib/ /include/ diff --git a/Readme.md b/Readme.md index 21f33c2..894e858 100644 --- a/Readme.md +++ b/Readme.md @@ -1,26 +1,33 @@ +> [!NOTE] +> In diesem Repository befinden sich die Implementierung des Management und der Agenten-Plattform. Sowie Skripte zur Erstellung der Docker-Images. + +> [!WARNING] +> Um die Plattform zu benutzen, bitte das [Agent-Template](https://git.chai.uni-hamburg.de/UMS-Agenten/Agent-Template) benutzen! + # Agenten-Plattform ## Management - -- `./docker-mgmt/` -- `./ums/management/` -- `./web/` -- `./build-mgmt.sh` +Verzeichnisse insb.: +- `./utils/mgmt/` Docker container configs +- `./ums/management/` Python source +- `./web/` Jinja templates and web root +- `./build-mgmt.sh` Container build script ## Basic Agent - -- `./docker-agent/` -- `./ums/agent/` -- `./build-agent.sh` - +Verzeichnisse insb.: +- `./utils/agent/` Docker container configs +- `./ums/agent/` Python source +- `./build-agent.sh` Container build script ## Development ### Run via Docker - `docker compose up` -### VS Code Autocomplete ... +### VS Code Autocomplete +(In VS Code) + - `python3 -m venv .` (only once) - `source ./bin/activate` - `pip install requests fastapi pdoc` (only once) diff --git a/build-agent.sh b/build-agent.sh index 44e9e83..b14164a 100755 --- a/build-agent.sh +++ b/build-agent.sh @@ -35,7 +35,7 @@ for platform in $PLATFORMS; do docker build \ --pull \ --platform "linux/$platform" \ - --file "$SCRIPTPATH/docker-agent/Dockerfile" \ + --file "$SCRIPTPATH/utils/agent/Dockerfile" \ --build-arg FROM_IMAGE="$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_AGENT_BASE:$tag" \ --build-arg PIP_REQ_FILE="$requirements" \ --tag "$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_NAME_AGENT:$tag" \ @@ -45,6 +45,6 @@ done; if [ "$requirements" == "requirements.txt" ]; then # extract requirements-frozen.txt cid=$(docker create "$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_NAME_AGENT:cpu-arm64") - docker cp "$cid:/ums-agenten/requirements-frozen.txt" "$SCRIPTPATH/docker-agent/requirements-frozen.txt" + docker cp "$cid:/ums-agenten/requirements-frozen.txt" "$SCRIPTPATH/utils/agent/requirements-frozen.txt" docker rm "$cid" fi; diff --git a/build-mgmt.sh b/build-mgmt.sh index bb2abf8..89fa110 100755 --- a/build-mgmt.sh +++ b/build-mgmt.sh @@ -29,7 +29,7 @@ for platform in $PLATFORMS; do docker build \ --pull \ --platform "linux/$platform" \ - --file "$SCRIPTPATH/docker-mgmt/Dockerfile" \ + --file "$SCRIPTPATH/utils/mgmt/Dockerfile" \ --build-arg H_UID=1050 \ --build-arg PIP_REQ_FILE="$requirements" \ --build-arg H_GID=1050 \ @@ -41,6 +41,6 @@ done; if [ "$requirements" == "requirements.txt" ]; then # extract requirements-frozen.txt cid=$(docker create "$IMAGE_REGISTRY/$IMAGE_OWNER/$IMAGE_NAME_MGMT:arm64") - docker cp "$cid:/ums-agenten/requirements.txt" "$SCRIPTPATH/docker-mgmt/requirements-frozen.txt" + docker cp "$cid:/ums-agenten/requirements.txt" "$SCRIPTPATH/utils/mgmt/requirements-frozen.txt" docker rm "$cid" fi; diff --git a/docker-agent/Dockerfile b/utils/agent/Dockerfile similarity index 89% rename from docker-agent/Dockerfile rename to utils/agent/Dockerfile index c66a2c4..da48030 100644 --- a/docker-agent/Dockerfile +++ b/utils/agent/Dockerfile @@ -16,12 +16,12 @@ ARG PIP_REQ_FILE USER root RUN mkdir -p /ums-agenten/plattform/ && mkdir -p /ums-agenten/persist/ -COPY ./docker-agent/$PIP_REQ_FILE /ums-agenten/requirements.txt +COPY ./utils/agent/$PIP_REQ_FILE /ums-agenten/requirements.txt RUN pip3 install --break-system-packages --no-cache-dir -r /ums-agenten/requirements.txt \ && pip3 freeze -q -r /ums-agenten/requirements.txt > /ums-agenten/requirements-frozen.txt # install the code of the repo -COPY ./docker-mgmt/setup.py /ums-agenten/plattform/ +COPY ./utils/setup.py /ums-agenten/plattform/ RUN pip3 install --break-system-packages -e /ums-agenten/plattform/ COPY --chown=user:user ./ums/ /ums-agenten/plattform/ums/ diff --git a/docker-agent/requirements-frozen.txt b/utils/agent/requirements-frozen.txt similarity index 100% rename from docker-agent/requirements-frozen.txt rename to utils/agent/requirements-frozen.txt diff --git a/docker-agent/requirements.txt b/utils/agent/requirements.txt similarity index 100% rename from docker-agent/requirements.txt rename to utils/agent/requirements.txt diff --git a/docker-mgmt/Dockerfile b/utils/mgmt/Dockerfile similarity index 83% rename from docker-mgmt/Dockerfile rename to utils/mgmt/Dockerfile index 5421f01..972ccfe 100644 --- a/docker-mgmt/Dockerfile +++ b/utils/mgmt/Dockerfile @@ -38,17 +38,17 @@ RUN ln -s /usr/bin/python3 /usr/local/bin/python \ RUN mkdir -p /ums-agenten/plattform/ && mkdir -p /ums-agenten/persist/ -COPY ./docker-mgmt/$PIP_REQ_FILE /ums-agenten/requirements.txt +COPY ./utils/mgmt/$PIP_REQ_FILE /ums-agenten/requirements.txt RUN pip3 install --break-system-packages --no-cache-dir -r /ums-agenten/requirements.txt \ && pip3 freeze > /ums-agenten/requirements.txt # nginx settings and startup -COPY ./docker-mgmt/supervisor.conf /etc/supervisor/supervisord.conf -COPY ./docker-mgmt/nginx.conf /etc/nginx/nginx.conf -COPY ./docker-mgmt/app.conf /etc/nginx/sites-enabled/default +COPY ./utils/mgmt/supervisor.conf /etc/supervisor/supervisord.conf +COPY ./utils/mgmt/nginx.conf /etc/nginx/nginx.conf +COPY ./utils/mgmt/app.conf /etc/nginx/sites-enabled/default # install the code of the repo -COPY ./docker-mgmt/setup.py /ums-agenten/plattform/ +COPY ./utils/setup.py /ums-agenten/plattform/ RUN pip3 install --break-system-packages -e /ums-agenten/plattform/ WORKDIR /ums-agenten/plattform/ums/ diff --git a/docker-mgmt/app.conf b/utils/mgmt/app.conf similarity index 100% rename from docker-mgmt/app.conf rename to utils/mgmt/app.conf diff --git a/docker-mgmt/nginx.conf b/utils/mgmt/nginx.conf similarity index 100% rename from docker-mgmt/nginx.conf rename to utils/mgmt/nginx.conf diff --git a/docker-mgmt/requirements-frozen.txt b/utils/mgmt/requirements-frozen.txt similarity index 100% rename from docker-mgmt/requirements-frozen.txt rename to utils/mgmt/requirements-frozen.txt diff --git a/docker-mgmt/requirements.txt b/utils/mgmt/requirements.txt similarity index 100% rename from docker-mgmt/requirements.txt rename to utils/mgmt/requirements.txt diff --git a/docker-mgmt/supervisor.conf b/utils/mgmt/supervisor.conf similarity index 100% rename from docker-mgmt/supervisor.conf rename to utils/mgmt/supervisor.conf diff --git a/docker-mgmt/setup.py b/utils/setup.py similarity index 100% rename from docker-mgmt/setup.py rename to utils/setup.py