diff --git a/__pycache__/requests.cpython-310.pyc b/__pycache__/requests.cpython-310.pyc new file mode 100644 index 0000000..4d77d6f Binary files /dev/null and b/__pycache__/requests.cpython-310.pyc differ diff --git a/config/olivetin.yaml b/config/olivetin.yaml deleted file mode 100644 index ccb3189..0000000 --- a/config/olivetin.yaml +++ /dev/null @@ -1,11 +0,0 @@ -actions: - - title: "Start Navigation Stack" - shell: docker compose -f /repo/docker-compose.yaml up -d navigation - - title: "Stop Navigation Stack" - shell: docker compose -f /repo/docker-compose.yaml down navigation - - title: "Start Mapping" - shell: docker compose -f /repo/docker-compose.yaml up -d mapping - - title: "Stop Mapping" - shell: docker compose -f /repo/docker-compose.yaml down mapping - - title: "Restart Teleop" - shell: docker compose -f /repo/docker-compose.yaml restart teleop diff --git a/config/olivetin/config.yaml b/config/olivetin/config.yaml new file mode 100644 index 0000000..f41e2d7 --- /dev/null +++ b/config/olivetin/config.yaml @@ -0,0 +1,36 @@ +showNavigation: false +logLevel: "INFO" +showNewVersions: false +showFooter: false + +actions: + - title: "Start Navigation Stack" + shell: podman-compose -f /repo/docker-compose.yaml up -d navigation + icon: '' + - title: "Stop Navigation Stack" + shell: docker compose -f /repo/docker-compose.yaml down navigation + icon: '' + - title: "Start Mapping" + shell: docker compose -f /repo/docker-compose.yaml up -d mapping + icon: '' + - title: "Stop Mapping" + shell: docker compose -f /repo/docker-compose.yaml down mapping + icon: '' + - title: "Restart Teleop" + icon: '' + shell: docker restart cps_loki-teleop-1 + - title: Restart or Shutdown System + icon: restart + shell: systemctl {{ choice }} + arguments: + - name: choice + title: Pick one + choices: + - value: reboot + - value: shutdown + - value: grafana + # This will SSH into a server an run the command 'service httpd restart' + - title: Restart httpd on Server 1 + shell: ssh bjorn@loki.local 'echo "it works"' + icon: ping + timeout: 5 \ No newline at end of file diff --git a/config/olivetin/icons/gamepad.png b/config/olivetin/icons/gamepad.png new file mode 100644 index 0000000..6257a12 Binary files /dev/null and b/config/olivetin/icons/gamepad.png differ diff --git a/config/olivetin/icons/mapping_start.gif b/config/olivetin/icons/mapping_start.gif new file mode 100644 index 0000000..d16c5e7 Binary files /dev/null and b/config/olivetin/icons/mapping_start.gif differ diff --git a/config/olivetin/icons/mapping_stop.gif b/config/olivetin/icons/mapping_stop.gif new file mode 100644 index 0000000..a86cc47 Binary files /dev/null and b/config/olivetin/icons/mapping_stop.gif differ diff --git a/config/olivetin/icons/nav2_start.png b/config/olivetin/icons/nav2_start.png new file mode 100644 index 0000000..50ed677 Binary files /dev/null and b/config/olivetin/icons/nav2_start.png differ diff --git a/config/olivetin/icons/nav2_stop.gif b/config/olivetin/icons/nav2_stop.gif new file mode 100644 index 0000000..cd7f0c4 Binary files /dev/null and b/config/olivetin/icons/nav2_stop.gif differ diff --git a/config/olivetin/icons/nav2_stop.png b/config/olivetin/icons/nav2_stop.png new file mode 100644 index 0000000..4fce2b9 Binary files /dev/null and b/config/olivetin/icons/nav2_stop.png differ diff --git a/config/olivetin/installation-id.txt b/config/olivetin/installation-id.txt new file mode 100644 index 0000000..70dda62 --- /dev/null +++ b/config/olivetin/installation-id.txt @@ -0,0 +1 @@ +ba1fa920-2863-4600-994f-23559acfcab2 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 5f077a3..caee339 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -157,13 +157,59 @@ services: # privileged: true # volumes: # - ./config/olivetin.yaml:/config/config.yaml # replace host path or volume as needed - # - .:/repo + # # - .:/repo # - /var/run/docker.sock:/var/run/docker.sock - # - /var/lib/docker:/var/lib/docker + # # - /var/lib/docker:/var/lib/docker # ports: - # - "88:1337" + # - "80:1337" # restart: unless-stopped + config: + container_name: olivetin + image: jamesread/olivetin + #image: ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin + build: + context: . + dockerfile: docker/Dockerfile + tags: + - ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin + target: olivetin + x-bake: + platforms: + #- linux/arm64 + - linux/amd64 + user: root + privileged: true + volumes: + - ./config/olivetin/:/config/ # here is config.yaml and icons located + - ./config/olivetin/icons:/var/www/olivetin/customIcons + - .:/repo + - /var/run/docker.sock:/var/run/docker.sock + + # - /var/lib/docker:/var/lib/docker + - ~/.ssh/id_rsa:/root/.ssh/id_rsa + ports: + - "80:1337" + restart: unless-stopped + + portainer: + container_name: portainer + #image: jamesread/olivetin + image: portainer/portainer-ce:latest + volumes: + - ./config/olivetin/:/config/ # here is config.yaml and icons located + - ./config/olivetin/icons:/var/www/olivetin/customIcons + - .:/repo + - /var/run/docker.sock:/var/run/docker.sock + - portainer_data:/data + + # - /var/lib/docker:/var/lib/docker + - ~/.ssh/id_rsa:/root/.ssh/id_rsa + ports: + - "8000:8000" + - "9443:9443" + restart: unless-stopped + ################################################################################################################################ # This section is mostly for supervision from PC # ################################################################################################################################ @@ -201,3 +247,5 @@ services: # Needed to display graphical applications privileged: true networks: {} +volumes: + portainer_data: diff --git a/docker/Dockerfile b/docker/Dockerfile index 2225a88..721cbc9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -93,45 +93,45 @@ LABEL org.opencontainers.image.source=https://github.com/bjoernellens1/cps_loki ############################################# # OliveTin Build # ############################################# -# FROM registry.fedoraproject.org/fedora:39 AS olivetin +FROM registry.fedoraproject.org/fedora:39 AS olivetin -# LABEL org.opencontainers.image.source https://ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin -# LABEL org.opencontainers.image.title=OliveTin +LABEL org.opencontainers.image.source https://ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin +LABEL org.opencontainers.image.title=OliveTin -# # Making sure there is newest docker version installed -# RUN dnf -y install dnf-plugins-core \ -# && dnf -y install 'dnf-command(config-manager)' \ -# && dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo \ -# && dnf -y install docker-ce-cli docker-compose-plugin --setopt=install_weak_deps=False +# Making sure there is newest docker version installed +RUN dnf -y install dnf-plugins-core \ + && dnf -y install 'dnf-command(config-manager)' \ + && dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo \ + && dnf -y install docker-ce-cli docker-compose-plugin --setopt=install_weak_deps=False -# # Install OliveTin and dependencies -# RUN mkdir -p /config /var/www/olivetin \ -# && dnf install -y --nodocs --noplugins --setopt=keepcache=0 --setopt=install_weak_deps=0 \ -# iputils \ -# openssh-clients \ -# shadow-utils \ -# OliveTin \ -# && dnf clean all +# Install OliveTin and dependencies +RUN mkdir -p /config /var/www/olivetin \ + && dnf install -y --nodocs --noplugins --setopt=keepcache=0 --setopt=install_weak_deps=0 \ + iputils \ + openssh-clients \ + shadow-utils \ + OliveTin \ + && dnf clean all -# RUN useradd --system --create-home olivetin -u 1000 +RUN useradd --system --create-home olivetin -u 1000 -# EXPOSE 1337/tcp +EXPOSE 1337/tcp -# VOLUME /config +VOLUME /config -# USER olivetin +USER olivetin -# ENTRYPOINT [ "/usr/bin/OliveTin" ] +ENTRYPOINT [ "/usr/bin/OliveTin" ] -# FROM alpine AS olivetin +FROM docker AS olivetin +RUN wget https://github.com/OliveTin/OliveTin/releases/latest/download/OliveTin_linux_amd64.apk +RUN apk add --allow-untrusted OliveTin_linux_amd64.apk +# RUN wget https://github.com/OliveTin/OliveTin/releases/download/2023.12.21/OliveTin_linux_amd64.deb +# RUN apt install ./OliveTin_linux_amd64.deb +# Expose the default OliveTin port +EXPOSE 1337 -# RUN wget https://github.com/OliveTin/OliveTin/releases/latest/download/OliveTin_linux_amd64.apk -# RUN apk add --allow-untrusted OliveTin_linux_amd64.apk docker-cli-compose - -# # Expose the default OliveTin port -# EXPOSE 1337 - -# # Set the default command to run OliveTin -# CMD ["OliveTin"] \ No newline at end of file +# Set the default command to run OliveTin +CMD ["OliveTin"] \ No newline at end of file diff --git a/webapi.py b/webapi.py new file mode 100644 index 0000000..726c016 --- /dev/null +++ b/webapi.py @@ -0,0 +1,32 @@ +import requests +import json + +url = "https://loki.local:9443/api/auth" + +# Set your admin username and password +username = "cpsadmin" +password = "pac99CPS" + +# Define the payload for the POST request +payload = { + "Username": username, + "Password": password +} + +headers = { + "Content-Type": "application/json" +} + +response = requests.post(url, data=json.dumps(payload), headers=headers, verify=False) + + +# Check the response status code +if response.status_code == 200: + print("Authentication successful!") + # You can access the response content using response.text or response.json() if the content is in JSON format + print("Response content:", response.text) +else: + print("Authentication failed. Status code:", response.status_code) + print("Response content:", response.text) + +token = response