diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..c8779fd --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +FROM ghcr.io/home-assistant/devcontainer:addons + +RUN apt-get update && apt-get install -y python3 python3-venv python3-pip + +# https://code.visualstudio.com/remote/advancedcontainers/start-processes#_adding-startup-commands-to-the-docker-image-instead +COPY docker-entrypoint.sh / +RUN chmod +x /docker-entrypoint.sh + +ENTRYPOINT [ "/docker-entrypoint.sh" ] +CMD [ "sleep", "infinity" ] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0fa4163 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,49 @@ +{ + "name": "Mindctrl Devcontainer based on HASS addon", + "build": { + "dockerfile": "Dockerfile" + }, + "appPort": [ + "7123:8123", + "7357:4357", + "80:80" + ], + "postAttachCommand": ". .venv/bin/activate", + "runArgs": [ + "-e", + "GIT_EDITOR=code --wait", + "--privileged" + ], + "containerEnv": { + "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}" + }, + "customizations": { + "vscode": { + "extensions": [ + "timonwong.shellcheck", + "esbenp.prettier-vscode", + "ms-python.python" + ], + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "/usr/bin/bash" + }, + "zsh": { + "path": "/usr/bin/zsh" + } + }, + "terminal.integrated.defaultProfile.linux": "bash", + "python.terminal.activateEnvInCurrentTerminal": true, + "python.defaultInterpreterPath": ".venv/bin/python", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true + } + } + }, + "mounts": [ + "type=volume,target=/var/lib/docker" + ] +} diff --git a/.devcontainer/docker-entrypoint.sh b/.devcontainer/docker-entrypoint.sh new file mode 100644 index 0000000..b655108 --- /dev/null +++ b/.devcontainer/docker-entrypoint.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +echo "Running mindctrl devcontainer entrypoint..." + +echo "running original bootstrap" +bash devcontainer_bootstrap + +if [ -d "./.venv" ]; then + echo ".venv does exist." +else + echo "Create venv" + python3 -m venv ./.venv +fi + +echo "Activating venv" +source ./.venv/bin/activate +python -m pip install --upgrade pip + +echo "install source" +python -m pip install -e ./python + +echo "install requirements" +python -m pip install -r ./tests/test-requirements.txt + + +exec "$@" diff --git a/.github/workflows/addon-lint.yaml b/.github/workflows/addon-lint.yaml index 5c243af..757559d 100644 --- a/.github/workflows/addon-lint.yaml +++ b/.github/workflows/addon-lint.yaml @@ -11,26 +11,9 @@ on: - cron: "0 0 * * *" jobs: - find: - name: Find add-ons - runs-on: ubuntu-latest - outputs: - addons: ${{ steps.addons.outputs.addons_list }} - steps: - - name: ⤵️ Check out code from GitHub - uses: actions/checkout@v4 - - - name: 🔍 Find add-on directories - id: addons - uses: home-assistant/actions/helpers/find-addons@master - lint: - name: Lint add-on ${{ matrix.path }} + name: Lint add-on mindctrl runs-on: ubuntu-latest - needs: find - strategy: - matrix: - path: ${{ fromJson(needs.find.outputs.addons) }} steps: - name: ⤵️ Check out code from GitHub uses: actions/checkout@v4 @@ -38,4 +21,4 @@ jobs: - name: 🚀 Run Home Assistant Add-on Lint uses: frenck/action-addon-linter@v2.15 with: - path: "./${{ matrix.path }}" + path: "./addons/mindctrl" diff --git a/.gitignore b/.gitignore index 8f6f67d..025d5d7 100644 --- a/.gitignore +++ b/.gitignore @@ -168,3 +168,4 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ *.code-workspace +addons/mindctrl-dev/ diff --git a/.vscode/launch.json b/.vscode/launch.json index 35caeb9..a9c2108 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -17,11 +17,7 @@ "--port", "5002" ], - "jinja": true, - "cwd": "${workspaceFolder}/mindctrl-addon/rootfs/usr/bin", - "env": { - "PYTHONPATH": "${workspaceFolder}/mindctrl-addon/rootfs/usr/bin" - } + "jinja": true } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 31f608f..d442564 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,10 +1,24 @@ { "version": "2.0.0", "tasks": [ + { + "label": "Start Home Assistant", + "type": "shell", + "command": "supervisor_run", + "group": { + "kind": "test", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + }, { "label": "docker-build", "type": "shell", - "command": "docker build -t mindctrl:latest mindctrl-addon", + "command": "docker build -t mindctrl-addon:latest addons/mindctrl", "group": { "kind": "build", "isDefault": true diff --git a/mindctrl-addon/Dockerfile b/addons/mindctrl/Dockerfile similarity index 100% rename from mindctrl-addon/Dockerfile rename to addons/mindctrl/Dockerfile diff --git a/mindctrl-addon/build.yaml b/addons/mindctrl/build.yaml similarity index 92% rename from mindctrl-addon/build.yaml rename to addons/mindctrl/build.yaml index f1a810a..3a97f9b 100644 --- a/mindctrl-addon/build.yaml +++ b/addons/mindctrl/build.yaml @@ -5,5 +5,5 @@ build_from: labels: org.opencontainers.image.title: "LLMOps for Home Assistant" org.opencontainers.image.description: "MLflow Store+Gateway+Model Server" - org.opencontainers.image.source: "https://github.com/akshaya-a/mindctrl/tree/main/mindctrl-addon" + org.opencontainers.image.source: "https://github.com/akshaya-a/mindctrl/tree/main/addons/mindctrl" org.opencontainers.image.licenses: "Apache License 2.0" diff --git a/mindctrl-addon/config.yaml b/addons/mindctrl/config.yaml similarity index 93% rename from mindctrl-addon/config.yaml rename to addons/mindctrl/config.yaml index 941d460..5199b47 100644 --- a/mindctrl-addon/config.yaml +++ b/addons/mindctrl/config.yaml @@ -1,7 +1,7 @@ name: "Mindctrl" description: "LLMOps for Homeassistant" -version: "0.0.55" -url: "https://github.com/akshaya-a/mindctrl/tree/main/mindctrl-addon" +version: "0.0.56" +url: "https://github.com/akshaya-a/mindctrl/tree/main/addons/mindctrl" slug: "mindctrl" init: false arch: diff --git a/mindctrl-addon/requirements.txt b/addons/mindctrl/requirements.txt similarity index 100% rename from mindctrl-addon/requirements.txt rename to addons/mindctrl/requirements.txt diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/gateway b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/gateway similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/gateway rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/gateway diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/tracking b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/tracking similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/tracking rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/dependencies.d/tracking diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/finish b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/finish similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/finish rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/finish diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/run b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/run similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/run rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/run diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/type b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/type similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/type rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/dapr-dashboard/type diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/dependencies.d/multiserver b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/dependencies.d/multiserver similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/dependencies.d/multiserver rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/dependencies.d/multiserver diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/run b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/run similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/run rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/run diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/type b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/type similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/type rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/type diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/up b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/up similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/discovery/up rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/discovery/up diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/data/check b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/data/check similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/data/check rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/data/check diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/dependencies.d/init-server-env b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/dependencies.d/init-server-env similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/dependencies.d/init-server-env rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/dependencies.d/init-server-env diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/finish b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/finish similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/finish rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/finish diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/notification-fd b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/notification-fd similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/notification-fd rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/notification-fd diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/run b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/run similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/run rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/run diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/type b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/type similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/gateway/type rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/gateway/type diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/dependencies.d/base b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/dependencies.d/base similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/dependencies.d/base rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/dependencies.d/base diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/run b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/run similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/run rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/run diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/type b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/type similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/type rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/type diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/up b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/up similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/up rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/init-server-env/up diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/init-server-env b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/init-server-env similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/init-server-env rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/init-server-env diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/tracking b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/tracking similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/tracking rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/dependencies.d/tracking diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/finish b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/finish similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/finish rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/finish diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/notification-fd b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/notification-fd similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/notification-fd rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/notification-fd diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/run b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/run similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/run rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/run diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/type b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/type similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/multiserver/type rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/multiserver/type diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/data/check b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/data/check similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/data/check rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/data/check diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/dependencies.d/gateway b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/dependencies.d/gateway similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/dependencies.d/gateway rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/dependencies.d/gateway diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/finish b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/finish similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/finish rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/finish diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/notification-fd b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/notification-fd similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/notification-fd rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/notification-fd diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/run b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/run similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/run rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/run diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/type b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/type similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/tracking/type rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/tracking/type diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/multiserver b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/multiserver similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/multiserver rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/multiserver diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/tracking b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/tracking similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/tracking rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/dependencies.d/tracking diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/finish b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/finish similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/finish rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/finish diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/run b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/run similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/run rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/run diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/type b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/type similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/traefik/type rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/traefik/type diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/dapr-dashboard b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/dapr-dashboard similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/dapr-dashboard rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/dapr-dashboard diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/discovery b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/discovery similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/discovery rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/discovery diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/gateway b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/gateway similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/gateway rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/gateway diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-server-env b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-server-env similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-server-env rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-server-env diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/multiserver b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/multiserver similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/multiserver rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/multiserver diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/tracking b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/tracking similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/tracking rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/tracking diff --git a/mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/traefik b/addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/traefik similarity index 100% rename from mindctrl-addon/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/traefik rename to addons/mindctrl/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/traefik diff --git a/mindctrl-addon/rootfs/usr/bin/run_dashboard.sh b/addons/mindctrl/rootfs/usr/bin/run_dashboard.sh similarity index 76% rename from mindctrl-addon/rootfs/usr/bin/run_dashboard.sh rename to addons/mindctrl/rootfs/usr/bin/run_dashboard.sh index cad3c68..88887b8 100644 --- a/mindctrl-addon/rootfs/usr/bin/run_dashboard.sh +++ b/addons/mindctrl/rootfs/usr/bin/run_dashboard.sh @@ -3,12 +3,12 @@ bashio::log.info "Starting dashboard script in $PWD" ingress_entry=$(bashio::addon.ingress_entry) bashio::log.info "ingress_entry: ${ingress_entry}" -bashio::log.info "ingress prefix: ${ingress_entry}/dapr-dashboard" # Am I nervous about these dependencies on dapr with a bunch of undocumented stuff? Yes. # Am I going to do it anyway? Yes. # https://github.com/dapr/dashboard/blob/a92b8cd20d97080f07518ced9a5e8d0a58168ad9/cmd/webserver.go#L148C47-L148C63 if [[ -n "$ingress_entry" ]]; then - export SERVER_BASE_HREF="${ingress_entry}/dapr-dashboard" + export SERVER_BASE_HREF="${ingress_entry}/dapr-dashboard/dapr-dashboard/" + bashio::log.info "running dashboard with prefix $SERVER_BASE_HREF" fi diff --git a/mindctrl-addon/rootfs/usr/bin/run_gateway.sh b/addons/mindctrl/rootfs/usr/bin/run_gateway.sh similarity index 100% rename from mindctrl-addon/rootfs/usr/bin/run_gateway.sh rename to addons/mindctrl/rootfs/usr/bin/run_gateway.sh diff --git a/mindctrl-addon/rootfs/usr/bin/run_multiserver.sh b/addons/mindctrl/rootfs/usr/bin/run_multiserver.sh similarity index 100% rename from mindctrl-addon/rootfs/usr/bin/run_multiserver.sh rename to addons/mindctrl/rootfs/usr/bin/run_multiserver.sh diff --git a/mindctrl-addon/rootfs/usr/bin/run_tracking.sh b/addons/mindctrl/rootfs/usr/bin/run_tracking.sh similarity index 100% rename from mindctrl-addon/rootfs/usr/bin/run_tracking.sh rename to addons/mindctrl/rootfs/usr/bin/run_tracking.sh diff --git a/mindctrl-addon/rootfs/usr/bin/run_traefik.sh b/addons/mindctrl/rootfs/usr/bin/run_traefik.sh similarity index 100% rename from mindctrl-addon/rootfs/usr/bin/run_traefik.sh rename to addons/mindctrl/rootfs/usr/bin/run_traefik.sh diff --git a/python/src/mindctrl/db/setup.py b/python/src/mindctrl/db/setup.py index 9fa5a09..2baa6fc 100644 --- a/python/src/mindctrl/db/setup.py +++ b/python/src/mindctrl/db/setup.py @@ -48,6 +48,9 @@ async def setup_db(settings: PostgresStoreSettings) -> AsyncEngine: await conn.execute(text(ENABLE_PGVECTOR)) await conn.execute(text(CREATE_SUMMARY_TABLE)) await conn.execute(text(CONVERT_TO_HYPERTABLE)) + # TODO: add an index on metadata columns (entity type? etc) + # https://docs.timescale.com/tutorials/latest/financial-ingest-real-time/financial-ingest-dataset/#creating-a-hypertable + # Not available for apache licensed version # await conn.execute(text(ADD_RETENTION_POLICY)) await conn.commit() diff --git a/python/src/mindctrl/main.py b/python/src/mindctrl/main.py index 0d18286..8f4baab 100644 --- a/python/src/mindctrl/main.py +++ b/python/src/mindctrl/main.py @@ -122,10 +122,11 @@ def read_root(request: Request, response_class=HTMLResponse): ws_base = str(request.base_url).replace("http", "ws").rstrip("/") ws_url = ( - f"ws://{ws_base}{ingress_header}{ROUTE_PREFIX}/ui/ws" # lol - do this better + f"{ws_base}{ingress_header}{ROUTE_PREFIX}/ui/ws" # lol - do this better if ingress_header else f"{request.url_for('websocket_endpoint')}" ) + _logger.info(f"websocket url: {ws_url}") ingress_header = ingress_header or "" chat_url = ( f"{ingress_header}{ROUTE_PREFIX}/deployed-models/chat/labels/latest/invocations" diff --git a/scripts/copy_content_to_addon_context.sh b/scripts/copy_content_to_addon_context.sh index 8f0ce06..4bc8c5c 100644 --- a/scripts/copy_content_to_addon_context.sh +++ b/scripts/copy_content_to_addon_context.sh @@ -1,14 +1,14 @@ #!/bin/bash # Assert that the script is starting from the repository root -if [ ! -d "python" ] || [ ! -d "mindctrl-addon" ]; then +if [ ! -d "python" ] || [ ! -d "addons/mindctrl" ]; then echo "This script must be run from the root of the repository." exit 1 fi # Define source and target directories src_dir="python" -target_dir="mindctrl-addon/rootfs/.context/pysrc" +target_dir="addons/mindctrl/rootfs/.context/pysrc" # Check if source directory exists if [ ! -d "$src_dir" ]; then @@ -32,7 +32,7 @@ echo "Python source files have been copied to $target_dir" # Define source and target directories src_dir="services" -target_dir="mindctrl-addon/rootfs/.context/services" +target_dir="addons/mindctrl/rootfs/.context/services" # Check if source directory exists if [ ! -d "$src_dir" ]; then @@ -54,5 +54,5 @@ cp -r "$src_dir"/* "$target_dir" echo "Services have been copied to $target_dir" -echo "Copying install_traefik.sh to mindctrl-addon/rootfs/.context/install_traefik.sh" -cp scripts/install_traefik.sh mindctrl-addon/rootfs/.context/install_traefik.sh +echo "Copying install_traefik.sh to addons/mindctrl/rootfs/.context/install_traefik.sh" +cp scripts/install_traefik.sh addons/mindctrl/rootfs/.context/install_traefik.sh diff --git a/tests/conftest.py b/tests/conftest.py index 447315d..095d358 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -429,7 +429,7 @@ def addon_app_settings( mqtt_host, mqtt_port = get_external_host_port(mosquitto) pg_host, pg_port = get_external_host_port(postgres) - addon_folder = repo_root_dir / "mindctrl-addon" + addon_folder = repo_root_dir / "addons/mindctrl" # TODO: make all the bash scripts just call these things factored out into utils without pytest # copy_content_to_addon_context.sh shutil.copytree( diff --git a/tests/test_addon.py b/tests/test_addon.py index dcfca00..20cf640 100644 --- a/tests/test_addon.py +++ b/tests/test_addon.py @@ -11,7 +11,7 @@ @pytest.fixture def config_as_obj(repo_root_dir: Path): - config_file = repo_root_dir / "mindctrl-addon" / "config.yaml" + config_file = repo_root_dir / "addons/mindctrl" / "config.yaml" config = yaml.safe_load(config_file.read_text()) return config