From a06f50b911e8e7fb4e5b9d0749adbcd441f0f1bb Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Mon, 16 Dec 2024 22:00:09 +0000 Subject: [PATCH 1/8] Add Dockerfile to build and run meshchat --- Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0ccbaac --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Build the frontend +FROM node:20-bookworm-slim AS build-frontend + +WORKDIR /src + +COPY *.json . +COPY *.js . +COPY src/frontend ./src/frontend + +RUN npm install --omit=dev && \ + npm install tailwindcss && \ + npm run build-frontend + +# Main app build +FROM python:3.11-bookworm + +WORKDIR /app + +COPY ./requirements.txt . +COPY --from=build-frontend /src/public public + +RUN pip install -r requirements.txt + +COPY *.py . +COPY src/__init__.py ./src/__init__.py +COPY src/backend ./src/backend +COPY *.json . + +CMD ["python", "meshchat.py", "--host=0.0.0.0", "--reticulum-config-dir=/config/.reticulum", "--headless"] From a4601f43189bc45ef3c22ae07167d3bd12258429 Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Mon, 16 Dec 2024 22:00:44 +0000 Subject: [PATCH 2/8] Update build GHA to include image job --- .github/workflows/build.yml | 249 ++++++++++++++++++++---------------- 1 file changed, 142 insertions(+), 107 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9817a89..4d8e9d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,121 +2,156 @@ name: Build and Release on: push: - tags: - - '*' + # tags: + # - '*' jobs: - - build_windows: - runs-on: windows-latest - permissions: - contents: write - steps: - - name: Clone Repo - uses: actions/checkout@v1 - - - name: Install NodeJS - uses: actions/setup-node@v1 - with: - node-version: 18 - - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Python Deps - run: pip install -r requirements.txt - - - name: Install NodeJS Deps - run: npm install - - - name: Build Electron App - run: npm run dist - - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 - with: - draft: true - allowUpdates: true - replacesArtifacts: true - omitDraftDuringUpdate: true - omitNameDuringUpdate: true - artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe" - - build_mac: - runs-on: macos-13 - permissions: - contents: write - steps: - - name: Clone Repo - uses: actions/checkout@v1 - - - name: Install NodeJS - uses: actions/setup-node@v1 - with: - node-version: 18 - - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Python Deps - run: pip install -r requirements.txt - - - name: Install NodeJS Deps - run: npm install - - - name: Build Electron App - run: npm run dist - - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 - with: - draft: true - allowUpdates: true - replacesArtifacts: true - omitDraftDuringUpdate: true - omitNameDuringUpdate: true - artifacts: "dist/*-mac.dmg" - - build_linux: + # build_windows: + # runs-on: windows-latest + # permissions: + # contents: write + # steps: + # - name: Clone Repo + # uses: actions/checkout@v1 + + # - name: Install NodeJS + # uses: actions/setup-node@v1 + # with: + # node-version: 18 + + # - name: Install Python + # uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + + # - name: Install Python Deps + # run: pip install -r requirements.txt + + # - name: Install NodeJS Deps + # run: npm install + + # - name: Build Electron App + # run: npm run dist + + # - name: Create Release + # id: create_release + # uses: ncipollo/release-action@v1 + # with: + # draft: true + # allowUpdates: true + # replacesArtifacts: true + # omitDraftDuringUpdate: true + # omitNameDuringUpdate: true + # artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe" + + # build_mac: + # runs-on: macos-13 + # permissions: + # contents: write + # steps: + # - name: Clone Repo + # uses: actions/checkout@v1 + + # - name: Install NodeJS + # uses: actions/setup-node@v1 + # with: + # node-version: 18 + + # - name: Install Python + # uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + + # - name: Install Python Deps + # run: pip install -r requirements.txt + + # - name: Install NodeJS Deps + # run: npm install + + # - name: Build Electron App + # run: npm run dist + + # - name: Create Release + # id: create_release + # uses: ncipollo/release-action@v1 + # with: + # draft: true + # allowUpdates: true + # replacesArtifacts: true + # omitDraftDuringUpdate: true + # omitNameDuringUpdate: true + # artifacts: "dist/*-mac.dmg" + + # build_linux: + # runs-on: ubuntu-latest + # permissions: + # contents: write + # steps: + # - name: Clone Repo + # uses: actions/checkout@v1 + + # - name: Install NodeJS + # uses: actions/setup-node@v1 + # with: + # node-version: 18 + + # - name: Install Python + # uses: actions/setup-python@v5 + # with: + # python-version: '3.11' + + # - name: Install Python Deps + # run: pip install -r requirements.txt + + # - name: Install NodeJS Deps + # run: npm install + + # - name: Build Electron App + # run: npm run dist + + # - name: Create Release + # id: create_release + # uses: ncipollo/release-action@v1 + # with: + # draft: true + # allowUpdates: true + # replacesArtifacts: true + # omitDraftDuringUpdate: true + # omitNameDuringUpdate: true + # artifacts: "dist/*-linux.AppImage" + + build_docker: runs-on: ubuntu-latest permissions: - contents: write + packages: write + contents: read steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - - name: Install NodeJS - uses: actions/setup-node@v1 - with: - node-version: 18 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Install Python Deps - run: pip install -r requirements.txt - - - name: Install NodeJS Deps - run: npm install - - - name: Build Electron App - run: npm run dist + - name: Log in to the GitHub Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Create Release - id: create_release - uses: ncipollo/release-action@v1 + - name: Build and push Docker images + uses: docker/build-push-action@v5 with: - draft: true - allowUpdates: true - replacesArtifacts: true - omitDraftDuringUpdate: true - omitNameDuringUpdate: true - artifacts: "dist/*-linux.AppImage" + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/g7ufo/reticulum-meshchat:latest + ghcr.io/g7ufo/reticulum-meshchat:${{ github.ref_name }} + labels: | + org.opencontainers.image.title=Reticulum MeshChat + org.opencontainers.image.description=Docker image for Reticulum MeshChat + org.opencontainers.image.url=https://github.com/g7ufo/reticulum-meshchat/pkgs/container/reticulum-meshchat/ From bfd065a8f94aacedae339a2fdecefdd08f0c0e63 Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Tue, 17 Dec 2024 12:33:34 +0000 Subject: [PATCH 3/8] Add some documentation --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index df1acb6..2770ea7 100644 --- a/README.md +++ b/README.md @@ -278,6 +278,49 @@ npm run dist Once completed, you should have a `.exe` or a `.dmg` in the `dist` folder. +## Running via Docker + +A very simple example of a `docker-compose.yml` file, generating and storing conifg in a volume would look like this: + +```yaml +services: + reticulum-meshchat: + container_name: reticulum-meshchat + image: ghcr.io/g7ufo/reticulum-meshchat:latest + restart: unless-stopped + ports: + - 8000:8000 + volumes: + reticulum-config:/config + devices: + - /dev/ttyUSB0:/dev/ttyUSB0 + +volumes: + reticulum-config: +``` + +By default the container will run `python meshchat.py --host=0.0.0.0 --reticulum-config-dir=/config/.reticulum --headless`. This can be overridden (for example to use an existing conifg) like: + +```yaml +services: + reticulum-meshchat: + container_name: reticulum-meshchat + image: ghcr.io/g7ufo/reticulum-meshchat:latest + command: + - python + - meshchat.py + - --host=0.0.0.0 + - --reticulum-config-dir=/a_different_path/.reticulum + - --headless + restart: unless-stopped + ports: + - 8000:8000 + volumes: + .reticulum:/a_different_path/.reticulum + devices: + - /dev/ttyUSB0:/dev/ttyUSB0 +``` + ## Local Development I normally run the following commands to work on the project locally. From 7c0fe0618fc23f26f6d0a2b3ef2d8120385c3533 Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Tue, 17 Dec 2024 13:14:47 +0000 Subject: [PATCH 4/8] Update for PR submission --- .github/workflows/build.yml | 236 ++++++++++++++++++------------------ README.md | 36 ++++-- 2 files changed, 145 insertions(+), 127 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d8e9d0..18c3502 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,123 +2,123 @@ name: Build and Release on: push: - # tags: - # - '*' + tags: + - "*" jobs: - # build_windows: - # runs-on: windows-latest - # permissions: - # contents: write - # steps: - # - name: Clone Repo - # uses: actions/checkout@v1 - - # - name: Install NodeJS - # uses: actions/setup-node@v1 - # with: - # node-version: 18 - - # - name: Install Python - # uses: actions/setup-python@v5 - # with: - # python-version: '3.11' - - # - name: Install Python Deps - # run: pip install -r requirements.txt - - # - name: Install NodeJS Deps - # run: npm install - - # - name: Build Electron App - # run: npm run dist - - # - name: Create Release - # id: create_release - # uses: ncipollo/release-action@v1 - # with: - # draft: true - # allowUpdates: true - # replacesArtifacts: true - # omitDraftDuringUpdate: true - # omitNameDuringUpdate: true - # artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe" - - # build_mac: - # runs-on: macos-13 - # permissions: - # contents: write - # steps: - # - name: Clone Repo - # uses: actions/checkout@v1 - - # - name: Install NodeJS - # uses: actions/setup-node@v1 - # with: - # node-version: 18 - - # - name: Install Python - # uses: actions/setup-python@v5 - # with: - # python-version: '3.11' - - # - name: Install Python Deps - # run: pip install -r requirements.txt - - # - name: Install NodeJS Deps - # run: npm install - - # - name: Build Electron App - # run: npm run dist - - # - name: Create Release - # id: create_release - # uses: ncipollo/release-action@v1 - # with: - # draft: true - # allowUpdates: true - # replacesArtifacts: true - # omitDraftDuringUpdate: true - # omitNameDuringUpdate: true - # artifacts: "dist/*-mac.dmg" - - # build_linux: - # runs-on: ubuntu-latest - # permissions: - # contents: write - # steps: - # - name: Clone Repo - # uses: actions/checkout@v1 - - # - name: Install NodeJS - # uses: actions/setup-node@v1 - # with: - # node-version: 18 - - # - name: Install Python - # uses: actions/setup-python@v5 - # with: - # python-version: '3.11' - - # - name: Install Python Deps - # run: pip install -r requirements.txt - - # - name: Install NodeJS Deps - # run: npm install - - # - name: Build Electron App - # run: npm run dist - - # - name: Create Release - # id: create_release - # uses: ncipollo/release-action@v1 - # with: - # draft: true - # allowUpdates: true - # replacesArtifacts: true - # omitDraftDuringUpdate: true - # omitNameDuringUpdate: true - # artifacts: "dist/*-linux.AppImage" + build_windows: + runs-on: windows-latest + permissions: + contents: write + steps: + - name: Clone Repo + uses: actions/checkout@v1 + + - name: Install NodeJS + uses: actions/setup-node@v1 + with: + node-version: 18 + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Python Deps + run: pip install -r requirements.txt + + - name: Install NodeJS Deps + run: npm install + + - name: Build Electron App + run: npm run dist + + - name: Create Release + id: create_release + uses: ncipollo/release-action@v1 + with: + draft: true + allowUpdates: true + replacesArtifacts: true + omitDraftDuringUpdate: true + omitNameDuringUpdate: true + artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe" + + build_mac: + runs-on: macos-13 + permissions: + contents: write + steps: + - name: Clone Repo + uses: actions/checkout@v1 + + - name: Install NodeJS + uses: actions/setup-node@v1 + with: + node-version: 18 + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Python Deps + run: pip install -r requirements.txt + + - name: Install NodeJS Deps + run: npm install + + - name: Build Electron App + run: npm run dist + + - name: Create Release + id: create_release + uses: ncipollo/release-action@v1 + with: + draft: true + allowUpdates: true + replacesArtifacts: true + omitDraftDuringUpdate: true + omitNameDuringUpdate: true + artifacts: "dist/*-mac.dmg" + + build_linux: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Clone Repo + uses: actions/checkout@v1 + + - name: Install NodeJS + uses: actions/setup-node@v1 + with: + node-version: 18 + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Python Deps + run: pip install -r requirements.txt + + - name: Install NodeJS Deps + run: npm install + + - name: Build Electron App + run: npm run dist + + - name: Create Release + id: create_release + uses: ncipollo/release-action@v1 + with: + draft: true + allowUpdates: true + replacesArtifacts: true + omitDraftDuringUpdate: true + omitNameDuringUpdate: true + artifacts: "dist/*-linux.AppImage" build_docker: runs-on: ubuntu-latest @@ -149,9 +149,9 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ghcr.io/g7ufo/reticulum-meshchat:latest - ghcr.io/g7ufo/reticulum-meshchat:${{ github.ref_name }} + ghcr.io/liamcottle/reticulum-meshchat:latest + ghcr.io/liamcottle/reticulum-meshchat:${{ github.ref_name }} labels: | org.opencontainers.image.title=Reticulum MeshChat org.opencontainers.image.description=Docker image for Reticulum MeshChat - org.opencontainers.image.url=https://github.com/g7ufo/reticulum-meshchat/pkgs/container/reticulum-meshchat/ + org.opencontainers.image.url=https://github.com/liamcottle/reticulum-meshchat/pkgs/container/reticulum-meshchat/ diff --git a/README.md b/README.md index 2770ea7..792a917 100644 --- a/README.md +++ b/README.md @@ -280,43 +280,61 @@ Once completed, you should have a `.exe` or a `.dmg` in the `dist` folder. ## Running via Docker -A very simple example of a `docker-compose.yml` file, generating and storing conifg in a volume would look like this: +A very simple example of a `docker-compose.yml` file, generating and passing the .reticulum directory to the container: ```yaml services: reticulum-meshchat: container_name: reticulum-meshchat - image: ghcr.io/g7ufo/reticulum-meshchat:latest + image: ghcr.io/liamcottle/reticulum-meshchat:latest + pull_policy: always restart: unless-stopped ports: - 8000:8000 volumes: - reticulum-config:/config + .reticulum:/config/.reticulum devices: - /dev/ttyUSB0:/dev/ttyUSB0 +``` + +To make the web interface accessible from the host, you will need to include the IP (or `0.0.0.0` for all) in the `ports` command, for example: -volumes: - reticulum-config: +```yaml +services: + reticulum-meshchat: + container_name: reticulum-meshchat + image: ghcr.io/liamcottle/reticulum-meshchat:latest + pull_policy: always + restart: unless-stopped + ports: + - 0.0.0.0:8000:8000 + volumes: + .reticulum:/config/.reticulum + devices: + - /dev/ttyUSB0:/dev/ttyUSB0 ``` -By default the container will run `python meshchat.py --host=0.0.0.0 --reticulum-config-dir=/config/.reticulum --headless`. This can be overridden (for example to use an existing conifg) like: +By default the container will run `python meshchat.py --host=0.0.0.0 --reticulum-config-dir=/config/.reticulum --headless`. This can be overridden like: ```yaml services: reticulum-meshchat: container_name: reticulum-meshchat - image: ghcr.io/g7ufo/reticulum-meshchat:latest + image: ghcr.io/liamcottle/reticulum-meshchat:latest + pull_policy: always command: - python - meshchat.py - --host=0.0.0.0 - - --reticulum-config-dir=/a_different_path/.reticulum + - --reticulum-config-dir=/maybe-a-different-path/.reticulum - --headless + - --some-other-argument + - --and-another-argument restart: unless-stopped ports: - 8000:8000 volumes: - .reticulum:/a_different_path/.reticulum + .reticulum:/maybe-a-different-path/.reticulum devices: - /dev/ttyUSB0:/dev/ttyUSB0 ``` From 1f24b202c80cacb2c2f8d2dc36f9b6cdb4b1bc74 Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Tue, 17 Dec 2024 14:46:03 +0000 Subject: [PATCH 5/8] Specify storage-dir and update documentation --- Dockerfile | 2 +- README.md | 46 ++++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0ccbaac..eea3123 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,4 +26,4 @@ COPY src/__init__.py ./src/__init__.py COPY src/backend ./src/backend COPY *.json . -CMD ["python", "meshchat.py", "--host=0.0.0.0", "--reticulum-config-dir=/config/.reticulum", "--headless"] +CMD ["python", "meshchat.py", "--host=0.0.0.0", "--reticulum-config-dir=/config/.reticulum", "--storage-dir=/config/.reticulum/storage", "--headless"] diff --git a/README.md b/README.md index 792a917..84b5582 100644 --- a/README.md +++ b/README.md @@ -258,25 +258,6 @@ python meshchat.py --identity-base64 "GCN6mMhVemdNIK/fw97C1zvU17qjQPFTXRBotVckeG > NOTE: this is a randomly generated identity for example purposes. Do not use it, it has been leaked! -## Build Electron Application - -Reticulum MeshChat can be run from source via a command line, as explained above, or as a standalone application. - -To run as a standalone application, we need to compile the python script and dependencies to an executable with [cxfreeze](https://github.com/marcelotduarte/cx_Freeze) and then build an [Electron](https://www.electronjs.org/) app which includes a bundled browser that can interact with the compiled python executable. - -This allows for the entire application to be run by double clicking a single file without the need for a user to manually install python, nor run any commands in a command line application. - -To build a `.exe` when running on Windows or a `.dmg` when running on a Mac, run the following; - -``` -pip install -r requirements.txt -npm install -npm run dist -``` - -> Note: cxfreeze only supports building an executable for the current platform. You will need a Mac to build for Mac, and a Windows PC to build for Windows. - -Once completed, you should have a `.exe` or a `.dmg` in the `dist` folder. ## Running via Docker @@ -314,7 +295,7 @@ services: - /dev/ttyUSB0:/dev/ttyUSB0 ``` -By default the container will run `python meshchat.py --host=0.0.0.0 --reticulum-config-dir=/config/.reticulum --headless`. This can be overridden like: +By default the container will run `python meshchat.py --host=0.0.0.0 --reticulum-config-dir=/config/.reticulum --storage-dir=/config/.reticulum/storage --headless`. This can be overridden like: ```yaml services: @@ -326,7 +307,8 @@ services: - python - meshchat.py - --host=0.0.0.0 - - --reticulum-config-dir=/maybe-a-different-path/.reticulum + - --reticulum-config-dir=/config/.reticulum + - --storage-dir=/config/storage - --headless - --some-other-argument - --and-another-argument @@ -334,11 +316,31 @@ services: ports: - 8000:8000 volumes: - .reticulum:/maybe-a-different-path/.reticulum + .my-different-storage-dir:/config/storage devices: - /dev/ttyUSB0:/dev/ttyUSB0 ``` +## Build Electron Application + +Reticulum MeshChat can be run from source via a command line, as explained above, or as a standalone application. + +To run as a standalone application, we need to compile the python script and dependencies to an executable with [cxfreeze](https://github.com/marcelotduarte/cx_Freeze) and then build an [Electron](https://www.electronjs.org/) app which includes a bundled browser that can interact with the compiled python executable. + +This allows for the entire application to be run by double clicking a single file without the need for a user to manually install python, nor run any commands in a command line application. + +To build a `.exe` when running on Windows or a `.dmg` when running on a Mac, run the following; + +``` +pip install -r requirements.txt +npm install +npm run dist +``` + +> Note: cxfreeze only supports building an executable for the current platform. You will need a Mac to build for Mac, and a Windows PC to build for Windows. + +Once completed, you should have a `.exe` or a `.dmg` in the `dist` folder. + ## Local Development I normally run the following commands to work on the project locally. From f90566921838e63ee4e6f6aab7bb28ee1854253a Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Wed, 18 Dec 2024 10:50:42 +0000 Subject: [PATCH 6/8] Temporary workflow to trigger docker build --- .github/workflows/manual-docker-build.yml | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/manual-docker-build.yml diff --git a/.github/workflows/manual-docker-build.yml b/.github/workflows/manual-docker-build.yml new file mode 100644 index 0000000..5f43e49 --- /dev/null +++ b/.github/workflows/manual-docker-build.yml @@ -0,0 +1,42 @@ +name: Temporary manual trigger for Docker build + +on: + workflow_dispatch: + +jobs: + build_docker: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Clone Repo + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the GitHub Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker images + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/g7ufo/reticulum-meshchat:latest + ghcr.io/g7ufo/reticulum-meshchat:${{ github.ref_name }} + labels: | + org.opencontainers.image.title=Reticulum MeshChat + org.opencontainers.image.description=Docker image for Reticulum MeshChat + org.opencontainers.image.url=https://github.com/g7ufo/reticulum-meshchat/pkgs/container/reticulum-meshchat/ + From 1835a307db026c61b9b7dfe3b9aca0b1c2120029 Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Tue, 24 Dec 2024 13:45:08 +0000 Subject: [PATCH 7/8] Update location of storage dir --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index eea3123..d3b0aad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,4 +26,5 @@ COPY src/__init__.py ./src/__init__.py COPY src/backend ./src/backend COPY *.json . -CMD ["python", "meshchat.py", "--host=0.0.0.0", "--reticulum-config-dir=/config/.reticulum", "--storage-dir=/config/.reticulum/storage", "--headless"] +CMD ["python", "meshchat.py", "--host=0.0.0.0", "--reticulum-config-dir=/config/.reticulum", "--storage-dir=/config/.meshchat", "--headless"] + From 3b0bac2bfdd1839130d53e60bce462f2cf978723 Mon Sep 17 00:00:00 2001 From: Neil G7UFO Date: Tue, 24 Dec 2024 15:00:47 +0000 Subject: [PATCH 8/8] Update documentation and supply example compose file --- README.md | 60 ++------------------------------------ docker-compose-example.yml | 18 ++++++++++++ 2 files changed, 20 insertions(+), 58 deletions(-) create mode 100644 docker-compose-example.yml diff --git a/README.md b/README.md index 9656150..b012a23 100644 --- a/README.md +++ b/README.md @@ -259,65 +259,9 @@ python meshchat.py --identity-base64 "GCN6mMhVemdNIK/fw97C1zvU17qjQPFTXRBotVckeG ## Running via Docker -A very simple example of a `docker-compose.yml` file, generating and passing the .reticulum directory to the container: - -```yaml -services: - reticulum-meshchat: - container_name: reticulum-meshchat - image: ghcr.io/liamcottle/reticulum-meshchat:latest - pull_policy: always - restart: unless-stopped - ports: - - 8000:8000 - volumes: - .reticulum:/config/.reticulum - devices: - - /dev/ttyUSB0:/dev/ttyUSB0 -``` - -To make the web interface accessible from the host, you will need to include the IP (or `0.0.0.0` for all) in the `ports` command, for example: - -```yaml -services: - reticulum-meshchat: - container_name: reticulum-meshchat - image: ghcr.io/liamcottle/reticulum-meshchat:latest - pull_policy: always - restart: unless-stopped - ports: - - 0.0.0.0:8000:8000 - volumes: - .reticulum:/config/.reticulum - devices: - - /dev/ttyUSB0:/dev/ttyUSB0 -``` +A very simple example of a `docker-compose.yml` file can be found [here](./docker-compose-example.yml). -By default the container will run `python meshchat.py --host=0.0.0.0 --reticulum-config-dir=/config/.reticulum --storage-dir=/config/.reticulum/storage --headless`. This can be overridden like: - -```yaml -services: - reticulum-meshchat: - container_name: reticulum-meshchat - image: ghcr.io/liamcottle/reticulum-meshchat:latest - pull_policy: always - command: - - python - - meshchat.py - - --host=0.0.0.0 - - --reticulum-config-dir=/config/.reticulum - - --storage-dir=/config/storage - - --headless - - --some-other-argument - - --and-another-argument - restart: unless-stopped - ports: - - 8000:8000 - volumes: - .my-different-storage-dir:/config/storage - devices: - - /dev/ttyUSB0:/dev/ttyUSB0 -``` +The reticulum config is auto-generated at startup in the `meshchat-config` volume along with the storage db used by meshchat. ## Build Electron Application diff --git a/docker-compose-example.yml b/docker-compose-example.yml new file mode 100644 index 0000000..e8eae7f --- /dev/null +++ b/docker-compose-example.yml @@ -0,0 +1,18 @@ +services: + reticulum-meshchat: + container_name: reticulum-meshchat + image: ghcr.io/liamcottle/reticulum-meshchat:latest + pull_policy: always + restart: unless-stopped + # Make the web interace accessible from the host at 8000. + ports: + - 0.0.0.0:8000:8000 + volumes: + meshchat-config:/config + # Uncomment if you have a USB device connected + # devices: + # - /dev/ttyUSB0:/dev/ttyUSB0 + +volumes: + meshchat-config: +