From d2df947dcade44284912eb4938416332215572e3 Mon Sep 17 00:00:00 2001 From: mate-dev <67105053+mate-dev@users.noreply.github.com> Date: Mon, 28 Aug 2023 19:59:13 +0000 Subject: [PATCH] Almost works --- .gitmodules | 2 +- Dockerfile_app => app/Dockerfile | 6 +++--- config.yaml => app/config.yaml | 2 +- meshtastic-matrix-relay => app/meshtastic-matrix-relay | 0 docker-compose.yaml | 9 +++++++-- Dockerfile_node => node/Dockerfile | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) rename Dockerfile_app => app/Dockerfile (78%) rename config.yaml => app/config.yaml (95%) rename meshtastic-matrix-relay => app/meshtastic-matrix-relay (100%) rename Dockerfile_node => node/Dockerfile (90%) diff --git a/.gitmodules b/.gitmodules index ade15bb..36cbe09 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "meshtastic-matrix-relay"] - path = meshtastic-matrix-relay + path = node/meshtastic-matrix-relay url = https://github.com/geoffwhittington/meshtastic-matrix-relay diff --git a/Dockerfile_app b/app/Dockerfile similarity index 78% rename from Dockerfile_app rename to app/Dockerfile index 947df62..ebbe80d 100644 --- a/Dockerfile_app +++ b/app/Dockerfile @@ -1,11 +1,11 @@ -FROM python:3.11-slim-bookworm +FROM python:3.11-slim-bookworm AS app LABEL "website"="https://github.com/mate-dev/mmrelaynode" RUN groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 -s /bin/bash mesh RUN pip install --upgrade pip -qq USER mesh WORKDIR /home/mesh/app COPY meshtastic-matrix-relay /home/mesh/app -COPY config.yaml . -RUN pip install -qq -r /home/mesh/app/requirements.txt +RUN pip install -qq -r /home/mesh/app/requirements.txt --no-cache-dir RUN echo "export PATH=/home/mesh/.local/bin:\$PATH" >> /home/mesh/.bashrc +COPY config.yaml . #ENTRYPOINT ["sh", "-c", "sleep 30 && python main.py"] diff --git a/config.yaml b/app/config.yaml similarity index 95% rename from config.yaml rename to app/config.yaml index 3f1d0dc..562ee45 100644 --- a/config.yaml +++ b/app/config.yaml @@ -12,7 +12,7 @@ matrix_rooms: # Needs at least 1 room & channel, but supports all Meshtastic cha meshtastic: connection_type: network # Do not change! # serial_port: /dev/ttyUSB0 # Only used when connection is "serial" - host: "localhost" # Do not change! + host: "mmrelaynode" # Do not change! meshnet_name: "Your Meshnet Name" # This is displayed in full on Matrix, but is truncated when sent to a Meshnet broadcast_enabled: true hwid: "12345" # Change to your Hardware ID diff --git a/meshtastic-matrix-relay b/app/meshtastic-matrix-relay similarity index 100% rename from meshtastic-matrix-relay rename to app/meshtastic-matrix-relay diff --git a/docker-compose.yaml b/docker-compose.yaml index 9b4533a..fdb61c1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,25 +1,30 @@ version: "3.7" services: mmrelaynode: + build: node image: mmrelaynode:latest container_name: mmrelay-node restart: unless-stopped user: "1000:1000" volumes: - - mesh:/home/mesh + - mesh:/home/mesh/node ports: - "4403:4403" networks: - mesh entrypoint: ["sh", "-c", "/usr/bin/meshtasticd -d /home/mesh/node -h 1234"] # entrypoint: ["sh", "-c", "/usr/bin/meshtasticd -d /home/mesh/node -h $(grep -Po 'hwid: "\K[^"]+' /home/mesh/app/config.yaml)"] + depends_on: + - mmrelayapp + mmrelayapp: + build: app image: mmrelayapp:latest container_name: mmrelay-app restart: unless-stopped user: "1000:1000" volumes: - - mesh:/home/mesh + - mesh:/home/mesh/app networks: - mesh entrypoint: ["sh", "-c", "sleep 30 && python main.py"] diff --git a/Dockerfile_node b/node/Dockerfile similarity index 90% rename from Dockerfile_node rename to node/Dockerfile index dce6c70..2842e06 100644 --- a/Dockerfile_node +++ b/node/Dockerfile @@ -1,4 +1,4 @@ -FROM frolvlad/alpine-glibc:glibc-2.34 +FROM frolvlad/alpine-glibc:glibc-2.34 AS node LABEL "website"="https://github.com/mate-dev/mmrelaynode" RUN apk --update add --no-cache g++ shadow && \ groupadd -g 1000 mesh && useradd -ml -u 1000 -g 1000 mesh