From a02815be662aad6d405d33ad2f2ce11b905f39b7 Mon Sep 17 00:00:00 2001 From: mate-dev <67105053+mate-dev@users.noreply.github.com> Date: Tue, 29 Aug 2023 22:54:33 +0000 Subject: [PATCH] To correct --- README.md | 5 +++-- app/Dockerfile | 4 ++-- docker-compose.yaml | 12 ++++++------ node/Dockerfile | 21 ++++++++------------- node/run | 6 ++++++ node/run.sh | 3 --- 6 files changed, 25 insertions(+), 26 deletions(-) create mode 100644 node/run delete mode 100644 node/run.sh diff --git a/README.md b/README.md index bdb4f59..3c339bb 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,6 @@ Relay operation is implemented using the **Meshtastic <=> Matrix Relay** [https: Feel free to explore the **Meshtastic** project on their website: [https://meshtastic.org](https://meshtastic.org). - -## The project is in the creation phase for now. It is not yet usable! +git clone https://github.com/mate-dev/mmrelaynode.git +cd mmrelaynode && git submodule update --init +docker compose -f "docker-compose.yaml" up -d --build diff --git a/app/Dockerfile b/app/Dockerfile index aaee002..034fd2b 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -3,11 +3,11 @@ 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 +COPY --chown=mesh:mesh meshtastic-matrix-relay /home/mesh/app WORKDIR /home/mesh/app -COPY meshtastic-matrix-relay /home/mesh/app 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 . +COPY --chown=mesh:mesh config.yaml . #ENTRYPOINT ["sh", "-c", "sleep 30 && python main.py"] diff --git a/docker-compose.yaml b/docker-compose.yaml index d2be07a..d1c4962 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,35 +1,35 @@ -version: "3.8" +version: "3" services: mmrelaynode: build: node image: mmrelaynode:latest container_name: mmrelay-node restart: unless-stopped - user: "1000:1000" + volumes: - mesh:/home/mesh ports: - "4403:4403" networks: - mesh - entrypoint: ["sh", "-c", "run.sh"] + entrypoint: ["sh", "-c", "run"] mmrelayapp: build: app image: mmrelayapp:latest container_name: mmrelay-app restart: unless-stopped - user: "1000:1000" + depends_on: + - mmrelaynode volumes: - mesh:/home/mesh networks: - mesh - command: ["sh", "-c", "sleep 30"] + command: ["sleep 30"] entrypoint: ["python3", "main.py"] volumes: mesh: - external: true networks: mesh: diff --git a/node/Dockerfile b/node/Dockerfile index 6d6e37e..7cf4a55 100644 --- a/node/Dockerfile +++ b/node/Dockerfile @@ -1,14 +1,9 @@ -FROM alpine:3.18 AS node +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 -ADD https://github.com/mate-dev/mmrelaynode/releases/latest/download/meshtasticd_linux_amd64 /usr/bin/meshtasticd -RUN chmod +x /usr/bin/meshtasticd -RUN mkdir /home/mesh/node -COPY run.sh /home/mesh/node/ -RUN chown mesh:mesh -R /home/mesh/node && chmod +x /home/mesh/node/run.sh -WORKDIR /home/mesh/node/ -#ENTRYPOINT ["sh", "-c", "/usr/bin/meshtasticd -d /home/mesh/node -h 12345"] - - - +RUN apk --update add --no-cache g++ shadow +WORKDIR /bin +ADD https://github.com/mate-dev/mmrelaynode/releases/latest/download/meshtasticd_linux_amd64 /bin/meshtasticd +COPY run . +RUN chmod +x meshtasticd run +EXPOSE 4403 +ENTRYPOINT [ "sh", "-c", "run" ] \ No newline at end of file diff --git a/node/run b/node/run new file mode 100644 index 0000000..cc79764 --- /dev/null +++ b/node/run @@ -0,0 +1,6 @@ +#!/bin/sh +HWID=$(grep 'hwid: "' /home/mesh/app/config.yaml) +if [ -z "$HWID" ]; then + HWID=$(shuf -i 1000-9999 -n 1) +fi +/bin/meshtasticd -d /home/mesh -h $HWID \ No newline at end of file diff --git a/node/run.sh b/node/run.sh deleted file mode 100644 index 04333e3..0000000 --- a/node/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -HWID=$(grep 'hwid: "' /home/mesh/app/config.yaml) -/usr/bin/meshtasticd -d /home/mesh/node -h $HWID \ No newline at end of file