From 348ac2477255d53f908348fd5f72aeecb9f0ede4 Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Thu, 24 Mar 2022 17:11:37 +0530 Subject: [PATCH 01/26] Light miner: Diagnostics page should display Helium PK * modified docker template to use the new hm-gatewayrs container --- .github/workflows/update-miner.yml | 20 ++++++++++---------- README.md | 8 ++++---- settings.ini | 2 +- templates/docker-compose.template | 18 +++++------------- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/.github/workflows/update-miner.yml b/.github/workflows/update-miner.yml index 6da22a95..9f8e029d 100644 --- a/.github/workflows/update-miner.yml +++ b/.github/workflows/update-miner.yml @@ -1,9 +1,9 @@ -name: Update Miner GA (Testnet) +name: Update Gatewayrs GA (Testnet) on: repository_dispatch: - types: [miner-update] + types: [gatewayrs-update] jobs: - miner-update: + gatewayrs-update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -16,19 +16,19 @@ jobs: echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "LONG_SHA=$LONG_SHA" >> $GITHUB_ENV - echo "We're not on the latest Helium GA release. Updating to $LATEST_GA with SHA $SHORT_SHA." + echo "We're not on the latest Helium gateway-rs release. Updating to $LATEST_GA with SHA $SHORT_SHA." sed -i -E "s/FIRMWARE_VERSION=.*/FIRMWARE_VERSION=$LATEST_GA/g" settings.ini - sed -i -E "s/MINER_VERSION=.*/MINER_VERSION=$SHORT_SHA/g" settings.ini + sed -i -E "s/GATEWAY_VERSION=.*/GATEWAY_VERSION=$SHORT_SHA/g" settings.ini - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - commit-message: Update miner to latest GA ${{ env.LATEST_GA }} - branch: miner-bump/${{ env.LATEST_GA }} + commit-message: Update Gatewayrs to latest GA ${{ env.LATEST_GA }} + branch: gatewayrs-bump/${{ env.LATEST_GA }} delete-branch: true base: master - title: "release(testnet): Update miner to latest GA ${{ env.LATEST_GA }}" + title: "release(testnet): Update Gatewayrs to latest GA ${{ env.LATEST_GA }}" body: | - Update miner to latest GA ${{ env.LATEST_GA }} + Update gatewayrs to latest GA ${{ env.LATEST_GA }} - Ref NebraLtd/hm-miner@${{ env.LONG_SHA }} + Ref NebraLtd/hm-gatewayrs@${{ env.LONG_SHA }} draft: false diff --git a/README.md b/README.md index b6b78341..06fec7cd 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,17 @@ As of 27th Jan 2022, we have also moved the UPnP functionality into this repo in Removing the UPnP container reduces CPU overhead and redundant code. -## Helium Miner +## Helium Gateway-rs -Repo: [github.com/NebraLtd/hm-miner](https://github.com/NebraLtd/hm-miner) +Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayrs) -This container is the actual Helium Miner software (from upstream), with the required configuration files added. +This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. ## DBus Session Repo: [github.com/balenablocks/dbus](https://github.com/balenablocks/dbus) -This container configures a DBus session bus instance that is used by the gateway config container to communicate with the miner code (note that there is also a separate system bus running on the host OS which is used by gateway config to communicate with bluez for configuring Bluetooth services). This removes the need to have a custom `com.helium.Miner.conf` dbus config file on the host OS as was done previously (and meant we had to run a custom balena device type). +This container doesn't serve any purpose any more and will be removed. # Quick Start diff --git a/settings.ini b/settings.ini index 2b2b42f1..5371333f 100644 --- a/settings.ini +++ b/settings.ini @@ -3,7 +3,7 @@ FIRMWARE_VERSION=2022.03.07.0-2 DIAGNOSTICS_VERSION=fb63618 CONFIG_VERSION=e5ac58c PKTFWD_VERSION=b95cc46 -MINER_VERSION=9564845 +GATEWAY_VERSION=409c974 [quectel_modem] MODEM_SERIAL0=/dev/ttyUSB0 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index d3a7a5c7..16238985 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -5,8 +5,9 @@ services: gateway-config: image: nebraltd/hm-config:{{CONFIG_VERSION}} depends_on: - - dbus-session + - helium-miner - diagnostics + - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} @@ -37,20 +38,10 @@ services: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} helium-miner: - image: nebraltd/hm-miner:{{ARCH}}-{{MINER_VERSION}} - depends_on: - - dbus-session - - diagnostics + image: nebraltd/hm-gatewayrs:{{GATEWAY_VERSION}} expose: - "1680" - "4467" - ports: - - "44158:44158/tcp" - volumes: - - miner-storage:/var/data - - miner-log:/var/log/miner - - pktfwdr:/var/pktfwd - - dbus:/session/dbus cap_add: - SYS_RAWIO devices: @@ -59,10 +50,12 @@ services: environment: - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - FIRMWARE_VERSION={{FIRMWARE_VERSION}} + - I2C_DEVICE={{I2C_DEVICE}} diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: + - helium-miner - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} @@ -100,6 +93,5 @@ services: volumes: miner-storage: - miner-log: pktfwdr: dbus: From 23c735596a8800a9010fa82f1b52dc238cff584c Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Sun, 27 Mar 2022 17:10:45 +0530 Subject: [PATCH 02/26] feat: Light miner: Remove dbus container (#401) * remove dbus container --- README.md | 8 +------- settings.ini | 6 +++--- templates/docker-compose.template | 21 +++------------------ 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 06fec7cd..15a1768e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository generates the main docker-compose.yml (follow the steps to gener The `docker-compose.yml` file is pushed to [Balena](https://www.balena.io/) (using GitHub Actions), which in turn pulls down the various Docker images outlined below. -There are currently six different services running within this device, which are all outlined below. +There are currently four different services running within this device, which are all outlined below. ## Diagnostics @@ -36,12 +36,6 @@ Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayr This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. -## DBus Session - -Repo: [github.com/balenablocks/dbus](https://github.com/balenablocks/dbus) - -This container doesn't serve any purpose any more and will be removed. - # Quick Start This is a guide to help you get started with the repository and get it running on your local device. This guide is focused on pushing the repository onto a Raspberry Pi using Balena. diff --git a/settings.ini b/settings.ini index 5371333f..4d780ad1 100644 --- a/settings.ini +++ b/settings.ini @@ -1,9 +1,9 @@ [versions] -FIRMWARE_VERSION=2022.03.07.0-2 +FIRMWARE_VERSION=v1.0.0-alpha.23 DIAGNOSTICS_VERSION=fb63618 -CONFIG_VERSION=e5ac58c +CONFIG_VERSION=b5fa96c PKTFWD_VERSION=b95cc46 -GATEWAY_VERSION=409c974 +GATEWAY_VERSION=d3b1c78 [quectel_modem] MODEM_SERIAL0=/dev/ttyUSB0 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 16238985..637bc4a8 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -7,19 +7,14 @@ services: depends_on: - helium-miner - diagnostics - - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket privileged: true network_mode: host cap_add: - NET_ADMIN - volumes: - - miner-storage:/var/data - - dbus:/session/dbus labels: io.balena.features.sysfs: 1 io.balena.features.kernel-modules: 1 @@ -48,15 +43,16 @@ services: - {{I2C_DEVICE}}:{{I2C_DEVICE}} restart: on-failure environment: - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - I2C_DEVICE={{I2C_DEVICE}} + volumes: + - pktfwdr:/var/pktfwd + - miner-storage:/var/data diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: - helium-miner - - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} @@ -81,17 +77,6 @@ services: io.balena.features.procfs: 1 io.balena.features.dbus: 1 - dbus-session: - image: balenablocks/dbus:rpi-0.0.2 - restart: always - volumes: - - dbus:/session/dbus - environment: - - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - volumes: miner-storage: pktfwdr: - dbus: From 10163535d8514d8ff9da83465613ecd08955edbe Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Sun, 24 Apr 2022 16:48:33 +0530 Subject: [PATCH 03/26] fix: Add host networking to hm-miner to access grpc api #427 * helium-miner and diagnostics now use host networking --- templates/docker-compose.template | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 637bc4a8..e7c94a95 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -27,6 +27,10 @@ services: - helium-miner restart: always privileged: true + network_mode: host + # host networking doesn't export hostnames + extra_hosts: + - "helium-miner:127.0.0.1" volumes: - pktfwdr:/var/pktfwd environment: @@ -34,9 +38,7 @@ services: helium-miner: image: nebraltd/hm-gatewayrs:{{GATEWAY_VERSION}} - expose: - - "1680" - - "4467" + network_mode: host cap_add: - SYS_RAWIO devices: @@ -61,8 +63,10 @@ services: volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data - ports: - - "80:5000" + network_mode: host + # host networking doesn't export hostnames + extra_hosts: + - "helium-miner:127.0.0.1" cap_add: - SYS_RAWIO devices: @@ -80,3 +84,13 @@ services: volumes: miner-storage: pktfwdr: + +# balena keeps on changing the subnet, making it impossible +# to use extra_hosts for naming host IPs +networks: + default: + driver: bridge + ipam: + driver: default + config: + - subnet: 172.20.0.0/16 \ No newline at end of file From c7ab0afea6467237f0b4e0db2ff483ae1349e369 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Wed, 30 Mar 2022 14:46:27 +0300 Subject: [PATCH 04/26] Added automation for light hotspots, removed different fleet necessity for every device type. Removed necessity for upfront I2C device report. Now a single release could be used for all of the devices. (NebraLtd/helium-miner-software#399) --- .github/workflows/push-to-testnet-draft.yml | 61 +--------- .github/workflows/push-to-testnet.yml | 65 +---------- ...{update-miner.yml => update-gatewayrs.yml} | 6 +- .gitignore | 2 - README.md | 8 +- .../docker-compose-pisces.yml | 105 ------------------ .../docker-compose-rockpi.yml | 105 ------------------ device-compose-files/docker-compose-rpi.yml | 105 ------------------ gen_docker_compose.py | 21 +--- settings.ini | 20 +--- templates/docker-compose.template | 19 +--- tests/test_output.py | 24 +--- 12 files changed, 34 insertions(+), 507 deletions(-) rename .github/workflows/{update-miner.yml => update-gatewayrs.yml} (86%) delete mode 100644 device-compose-files/docker-compose-pisces.yml delete mode 100644 device-compose-files/docker-compose-rockpi.yml delete mode 100644 device-compose-files/docker-compose-rpi.yml diff --git a/.github/workflows/push-to-testnet-draft.yml b/.github/workflows/push-to-testnet-draft.yml index 1b757c4d..55876dc0 100644 --- a/.github/workflows/push-to-testnet-draft.yml +++ b/.github/workflows/push-to-testnet-draft.yml @@ -8,8 +8,6 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, finestra, sensecap, og, controllino, pisces] steps: - name: Checkout uses: actions/checkout@v2 @@ -19,62 +17,11 @@ jobs: echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for RockPi - if: matrix.sbc == 'rockpi' + - name: Generate Docker Compose run: | - python gen_docker_compose.py rockpi -o device-compose-files/docker-compose-rockpi.yml - cp device-compose-files/docker-compose-rockpi.yml docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for RaspberryPi & RAK & Other RasPi based vendors - if: matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' - run: | - python gen_docker_compose.py rpi -o device-compose-files/docker-compose-rpi.yml - cp device-compose-files/docker-compose-rpi.yml docker-compose.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o device-compose-files/docker-compose-pisces.yml - cp device-compose-files/docker-compose-pisces.yml docker-compose.yml - - name: Balena Deploy (Nebra ROCK Pi) + python gen_docker_compose.py -o docker-compose.yml + - name: Balena Deploy uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'rockpi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --logs --debug --nocache --build --draft" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-testnet --logs --debug --nocache --build --draft" - - name: Balena Deploy (RAK and other non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: success() && (matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'pisces') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --logs --debug --nocache --build --draft" - - name: Push updated docker compose file (ROCK Pi) - if: matrix.sbc == 'rockpi' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rockpi.yml - commit-msg: Update ROCK Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Nebra RasPi, RAK and other RasPi based vendors) - if: (matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rpi.yml - commit-msg: Update Raspberry Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pisces) - if: matrix.sbc == 'pisces' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pisces.yml - commit-msg: Update Pisces P100 docker compose output - github-token: ${{ secrets.MR_BUMP }} + balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build --draft" diff --git a/.github/workflows/push-to-testnet.yml b/.github/workflows/push-to-testnet.yml index c68e5f08..eeb74c19 100644 --- a/.github/workflows/push-to-testnet.yml +++ b/.github/workflows/push-to-testnet.yml @@ -4,17 +4,13 @@ on: push: # Only run workflow for pushes to specific branches branches: - - master - paths-ignore: - - 'device-compose-files/**' + - light-hotspot jobs: testnet: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, finestra, sensecap, og, controllino, pisces] steps: - name: Checkout uses: actions/checkout@v2 @@ -24,62 +20,11 @@ jobs: echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for RockPi - if: matrix.sbc == 'rockpi' + - name: Generate Docker Compose run: | - python gen_docker_compose.py rockpi -o device-compose-files/docker-compose-rockpi.yml - cp device-compose-files/docker-compose-rockpi.yml docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for RaspberryPi & RAK & Other RasPi based vendors - if: matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' - run: | - python gen_docker_compose.py rpi -o device-compose-files/docker-compose-rpi.yml - cp device-compose-files/docker-compose-rpi.yml docker-compose.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o device-compose-files/docker-compose-pisces.yml - cp device-compose-files/docker-compose-pisces.yml docker-compose.yml - - name: Balena Deploy (Nebra ROCK Pi) + python gen_docker_compose.py -o docker-compose.yml + - name: Balena Deploy uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'rockpi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --logs --debug --nocache --build" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-testnet --logs --debug --nocache --build" - - name: Balena Deploy (RAK and other non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: success() && (matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'pisces') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --logs --debug --nocache --build" - - name: Push updated docker compose file (ROCK Pi) - if: matrix.sbc == 'rockpi' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rockpi.yml - commit-msg: Update ROCK Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Nebra RasPi, RAK and other RasPi based vendors) - if: (matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rpi.yml - commit-msg: Update Raspberry Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pisces) - if: matrix.sbc == 'pisces' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pisces.yml - commit-msg: Update Pisces P100 docker compose output - github-token: ${{ secrets.MR_BUMP }} + balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build" diff --git a/.github/workflows/update-miner.yml b/.github/workflows/update-gatewayrs.yml similarity index 86% rename from .github/workflows/update-miner.yml rename to .github/workflows/update-gatewayrs.yml index 9f8e029d..8c260503 100644 --- a/.github/workflows/update-miner.yml +++ b/.github/workflows/update-gatewayrs.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: + with: ref: ${{ github.ref }} - run: | LATEST_GA=${{ github.event.client_payload.tag }} @@ -18,11 +18,11 @@ jobs: echo "We're not on the latest Helium gateway-rs release. Updating to $LATEST_GA with SHA $SHORT_SHA." sed -i -E "s/FIRMWARE_VERSION=.*/FIRMWARE_VERSION=$LATEST_GA/g" settings.ini - sed -i -E "s/GATEWAY_VERSION=.*/GATEWAY_VERSION=$SHORT_SHA/g" settings.ini + sed -i -E "s/GATEWAYRS_VERSION=.*/GATEWAYRS_VERSION=$SHORT_SHA/g" settings.ini - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - commit-message: Update Gatewayrs to latest GA ${{ env.LATEST_GA }} + commit-message: Update Gateway-rs to latest GA ${{ env.LATEST_GA }} branch: gatewayrs-bump/${{ env.LATEST_GA }} delete-branch: true base: master diff --git a/.gitignore b/.gitignore index 368fd50a..37db3b1e 100644 --- a/.gitignore +++ b/.gitignore @@ -138,5 +138,3 @@ dmypy.json # Cython debug symbols cython_debug/ .vscode/ - -device-compose-files/test_file.yml \ No newline at end of file diff --git a/README.md b/README.md index 15a1768e..03495131 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,12 @@ Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayr This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. +Gatewayrs container requires two IP ports exposed as default. +- [1680](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L18): For connecting to packet-forwarder over localhost (127.0.0.1) +- [4467](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L22): For connecting to gRPC API over WAN. + +Both of these ports can be changed via settings (toml) file. + # Quick Start This is a guide to help you get started with the repository and get it running on your local device. This guide is focused on pushing the repository onto a Raspberry Pi using Balena. @@ -54,7 +60,7 @@ You may notice that after cloning the repo that you are missing a docker-compose *Note for generating the file for local tests: The repo's short Git SHA is fetched from GitHub pipeline automatically while working with standard procedure. But if you need to test your working copy locally, you need to create an environment variable first via running following command on Linux:* -```sh +```sh $ export FIRMWARE_SHORT_HASH=$(git rev-parse --short HEAD) ``` diff --git a/device-compose-files/docker-compose-pisces.yml b/device-compose-files/docker-compose-pisces.yml deleted file mode 100644 index 4f4c48d6..00000000 --- a/device-compose-files/docker-compose-pisces.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: '2' - -services: - - gateway-config: - image: nebraltd/hm-config:e5ac58c - depends_on: - - dbus-session - - diagnostics - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - privileged: true - network_mode: host - cap_add: - - NET_ADMIN - volumes: - - miner-storage:/var/data - - dbus:/session/dbus - labels: - io.balena.features.sysfs: 1 - io.balena.features.kernel-modules: 1 - io.balena.features.dbus: 1 - stop_signal: SIGINT - - packet-forwarder: - image: nebraltd/hm-pktfwd:b95cc46 - depends_on: - - helium-miner - restart: always - privileged: true - volumes: - - pktfwdr:/var/pktfwd - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - helium-miner: - image: nebraltd/hm-miner:arm64-9564845 - depends_on: - - dbus-session - - diagnostics - expose: - - "1680" - - "4467" - ports: - - "44158:44158/tcp" - volumes: - - miner-storage:/var/data - - miner-log:/var/log/miner - - pktfwdr:/var/pktfwd - - dbus:/session/dbus - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-0:/dev/i2c-0 - restart: on-failure - environment: - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.03.07.0-2 - - diagnostics: - image: nebraltd/hm-diag:fb63618 - depends_on: - - dbus-session - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - - DIAGNOSTICS_VERSION=fb63618 - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - volumes: - - pktfwdr:/var/pktfwd - - miner-storage:/var/data - ports: - - "80:5000" - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-0:/dev/i2c-0 - - /dev/ttyUSB0:/dev/ttyUSB0 - - /dev/ttyUSB1:/dev/ttyUSB1 - - /dev/ttyUSB2:/dev/ttyUSB2 - - /dev/ttyUSB3:/dev/ttyUSB3 - privileged: true - labels: - io.balena.features.sysfs: 1 - io.balena.features.procfs: 1 - io.balena.features.dbus: 1 - - dbus-session: - image: balenablocks/dbus:rpi-0.0.2 - restart: always - volumes: - - dbus:/session/dbus - environment: - - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - -volumes: - miner-storage: - miner-log: - pktfwdr: - dbus: \ No newline at end of file diff --git a/device-compose-files/docker-compose-rockpi.yml b/device-compose-files/docker-compose-rockpi.yml deleted file mode 100644 index 87ab42d8..00000000 --- a/device-compose-files/docker-compose-rockpi.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: '2' - -services: - - gateway-config: - image: nebraltd/hm-config:e5ac58c - depends_on: - - dbus-session - - diagnostics - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - privileged: true - network_mode: host - cap_add: - - NET_ADMIN - volumes: - - miner-storage:/var/data - - dbus:/session/dbus - labels: - io.balena.features.sysfs: 1 - io.balena.features.kernel-modules: 1 - io.balena.features.dbus: 1 - stop_signal: SIGINT - - packet-forwarder: - image: nebraltd/hm-pktfwd:b95cc46 - depends_on: - - helium-miner - restart: always - privileged: true - volumes: - - pktfwdr:/var/pktfwd - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - helium-miner: - image: nebraltd/hm-miner:arm64-9564845 - depends_on: - - dbus-session - - diagnostics - expose: - - "1680" - - "4467" - ports: - - "44158:44158/tcp" - volumes: - - miner-storage:/var/data - - miner-log:/var/log/miner - - pktfwdr:/var/pktfwd - - dbus:/session/dbus - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-7:/dev/i2c-7 - restart: on-failure - environment: - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.03.07.0-2 - - diagnostics: - image: nebraltd/hm-diag:fb63618 - depends_on: - - dbus-session - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - - DIAGNOSTICS_VERSION=fb63618 - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - volumes: - - pktfwdr:/var/pktfwd - - miner-storage:/var/data - ports: - - "80:5000" - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-7:/dev/i2c-7 - - /dev/ttyUSB0:/dev/ttyUSB0 - - /dev/ttyUSB1:/dev/ttyUSB1 - - /dev/ttyUSB2:/dev/ttyUSB2 - - /dev/ttyUSB3:/dev/ttyUSB3 - privileged: true - labels: - io.balena.features.sysfs: 1 - io.balena.features.procfs: 1 - io.balena.features.dbus: 1 - - dbus-session: - image: balenablocks/dbus:rpi-0.0.2 - restart: always - volumes: - - dbus:/session/dbus - environment: - - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - -volumes: - miner-storage: - miner-log: - pktfwdr: - dbus: \ No newline at end of file diff --git a/device-compose-files/docker-compose-rpi.yml b/device-compose-files/docker-compose-rpi.yml deleted file mode 100644 index 0d78ded6..00000000 --- a/device-compose-files/docker-compose-rpi.yml +++ /dev/null @@ -1,105 +0,0 @@ -version: '2' - -services: - - gateway-config: - image: nebraltd/hm-config:e5ac58c - depends_on: - - dbus-session - - diagnostics - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - privileged: true - network_mode: host - cap_add: - - NET_ADMIN - volumes: - - miner-storage:/var/data - - dbus:/session/dbus - labels: - io.balena.features.sysfs: 1 - io.balena.features.kernel-modules: 1 - io.balena.features.dbus: 1 - stop_signal: SIGINT - - packet-forwarder: - image: nebraltd/hm-pktfwd:b95cc46 - depends_on: - - helium-miner - restart: always - privileged: true - volumes: - - pktfwdr:/var/pktfwd - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - helium-miner: - image: nebraltd/hm-miner:arm64-9564845 - depends_on: - - dbus-session - - diagnostics - expose: - - "1680" - - "4467" - ports: - - "44158:44158/tcp" - volumes: - - miner-storage:/var/data - - miner-log:/var/log/miner - - pktfwdr:/var/pktfwd - - dbus:/session/dbus - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-1:/dev/i2c-1 - restart: on-failure - environment: - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.03.07.0-2 - - diagnostics: - image: nebraltd/hm-diag:fb63618 - depends_on: - - dbus-session - environment: - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - - DIAGNOSTICS_VERSION=fb63618 - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - volumes: - - pktfwdr:/var/pktfwd - - miner-storage:/var/data - ports: - - "80:5000" - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-1:/dev/i2c-1 - - /dev/ttyUSB0:/dev/ttyUSB0 - - /dev/ttyUSB1:/dev/ttyUSB1 - - /dev/ttyUSB2:/dev/ttyUSB2 - - /dev/ttyUSB3:/dev/ttyUSB3 - privileged: true - labels: - io.balena.features.sysfs: 1 - io.balena.features.procfs: 1 - io.balena.features.dbus: 1 - - dbus-session: - image: balenablocks/dbus:rpi-0.0.2 - restart: always - volumes: - - dbus:/session/dbus - environment: - - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.03.07.0-2 - - FIRMWARE_SHORT_HASH=793143a - -volumes: - miner-storage: - miner-log: - pktfwdr: - dbus: \ No newline at end of file diff --git a/gen_docker_compose.py b/gen_docker_compose.py index 749dc1ef..d46bb7da 100644 --- a/gen_docker_compose.py +++ b/gen_docker_compose.py @@ -15,7 +15,6 @@ format strings. """ -import sys import os import argparse from typing import Union @@ -51,25 +50,18 @@ def __init__(self, templates_folder: Union[str, None] = None): def generate_compose_file( self, - device_type: str, template_file: str, output_file: str ) -> None: """generate_compose_file Render template_file to generate compose file. Args: - device_type (str): The target device for the docker compose file. - This device should have a section in settings.ini. template_file (str): Template file name without folder name. Should be present in the templates folder. output_file (str): Output filename. Can be a path. Otherwise file is created in current folder. """ template = self.jinja_env.get_template(template_file) - if not self.config.has_section(f'device_{device_type}'): - print(f"Error: Unknown device type: {device_type}. " - "No matching config section found in settings.ini") - sys.exit(1) template_args = {} @@ -81,12 +73,6 @@ def generate_compose_file( template_args["ENV"] = os.environ - for k, v in self.config['quectel_modem'].items(): - template_args[k] = v - - for k, v in self.config[f'device_{device_type}'].items(): - template_args[k] = v - output = template.render(**template_args) with open(output_file, 'w') as template_output: template_output.write(output) @@ -95,9 +81,7 @@ def generate_compose_file( if __name__ == '__main__': parser = argparse.ArgumentParser("Generate docker-compose.yml.") - parser.add_argument('device_type', - help="Target device. Must have a section in " - "settings.ini.") + parser.add_argument('--template', '-t', default='docker-compose.template', help="Input template file. Should be present in " "templates folder.") @@ -107,5 +91,4 @@ def generate_compose_file( # print(args) composer = DockerComposer() - composer.generate_compose_file( - args.device_type, args.template, args.output) + composer.generate_compose_file(args.template, args.output) diff --git a/settings.ini b/settings.ini index 4d780ad1..a4b5fb76 100644 --- a/settings.ini +++ b/settings.ini @@ -3,22 +3,4 @@ FIRMWARE_VERSION=v1.0.0-alpha.23 DIAGNOSTICS_VERSION=fb63618 CONFIG_VERSION=b5fa96c PKTFWD_VERSION=b95cc46 -GATEWAY_VERSION=d3b1c78 - -[quectel_modem] -MODEM_SERIAL0=/dev/ttyUSB0 -MODEM_SERIAL1=/dev/ttyUSB1 -MODEM_SERIAL2=/dev/ttyUSB2 -MODEM_SERIAL3=/dev/ttyUSB3 - -[device_rpi] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-1 - -[device_rockpi] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-7 - -[device_pisces] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-0 +GATEWAYRS_VERSION=d3b1c78 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index e7c94a95..68823598 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -5,7 +5,7 @@ services: gateway-config: image: nebraltd/hm-config:{{CONFIG_VERSION}} depends_on: - - helium-miner + - gatewayrs - diagnostics environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} @@ -24,7 +24,7 @@ services: packet-forwarder: image: nebraltd/hm-pktfwd:{{PKTFWD_VERSION}} depends_on: - - helium-miner + - gatewayrs restart: always privileged: true network_mode: host @@ -35,18 +35,18 @@ services: - pktfwdr:/var/pktfwd environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} + - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} helium-miner: image: nebraltd/hm-gatewayrs:{{GATEWAY_VERSION}} network_mode: host cap_add: - SYS_RAWIO - devices: - - {{I2C_DEVICE}}:{{I2C_DEVICE}} + privileged: true restart: on-failure environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - - I2C_DEVICE={{I2C_DEVICE}} + - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data @@ -54,7 +54,7 @@ services: diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: - - helium-miner + - gatewayrs environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} @@ -69,12 +69,6 @@ services: - "helium-miner:127.0.0.1" cap_add: - SYS_RAWIO - devices: - - {{I2C_DEVICE}}:{{I2C_DEVICE}} - - {{MODEM_SERIAL0}}:{{MODEM_SERIAL0}} - - {{MODEM_SERIAL1}}:{{MODEM_SERIAL1}} - - {{MODEM_SERIAL2}}:{{MODEM_SERIAL2}} - - {{MODEM_SERIAL3}}:{{MODEM_SERIAL3}} privileged: true labels: io.balena.features.sysfs: 1 @@ -93,4 +87,3 @@ networks: ipam: driver: default config: - - subnet: 172.20.0.0/16 \ No newline at end of file diff --git a/tests/test_output.py b/tests/test_output.py index 4529da66..bcc057a4 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -10,8 +10,7 @@ here = dirname(abspath(__file__)) parent = dirname(here) template_file = 'docker-compose.template' -rpi_output_file = join(here, 'rpi.yml') -rockpi_output_file = join(here, 'rockpi.yml') +output_file = join(here, 'dc.yml') sys.path.insert(1, parent) @@ -27,28 +26,17 @@ def tearDown(self) -> None: return super().tearDown() def _remove_output_files(self): - for filename in (rpi_output_file, rockpi_output_file): - if exists(filename): - unlink(filename) + if exists(output_file): + unlink(output_file) - def test_rpi_compose_output_is_valid(self): + def test_compose_output_is_valid(self): # Uncomment line below if want to test custom templates. # dc = DockerComposer(templates_folder=templates_folder) dc = DockerComposer() - dc.generate_compose_file('rpi', template_file, rpi_output_file) + dc.generate_compose_file(template_file, output_file) # On failure or non-zero return code this returns CalledProcessError # so if this runs without that, it's considered successful as # `docker-compose config -q` returns 1 on invalid config check_call( - f'docker-compose -f {rpi_output_file} config -q', shell=True) - - def test_rockpi_compose_output_is_valid(self): - dc = DockerComposer() - dc.generate_compose_file('rockpi', template_file, rockpi_output_file) - - # On failure or non-zero return code this returns CalledProcessError - # so if this runs without that, it's considered successful as - # `docker-compose config -q` returns 1 on invalid config - check_call( - f'docker-compose -f {rockpi_output_file} config -q', shell=True) + f'docker-compose -f {output_file} config -q', shell=True) From 6f85b8be8ab91698264db150c0d035a0fe7ea03c Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Mon, 18 Apr 2022 14:04:22 +0300 Subject: [PATCH 05/26] Fixed: Port 1680 is not just for localhost --- README.md | 2 +- templates/docker-compose.template | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 03495131..83606f75 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayr This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. Gatewayrs container requires two IP ports exposed as default. -- [1680](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L18): For connecting to packet-forwarder over localhost (127.0.0.1) +- [1680](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L18): For connecting to packet-forwarder. - [4467](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L22): For connecting to gRPC API over WAN. Both of these ports can be changed via settings (toml) file. diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 68823598..aa6a55f3 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -5,7 +5,7 @@ services: gateway-config: image: nebraltd/hm-config:{{CONFIG_VERSION}} depends_on: - - gatewayrs + - helium-miner - diagnostics environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} @@ -24,7 +24,7 @@ services: packet-forwarder: image: nebraltd/hm-pktfwd:{{PKTFWD_VERSION}} depends_on: - - gatewayrs + - helium-miner restart: always privileged: true network_mode: host @@ -54,7 +54,7 @@ services: diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: - - gatewayrs + - helium-miner environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} From 54096500878b8b18418d3ce888d20f6a0ee69aa8 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 29 Apr 2022 14:03:22 +0300 Subject: [PATCH 06/26] Fixed: Python test fail --- templates/docker-compose.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.template b/templates/docker-compose.template index aa6a55f3..d1aee2db 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -38,7 +38,7 @@ services: - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} helium-miner: - image: nebraltd/hm-gatewayrs:{{GATEWAY_VERSION}} + image: nebraltd/hm-gatewayrs:{{GATEWAYRS_VERSION}} network_mode: host cap_add: - SYS_RAWIO From 71f96c6a5671ee00665b34b73a2ff5d37b1e3066 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Thu, 5 May 2022 15:26:22 +0300 Subject: [PATCH 07/26] Fixed: Accidentally removed the docker subnet config in another PR --- templates/docker-compose.template | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/docker-compose.template b/templates/docker-compose.template index d1aee2db..2f0ecc76 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -87,3 +87,4 @@ networks: ipam: driver: default config: + - subnet: 172.20.0.0/16 From c84015c11bdff416a1199dcdc8db69e7be62c971 Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Wed, 28 Sep 2022 13:08:47 +0530 Subject: [PATCH 08/26] Light miner: Diagnostics page should display Helium PK * modified docker template to use the new hm-gatewayrs container --- .github/workflows/update-miner.yml | 20 ++++++++++---------- README.md | 8 ++++---- settings.ini | 10 +++++----- templates/docker-compose.template | 17 +++++------------ 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/.github/workflows/update-miner.yml b/.github/workflows/update-miner.yml index 6da22a95..9f8e029d 100644 --- a/.github/workflows/update-miner.yml +++ b/.github/workflows/update-miner.yml @@ -1,9 +1,9 @@ -name: Update Miner GA (Testnet) +name: Update Gatewayrs GA (Testnet) on: repository_dispatch: - types: [miner-update] + types: [gatewayrs-update] jobs: - miner-update: + gatewayrs-update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -16,19 +16,19 @@ jobs: echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "LONG_SHA=$LONG_SHA" >> $GITHUB_ENV - echo "We're not on the latest Helium GA release. Updating to $LATEST_GA with SHA $SHORT_SHA." + echo "We're not on the latest Helium gateway-rs release. Updating to $LATEST_GA with SHA $SHORT_SHA." sed -i -E "s/FIRMWARE_VERSION=.*/FIRMWARE_VERSION=$LATEST_GA/g" settings.ini - sed -i -E "s/MINER_VERSION=.*/MINER_VERSION=$SHORT_SHA/g" settings.ini + sed -i -E "s/GATEWAY_VERSION=.*/GATEWAY_VERSION=$SHORT_SHA/g" settings.ini - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - commit-message: Update miner to latest GA ${{ env.LATEST_GA }} - branch: miner-bump/${{ env.LATEST_GA }} + commit-message: Update Gatewayrs to latest GA ${{ env.LATEST_GA }} + branch: gatewayrs-bump/${{ env.LATEST_GA }} delete-branch: true base: master - title: "release(testnet): Update miner to latest GA ${{ env.LATEST_GA }}" + title: "release(testnet): Update Gatewayrs to latest GA ${{ env.LATEST_GA }}" body: | - Update miner to latest GA ${{ env.LATEST_GA }} + Update gatewayrs to latest GA ${{ env.LATEST_GA }} - Ref NebraLtd/hm-miner@${{ env.LONG_SHA }} + Ref NebraLtd/hm-gatewayrs@${{ env.LONG_SHA }} draft: false diff --git a/README.md b/README.md index b3a377a6..a6508ecf 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,17 @@ As of 27th Jan 2022, we have also moved the UPnP functionality into this repo in Removing the UPnP container reduces CPU overhead and redundant code. -## Helium Miner +## Helium Gateway-rs -Repo: [github.com/NebraLtd/hm-miner](https://github.com/NebraLtd/hm-miner) +Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayrs) -This container is the actual Helium Miner software (from upstream), with the required configuration files added. +This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. ## DBus Session Repo: [github.com/balenablocks/dbus](https://github.com/balenablocks/dbus) -This container configures a DBus session bus instance that is used by the gateway config container to communicate with the miner code (note that there is also a separate system bus running on the host OS which is used by gateway config to communicate with bluez for configuring Bluetooth services). This removes the need to have a custom `com.helium.Miner.conf` dbus config file on the host OS as was done previously (and meant we had to run a custom balena device type). +This container doesn't serve any purpose any more and will be removed. # Quick Start diff --git a/settings.ini b/settings.ini index 7323cec6..b8807503 100644 --- a/settings.ini +++ b/settings.ini @@ -1,9 +1,9 @@ [versions] -FIRMWARE_VERSION=2022.08.17.6 -DIAGNOSTICS_VERSION=c8c523e -CONFIG_VERSION=2113f5f -PKTFWD_VERSION=e2bd70e -MINER_VERSION=3a0189c +FIRMWARE_VERSION=2022.03.07.0-2 +DIAGNOSTICS_VERSION=fb63618 +CONFIG_VERSION=e5ac58c +PKTFWD_VERSION=b95cc46 +GATEWAY_VERSION=409c974 [quectel_modem] MODEM_SERIAL0=/dev/ttyUSB0 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 2a69be9b..9d3cd831 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -5,8 +5,9 @@ services: gateway-config: image: nebraltd/hm-config:{{CONFIG_VERSION}} depends_on: - - dbus-session + - helium-miner - diagnostics + - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} @@ -38,20 +39,10 @@ services: - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} helium-miner: - image: nebraltd/hm-miner:{{ARCH}}-{{MINER_VERSION}} - depends_on: - - dbus-session - - diagnostics + image: nebraltd/hm-gatewayrs:{{GATEWAY_VERSION}} expose: - "1680" - "4467" - ports: - - "44158:44158/tcp" - volumes: - - miner-storage:/var/data - - miner-log:/var/log/miner - - pktfwdr:/var/pktfwd - - dbus:/session/dbus cap_add: - SYS_RAWIO devices: @@ -61,10 +52,12 @@ services: - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} + - I2C_DEVICE={{I2C_DEVICE}} diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: + - helium-miner - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} From 7ef83734acd97242c960b0ff5d049f7988ace4cc Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Wed, 28 Sep 2022 13:09:56 +0530 Subject: [PATCH 09/26] feat: Light miner: Remove dbus container (#401) * remove dbus container --- README.md | 8 +------- settings.ini | 6 +++--- templates/docker-compose.template | 21 +++------------------ 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index a6508ecf..15a1768e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository generates the main docker-compose.yml (follow the steps to gener The `docker-compose.yml` file is pushed to [Balena](https://www.balena.io/) (using GitHub Actions), which in turn pulls down the various Docker images outlined below. -There are currently five different services running within this device, which are all outlined below. +There are currently four different services running within this device, which are all outlined below. ## Diagnostics @@ -36,12 +36,6 @@ Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayr This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. -## DBus Session - -Repo: [github.com/balenablocks/dbus](https://github.com/balenablocks/dbus) - -This container doesn't serve any purpose any more and will be removed. - # Quick Start This is a guide to help you get started with the repository and get it running on your local device. This guide is focused on pushing the repository onto a Raspberry Pi using Balena. diff --git a/settings.ini b/settings.ini index b8807503..8c0e9026 100644 --- a/settings.ini +++ b/settings.ini @@ -1,9 +1,9 @@ [versions] -FIRMWARE_VERSION=2022.03.07.0-2 +FIRMWARE_VERSION=v1.0.0-alpha.23 DIAGNOSTICS_VERSION=fb63618 -CONFIG_VERSION=e5ac58c +CONFIG_VERSION=b5fa96c PKTFWD_VERSION=b95cc46 -GATEWAY_VERSION=409c974 +GATEWAY_VERSION=d3b1c78 [quectel_modem] MODEM_SERIAL0=/dev/ttyUSB0 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 9d3cd831..cfc7e6be 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -7,19 +7,14 @@ services: depends_on: - helium-miner - diagnostics - - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket privileged: true network_mode: host cap_add: - NET_ADMIN - volumes: - - miner-storage:/var/data - - dbus:/session/dbus labels: io.balena.features.sysfs: 1 io.balena.features.kernel-modules: 1 @@ -49,16 +44,17 @@ services: - {{I2C_DEVICE}}:{{I2C_DEVICE}} restart: on-failure environment: - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - I2C_DEVICE={{I2C_DEVICE}} + volumes: + - pktfwdr:/var/pktfwd + - miner-storage:/var/data diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: - helium-miner - - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} @@ -85,19 +81,8 @@ services: io.balena.features.dbus: 1 io.balena.features.supervisor-api: '1' - dbus-session: - image: balenablocks/dbus:rpi-0.0.2 - restart: always - volumes: - - dbus:/session/dbus - environment: - - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - volumes: miner-storage: miner-log: watchdog-log: pktfwdr: - dbus: From 5a0111275c1c141b6200b01b984ca2b2247d083a Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Wed, 28 Sep 2022 13:11:14 +0530 Subject: [PATCH 10/26] fix: Add host networking to hm-miner to access grpc api #427 * helium-miner and diagnostics now use host networking --- templates/docker-compose.template | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/templates/docker-compose.template b/templates/docker-compose.template index cfc7e6be..f5e45e8e 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -27,6 +27,10 @@ services: - helium-miner restart: always privileged: true + network_mode: host + # host networking doesn't export hostnames + extra_hosts: + - "helium-miner:127.0.0.1" volumes: - pktfwdr:/var/pktfwd environment: @@ -35,9 +39,7 @@ services: helium-miner: image: nebraltd/hm-gatewayrs:{{GATEWAY_VERSION}} - expose: - - "1680" - - "4467" + network_mode: host cap_add: - SYS_RAWIO devices: @@ -64,8 +66,10 @@ services: - pktfwdr:/var/pktfwd - miner-storage:/var/data - watchdog-log:/var/watchdog - ports: - - "80:5000" + network_mode: host + # host networking doesn't export hostnames + extra_hosts: + - "helium-miner:127.0.0.1" cap_add: - SYS_RAWIO devices: @@ -86,3 +90,13 @@ volumes: miner-log: watchdog-log: pktfwdr: + +# balena keeps on changing the subnet, making it impossible +# to use extra_hosts for naming host IPs +networks: + default: + driver: bridge + ipam: + driver: default + config: + - subnet: 172.20.0.0/16 \ No newline at end of file From 3d2240bc02a34aa561db2940b8afb3b10c49dd2f Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Wed, 28 Sep 2022 13:15:22 +0530 Subject: [PATCH 11/26] Added automation for light hotspots, removed different fleet necessity for every device type. Removed necessity for upfront I2C device report. Now a single release could be used for all of the devices. (NebraLtd/helium-miner-software#399) --- .github/workflows/push-to-testnet-draft.yml | 61 ++--------------- .github/workflows/push-to-testnet.yml | 65 ++----------------- ...{update-miner.yml => update-gatewayrs.yml} | 6 +- .gitignore | 2 - README.md | 8 ++- gen_docker_compose.py | 21 +----- settings.ini | 24 +------ templates/docker-compose.template | 17 ++--- tests/test_output.py | 24 ++----- 9 files changed, 32 insertions(+), 196 deletions(-) rename .github/workflows/{update-miner.yml => update-gatewayrs.yml} (86%) diff --git a/.github/workflows/push-to-testnet-draft.yml b/.github/workflows/push-to-testnet-draft.yml index 3a908206..55876dc0 100644 --- a/.github/workflows/push-to-testnet-draft.yml +++ b/.github/workflows/push-to-testnet-draft.yml @@ -8,8 +8,6 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, finestra, sensecap, og, controllino, pisces, cotx] steps: - name: Checkout uses: actions/checkout@v2 @@ -19,62 +17,11 @@ jobs: echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for RockPi - if: matrix.sbc == 'rockpi' + - name: Generate Docker Compose run: | - python gen_docker_compose.py rockpi -o device-compose-files/docker-compose-rockpi.yml - cp device-compose-files/docker-compose-rockpi.yml docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for RaspberryPi & RAK & Other RasPi based vendors - if: matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' - run: | - python gen_docker_compose.py rpi -o device-compose-files/docker-compose-rpi.yml - cp device-compose-files/docker-compose-rpi.yml docker-compose.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o device-compose-files/docker-compose-pisces.yml - cp device-compose-files/docker-compose-pisces.yml docker-compose.yml - - name: Balena Deploy (Nebra ROCK Pi) + python gen_docker_compose.py -o docker-compose.yml + - name: Balena Deploy uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'rockpi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --logs --debug --nocache --build --draft" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-testnet --logs --debug --nocache --build --draft" - - name: Balena Deploy (RAK and other non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: success() && (matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'pisces' || matrix.sbc == 'cotx') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --logs --debug --nocache --build --draft" - - name: Push updated docker compose file (ROCK Pi) - if: matrix.sbc == 'rockpi' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rockpi.yml - commit-msg: Update ROCK Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Nebra RasPi, RAK and other RasPi based vendors) - if: (matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rpi.yml - commit-msg: Update Raspberry Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pisces) - if: matrix.sbc == 'pisces' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pisces.yml - commit-msg: Update Pisces P100 docker compose output - github-token: ${{ secrets.MR_BUMP }} + balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build --draft" diff --git a/.github/workflows/push-to-testnet.yml b/.github/workflows/push-to-testnet.yml index e6ec5685..eeb74c19 100644 --- a/.github/workflows/push-to-testnet.yml +++ b/.github/workflows/push-to-testnet.yml @@ -4,17 +4,13 @@ on: push: # Only run workflow for pushes to specific branches branches: - - master - paths-ignore: - - 'device-compose-files/**' + - light-hotspot jobs: testnet: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, finestra, sensecap, og, controllino, pisces, cotx, pantherx1] steps: - name: Checkout uses: actions/checkout@v2 @@ -24,62 +20,11 @@ jobs: echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for RockPi - if: matrix.sbc == 'rockpi' + - name: Generate Docker Compose run: | - python gen_docker_compose.py rockpi -o device-compose-files/docker-compose-rockpi.yml - cp device-compose-files/docker-compose-rockpi.yml docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for RaspberryPi & RAK & Other RasPi based vendors - if: matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' - run: | - python gen_docker_compose.py rpi -o device-compose-files/docker-compose-rpi.yml - cp device-compose-files/docker-compose-rpi.yml docker-compose.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o device-compose-files/docker-compose-pisces.yml - cp device-compose-files/docker-compose-pisces.yml docker-compose.yml - - name: Balena Deploy (Nebra ROCK Pi) + python gen_docker_compose.py -o docker-compose.yml + - name: Balena Deploy uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'rockpi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --logs --debug --nocache --build" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-testnet --logs --debug --nocache --build" - - name: Balena Deploy (RAK and other non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: success() && (matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'pisces' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --logs --debug --nocache --build" - - name: Push updated docker compose file (ROCK Pi) - if: matrix.sbc == 'rockpi' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rockpi.yml - commit-msg: Update ROCK Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Nebra RasPi, RAK and other RasPi based vendors) - if: (matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rpi.yml - commit-msg: Update Raspberry Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pisces) - if: matrix.sbc == 'pisces' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pisces.yml - commit-msg: Update Pisces P100 docker compose output - github-token: ${{ secrets.MR_BUMP }} + balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build" diff --git a/.github/workflows/update-miner.yml b/.github/workflows/update-gatewayrs.yml similarity index 86% rename from .github/workflows/update-miner.yml rename to .github/workflows/update-gatewayrs.yml index 9f8e029d..8c260503 100644 --- a/.github/workflows/update-miner.yml +++ b/.github/workflows/update-gatewayrs.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: + with: ref: ${{ github.ref }} - run: | LATEST_GA=${{ github.event.client_payload.tag }} @@ -18,11 +18,11 @@ jobs: echo "We're not on the latest Helium gateway-rs release. Updating to $LATEST_GA with SHA $SHORT_SHA." sed -i -E "s/FIRMWARE_VERSION=.*/FIRMWARE_VERSION=$LATEST_GA/g" settings.ini - sed -i -E "s/GATEWAY_VERSION=.*/GATEWAY_VERSION=$SHORT_SHA/g" settings.ini + sed -i -E "s/GATEWAYRS_VERSION=.*/GATEWAYRS_VERSION=$SHORT_SHA/g" settings.ini - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: - commit-message: Update Gatewayrs to latest GA ${{ env.LATEST_GA }} + commit-message: Update Gateway-rs to latest GA ${{ env.LATEST_GA }} branch: gatewayrs-bump/${{ env.LATEST_GA }} delete-branch: true base: master diff --git a/.gitignore b/.gitignore index 368fd50a..37db3b1e 100644 --- a/.gitignore +++ b/.gitignore @@ -138,5 +138,3 @@ dmypy.json # Cython debug symbols cython_debug/ .vscode/ - -device-compose-files/test_file.yml \ No newline at end of file diff --git a/README.md b/README.md index 15a1768e..03495131 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,12 @@ Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayr This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. +Gatewayrs container requires two IP ports exposed as default. +- [1680](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L18): For connecting to packet-forwarder over localhost (127.0.0.1) +- [4467](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L22): For connecting to gRPC API over WAN. + +Both of these ports can be changed via settings (toml) file. + # Quick Start This is a guide to help you get started with the repository and get it running on your local device. This guide is focused on pushing the repository onto a Raspberry Pi using Balena. @@ -54,7 +60,7 @@ You may notice that after cloning the repo that you are missing a docker-compose *Note for generating the file for local tests: The repo's short Git SHA is fetched from GitHub pipeline automatically while working with standard procedure. But if you need to test your working copy locally, you need to create an environment variable first via running following command on Linux:* -```sh +```sh $ export FIRMWARE_SHORT_HASH=$(git rev-parse --short HEAD) ``` diff --git a/gen_docker_compose.py b/gen_docker_compose.py index 749dc1ef..d46bb7da 100644 --- a/gen_docker_compose.py +++ b/gen_docker_compose.py @@ -15,7 +15,6 @@ format strings. """ -import sys import os import argparse from typing import Union @@ -51,25 +50,18 @@ def __init__(self, templates_folder: Union[str, None] = None): def generate_compose_file( self, - device_type: str, template_file: str, output_file: str ) -> None: """generate_compose_file Render template_file to generate compose file. Args: - device_type (str): The target device for the docker compose file. - This device should have a section in settings.ini. template_file (str): Template file name without folder name. Should be present in the templates folder. output_file (str): Output filename. Can be a path. Otherwise file is created in current folder. """ template = self.jinja_env.get_template(template_file) - if not self.config.has_section(f'device_{device_type}'): - print(f"Error: Unknown device type: {device_type}. " - "No matching config section found in settings.ini") - sys.exit(1) template_args = {} @@ -81,12 +73,6 @@ def generate_compose_file( template_args["ENV"] = os.environ - for k, v in self.config['quectel_modem'].items(): - template_args[k] = v - - for k, v in self.config[f'device_{device_type}'].items(): - template_args[k] = v - output = template.render(**template_args) with open(output_file, 'w') as template_output: template_output.write(output) @@ -95,9 +81,7 @@ def generate_compose_file( if __name__ == '__main__': parser = argparse.ArgumentParser("Generate docker-compose.yml.") - parser.add_argument('device_type', - help="Target device. Must have a section in " - "settings.ini.") + parser.add_argument('--template', '-t', default='docker-compose.template', help="Input template file. Should be present in " "templates folder.") @@ -107,5 +91,4 @@ def generate_compose_file( # print(args) composer = DockerComposer() - composer.generate_compose_file( - args.device_type, args.template, args.output) + composer.generate_compose_file(args.template, args.output) diff --git a/settings.ini b/settings.ini index 8c0e9026..a4b5fb76 100644 --- a/settings.ini +++ b/settings.ini @@ -3,26 +3,4 @@ FIRMWARE_VERSION=v1.0.0-alpha.23 DIAGNOSTICS_VERSION=fb63618 CONFIG_VERSION=b5fa96c PKTFWD_VERSION=b95cc46 -GATEWAY_VERSION=d3b1c78 - -[quectel_modem] -MODEM_SERIAL0=/dev/ttyUSB0 -MODEM_SERIAL1=/dev/ttyUSB1 -MODEM_SERIAL2=/dev/ttyUSB2 -MODEM_SERIAL3=/dev/ttyUSB3 - -[device_rpi] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-1 -MODEM_SERIAL0=/dev/ttyUSB0 -MODEM_SERIAL1=/dev/ttyUSB1 -MODEM_SERIAL2=/dev/ttyUSB2 -MODEM_SERIAL3=/dev/ttyUSB3 - -[device_rockpi] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-7 - -[device_pisces] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-0 +GATEWAYRS_VERSION=d3b1c78 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index f5e45e8e..0cd3fea5 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -5,7 +5,7 @@ services: gateway-config: image: nebraltd/hm-config:{{CONFIG_VERSION}} depends_on: - - helium-miner + - gatewayrs - diagnostics environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} @@ -24,7 +24,7 @@ services: packet-forwarder: image: nebraltd/hm-pktfwd:{{PKTFWD_VERSION}} depends_on: - - helium-miner + - gatewayrs restart: always privileged: true network_mode: host @@ -42,13 +42,11 @@ services: network_mode: host cap_add: - SYS_RAWIO - devices: - - {{I2C_DEVICE}}:{{I2C_DEVICE}} + privileged: true restart: on-failure environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - - I2C_DEVICE={{I2C_DEVICE}} volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data @@ -56,7 +54,7 @@ services: diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: - - helium-miner + - gatewayrs environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} @@ -72,12 +70,6 @@ services: - "helium-miner:127.0.0.1" cap_add: - SYS_RAWIO - devices: - - {{I2C_DEVICE}}:{{I2C_DEVICE}} - - {{MODEM_SERIAL0}}:{{MODEM_SERIAL0}} - - {{MODEM_SERIAL1}}:{{MODEM_SERIAL1}} - - {{MODEM_SERIAL2}}:{{MODEM_SERIAL2}} - - {{MODEM_SERIAL3}}:{{MODEM_SERIAL3}} privileged: true labels: io.balena.features.sysfs: 1 @@ -99,4 +91,3 @@ networks: ipam: driver: default config: - - subnet: 172.20.0.0/16 \ No newline at end of file diff --git a/tests/test_output.py b/tests/test_output.py index 4529da66..bcc057a4 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -10,8 +10,7 @@ here = dirname(abspath(__file__)) parent = dirname(here) template_file = 'docker-compose.template' -rpi_output_file = join(here, 'rpi.yml') -rockpi_output_file = join(here, 'rockpi.yml') +output_file = join(here, 'dc.yml') sys.path.insert(1, parent) @@ -27,28 +26,17 @@ def tearDown(self) -> None: return super().tearDown() def _remove_output_files(self): - for filename in (rpi_output_file, rockpi_output_file): - if exists(filename): - unlink(filename) + if exists(output_file): + unlink(output_file) - def test_rpi_compose_output_is_valid(self): + def test_compose_output_is_valid(self): # Uncomment line below if want to test custom templates. # dc = DockerComposer(templates_folder=templates_folder) dc = DockerComposer() - dc.generate_compose_file('rpi', template_file, rpi_output_file) + dc.generate_compose_file(template_file, output_file) # On failure or non-zero return code this returns CalledProcessError # so if this runs without that, it's considered successful as # `docker-compose config -q` returns 1 on invalid config check_call( - f'docker-compose -f {rpi_output_file} config -q', shell=True) - - def test_rockpi_compose_output_is_valid(self): - dc = DockerComposer() - dc.generate_compose_file('rockpi', template_file, rockpi_output_file) - - # On failure or non-zero return code this returns CalledProcessError - # so if this runs without that, it's considered successful as - # `docker-compose config -q` returns 1 on invalid config - check_call( - f'docker-compose -f {rockpi_output_file} config -q', shell=True) + f'docker-compose -f {output_file} config -q', shell=True) From 6844d7764da58377d36144599209fbac3c6afa45 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Mon, 18 Apr 2022 14:04:22 +0300 Subject: [PATCH 12/26] Fixed: Port 1680 is not just for localhost --- README.md | 2 +- templates/docker-compose.template | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 03495131..83606f75 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Repo: [github.com/NebraLtd/hm-gatewayrs](https://github.com/NebraLtd/hm-gatewayr This container is the actual Helium Gateway-rs software (from upstream), with the required configuration files added. Gatewayrs container requires two IP ports exposed as default. -- [1680](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L18): For connecting to packet-forwarder over localhost (127.0.0.1) +- [1680](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L18): For connecting to packet-forwarder. - [4467](https://github.com/helium/gateway-rs/blob/d6e140fc8f102d2e1008ddf6d58cef32c4f60392/src/settings.rs#L22): For connecting to gRPC API over WAN. Both of these ports can be changed via settings (toml) file. diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 0cd3fea5..a0eccd91 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -5,7 +5,7 @@ services: gateway-config: image: nebraltd/hm-config:{{CONFIG_VERSION}} depends_on: - - gatewayrs + - helium-miner - diagnostics environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} @@ -24,7 +24,7 @@ services: packet-forwarder: image: nebraltd/hm-pktfwd:{{PKTFWD_VERSION}} depends_on: - - gatewayrs + - helium-miner restart: always privileged: true network_mode: host @@ -54,7 +54,7 @@ services: diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: - - gatewayrs + - helium-miner environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} From f33c1988594a6773089d55202769bb0457fafab4 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 29 Apr 2022 14:03:22 +0300 Subject: [PATCH 13/26] Fixed: Python test fail --- templates/docker-compose.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.template b/templates/docker-compose.template index a0eccd91..83319f67 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -38,7 +38,7 @@ services: - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} helium-miner: - image: nebraltd/hm-gatewayrs:{{GATEWAY_VERSION}} + image: nebraltd/hm-gatewayrs:{{GATEWAYRS_VERSION}} network_mode: host cap_add: - SYS_RAWIO From af3e3d5253a3d320640b79ebf63288b935d6aa19 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Thu, 5 May 2022 15:26:22 +0300 Subject: [PATCH 14/26] Fixed: Accidentally removed the docker subnet config in another PR --- templates/docker-compose.template | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 83319f67..67e483b7 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -91,3 +91,4 @@ networks: ipam: driver: default config: + - subnet: 172.20.0.0/16 From 83d28a44b1b260f9e00a3b75a2b394d3e3afe262 Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Fri, 13 Jan 2023 23:50:10 +0530 Subject: [PATCH 15/26] Revert "Merge pull request #577 from NebraLtd/pritam/light-hotspot-update" This reverts commit 3afdf480e4b1761bebeb81952cea08a6592ee946, reversing changes made to 7fe1e6c29efa3ccb939a52b642a175767a5b92da. --- .github/workflows/linter.yml | 2 +- .github/workflows/openfleet-file-update.yml | 38 +-- .github/workflows/push-to-prod-draft.yml | 147 ++------- .github/workflows/push-to-prod.yml | 147 ++------- .github/workflows/push-to-testnet-draft.yml | 85 +----- .github/workflows/push-to-testnet.yml | 84 +----- .github/workflows/python-tests.yml | 4 +- .github/workflows/security-audit.yml | 4 +- .github/workflows/update-gatewayrs.yml | 6 +- .github/workflows/update-production.yml | 4 +- README.md | 51 ---- balena/balena.yml.controllino | 17 +- balena/balena.yml.cotx | 14 +- balena/balena.yml.finestra | 14 +- balena/balena.yml.linxdot | 42 --- balena/balena.yml.linxdot-rkcm3 | 35 --- balena/balena.yml.og | 14 +- balena/balena.yml.pantherx1 | 42 --- balena/balena.yml.pisces | 14 +- balena/balena.yml.pycom | 44 --- balena/balena.yml.rak | 14 +- balena/balena.yml.raspi-indoor | 42 --- balena/balena.yml.raspi-outdoor | 42 --- balena/balena.yml.risinghf | 44 --- balena/balena.yml.rockpi-indoor | 35 --- balena/balena.yml.rockpi-outdoor | 35 --- balena/balena.yml.sensecap | 14 +- balena/balena.yml.syncrobit | 42 --- balena/balena.yml.syncrobit-rkcm3 | 35 --- balena/config/config.txt.controllino | 10 - balena/config/config.txt.pisces | 11 - balena/config/config.txt.pycom | 13 - balena/config/config.txt.rak | 10 - balena/config/config.txt.risinghf | 11 - balena/config/config.txt.sensecap | 9 - balena/workflows/build-open-fleet.yml | 281 ------------------ balena/workflows/update-action-prod.yml | 1 - balena/workflows/update-files.yml | 147 --------- .../config.txt.nebra-raspi => config.txt | 0 device-compose-files/docker-compose-pycom.yml | 110 ------- gen_docker_compose.py | 2 +- settings.ini | 32 +- 42 files changed, 73 insertions(+), 1675 deletions(-) delete mode 100644 balena/balena.yml.linxdot delete mode 100644 balena/balena.yml.linxdot-rkcm3 delete mode 100644 balena/balena.yml.pantherx1 delete mode 100644 balena/balena.yml.pycom delete mode 100644 balena/balena.yml.raspi-indoor delete mode 100644 balena/balena.yml.raspi-outdoor delete mode 100644 balena/balena.yml.risinghf delete mode 100644 balena/balena.yml.rockpi-indoor delete mode 100644 balena/balena.yml.rockpi-outdoor delete mode 100644 balena/balena.yml.syncrobit delete mode 100644 balena/balena.yml.syncrobit-rkcm3 delete mode 100644 balena/config/config.txt.controllino delete mode 100644 balena/config/config.txt.pisces delete mode 100644 balena/config/config.txt.pycom delete mode 100644 balena/config/config.txt.rak delete mode 100644 balena/config/config.txt.risinghf delete mode 100644 balena/config/config.txt.sensecap delete mode 100644 balena/workflows/build-open-fleet.yml delete mode 100644 balena/workflows/update-action-prod.yml delete mode 100644 balena/workflows/update-files.yml rename balena/config/config.txt.nebra-raspi => config.txt (100%) delete mode 100644 device-compose-files/docker-compose-pycom.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index fd896127..8bf8e388 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -36,7 +36,7 @@ jobs: # Checkout the code base # ########################## - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 diff --git a/.github/workflows/openfleet-file-update.yml b/.github/workflows/openfleet-file-update.yml index 5d679634..b85349ca 100644 --- a/.github/workflows/openfleet-file-update.yml +++ b/.github/workflows/openfleet-file-update.yml @@ -3,8 +3,7 @@ name: Update files in OpenFleets repos on: push: paths: - - "settings.ini" - - "balena/*" + - "balena/*.yml" - "device-compose-files/*.yml" workflow_dispatch: @@ -14,42 +13,11 @@ jobs: strategy: fail-fast: false matrix: - sbc: [rak, pisces, og, sensecap, finestra, controllino, cotx, pantherx1, linxdot, linxdot-rkcm3, pycom, syncrobit, syncrobit-rkcm3, risinghf] + sbc: [rak, pisces, og, sensecap, finestra, controllino, cotx] steps: - name: Trigger PR action in helium-${{ matrix.sbc }} repo - uses: peter-evans/repository-dispatch@v2 + uses: peter-evans/repository-dispatch@v1 with: token: ${{ secrets.MR_BUMP }} event-type: file-update repository: NebraLtd/helium-${{ matrix.sbc }} - - file-update-nebra: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sbc: [raspi, rockpi] - variant: [indoor, outdoor] - freq: [470, 868, 915] - exclude: - - sbc: rockpi - freq: 470 - - sbc: rockpi - freq: 868 - variant: outdoor - steps: - - name: Generate fleet name - run: | - if [ "${{ matrix.sbc }}" = "rockpi" ] ; then - FLEET="helium-${{ matrix.variant }}-${{ matrix.freq }}-${{ matrix.sbc }}" - else - FLEET="helium-${{ matrix.variant }}-${{ matrix.freq }}" - fi - - echo "FLEET=$FLEET" >> $GITHUB_ENV - - name: Trigger PR action in ${{ env.FLEET }} repo - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.MR_BUMP }} - event-type: file-update - repository: NebraLtd/${{ env.FLEET }} diff --git a/.github/workflows/push-to-prod-draft.yml b/.github/workflows/push-to-prod-draft.yml index 59763861..51b76edf 100644 --- a/.github/workflows/push-to-prod-draft.yml +++ b/.github/workflows/push-to-prod-draft.yml @@ -9,10 +9,9 @@ jobs: strategy: fail-fast: false matrix: - sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino, cotx, pantherx1, linxdot, linxdot-rkcm3, pycom, syncrobit, syncrobit-rkcm3, risinghf] + sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino, cotx] frequency: [470, 868, 915] variant: [indoor, outdoor] - commercial: [yes, no] exclude: - sbc: rak - sbc: pisces @@ -21,192 +20,80 @@ jobs: - sbc: finestra - sbc: controllino - sbc: cotx - - sbc: pantherx1 - - sbc: linxdot - - sbc: linxdot-rkcm3 - - sbc: syncrobit - - sbc: syncrobit-rkcm3 - - sbc: pycom - - sbc: risinghf - - sbc: rockpi - variant: outdoor - commercial: yes - - variant: indoor - commercial: yes - frequency: 470 - - sbc: raspi - commercial: yes - frequency: 470 include: - sbc: pisces variant: indoor frequency: 868 - commercial: no - sbc: rak variant: indoor frequency: 868 - commercial: no - sbc: og variant: indoor frequency: 868 - commercial: no - sbc: sensecap variant: indoor frequency: 868 - commercial: no - sbc: finestra variant: indoor frequency: 868 - commercial: no - sbc: controllino variant: indoor frequency: 868 - commercial: no - sbc: cotx variant: indoor frequency: 868 - commercial: no - - sbc: pantherx1 - variant: indoor - frequency: 868 - commercial: no - - sbc: linxdot - variant: indoor - frequency: 868 - commercial: no - - sbc: linxdot-rkcm3 - variant: indoor - frequency: 868 - commercial: no - - sbc: syncrobit - variant: indoor - frequency: 868 - commercial: no - - sbc: syncrobit-rkcm3 - variant: indoor - frequency: 868 - commercial: no - - sbc: pycom - variant: indoor - frequency: 868 - commercial: no - - sbc: risinghf - variant: indoor - frequency: 868 - commercial: no steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: ref: production - name: Export short SHA of current commit - shell: bash run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - - # Get the latest GA release and branch - source <(grep FIRMWARE_VERSION settings.ini) - LATEST_GA=$FIRMWARE_VERSION - GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - - if [ "${{ matrix.commercial }}" = "yes" ] ; then - echo " Deploying to commercial fleet!" - COMMERCIAL="-c" - fi - - echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV - echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - echo "COMMERCIAL=$COMMERCIAL" >> $GITHUB_ENV - name: Random sleep (balena API workaround) - run: sleep $[ ( $RANDOM % 540 ) + 1 ]s + run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - name: Generate Docker Compose for ROCK Pi if: matrix.sbc == 'rockpi' run: | python gen_docker_compose.py rockpi -o docker-compose.yml ROCKPI="-rockpi" echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - cp balena/balena.yml.${{ matrix.sbc }}-${{ matrix.variant }} balena.yml - name: Generate Docker Compose for Nebra RasPi if: matrix.sbc == 'raspi' run: | python gen_docker_compose.py rpi -o docker-compose.yml - cp balena/balena.yml.${{ matrix.sbc }}-${{ matrix.variant }} balena.yml - name: Generate Docker Compose for RAK and Non-Nebra RasPi - if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'risinghf' + if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' run: | python gen_docker_compose.py rpi -o docker-compose.yml cp balena/balena.yml.${{ matrix.sbc }} balena.yml - - name: Generate Docker Compose for Non-Nebra ROCK Pi - if: matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3' - run: | - python gen_docker_compose.py rockpi -o docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - cp balena/balena.yml.${{ matrix.sbc }} balena.yml - - name: Generate Docker Compose for Pycom - if: matrix.sbc == 'pycom' - run: | - python gen_docker_compose.py pycom -o docker-compose.yml - cp balena/balena.yml.pycom balena.yml - name: Generate Docker Compose for Pisces if: matrix.sbc == 'pisces' run: | python gen_docker_compose.py pisces -o docker-compose.yml cp balena/balena.yml.pisces balena.yml - name: Balena Deploy (Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'rockpi' && matrix.commercial == 'no' && success() + uses: nebraltd/balena-cli-action@v13.3.0 + if: matrix.sbc == 'rockpi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --debug --nocache --build --draft" + balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --logs --debug --nocache --build --draft" - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'raspi' && matrix.commercial == 'no' && success() + uses: nebraltd/balena-cli-action@v13.3.0 + if: matrix.sbc == 'raspi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --debug --nocache --build --draft" - - name: Balena Deploy (Nebra ROCK Pi Commercial) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'rockpi' && matrix.commercial == 'yes' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }}${{ env.COMMERCIAL }} --debug --nocache --build --draft" - - name: Balena Deploy (Nebra RasPi Commercial) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'raspi' && matrix.commercial == 'yes' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.COMMERCIAL }} --debug --nocache --build --draft" + balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build --draft" - name: Balena Deploy (RAK and Non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'risinghf' ) && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_4}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build --draft" - - name: Balena Deploy (Non-Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: ( matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3' ) && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_5}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build --draft" - - name: Balena Deploy (Pycom CM4) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'pycom' && success() + uses: nebraltd/balena-cli-action@v13.3.0 + if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' ) && success() with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_6}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build --draft" + balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} + balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build --draft" - name: Balena Deploy (Pisces P100) - uses: nebraltd/balena-cli-action@v15.0.0 + uses: nebraltd/balena-cli-action@v13.3.0 if: matrix.sbc == 'pisces' && success() with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_7}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build --draft" - - name: Trigger build action in helium-${{ matrix.sbc }} repo - uses: peter-evans/repository-dispatch@v2 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'pisces' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit' || matrix.sbc == 'syncrobit-rkcm3' || matrix.sbc == 'pycom' || matrix.sbc == 'risinghf' ) && success() - with: - token: ${{ secrets.MR_BUMP }} - event-type: build-open-fleet - repository: NebraLtd/helium-${{ matrix.sbc }} - client-payload: '{"release": "${{ env.LATEST_GA }}_GA", "tag": "${{ env.LATEST_GA }}"}' + balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} + balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build --draft" diff --git a/.github/workflows/push-to-prod.yml b/.github/workflows/push-to-prod.yml index f1f0a6ab..161a1eb9 100644 --- a/.github/workflows/push-to-prod.yml +++ b/.github/workflows/push-to-prod.yml @@ -12,10 +12,9 @@ jobs: strategy: fail-fast: false matrix: - sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino, cotx, pantherx1, linxdot, linxdot-rkcm3, pycom, syncrobit, syncrobit-rkcm3, risinghf] + sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino, cotx] frequency: [470, 868, 915] variant: [indoor, outdoor] - commercial: [yes, no] exclude: - sbc: rak - sbc: pisces @@ -24,190 +23,78 @@ jobs: - sbc: finestra - sbc: controllino - sbc: cotx - - sbc: pantherx1 - - sbc: linxdot - - sbc: linxdot-rkcm3 - - sbc: syncrobit - - sbc: syncrobit-rkcm3 - - sbc: pycom - - sbc: risinghf - - sbc: rockpi - variant: outdoor - commercial: yes - - variant: indoor - commercial: yes - frequency: 470 - - sbc: raspi - commercial: yes - frequency: 470 include: - sbc: pisces variant: indoor frequency: 868 - commercial: no - sbc: rak variant: indoor frequency: 868 - commercial: no - sbc: og variant: indoor frequency: 868 - commercial: no - sbc: sensecap variant: indoor frequency: 868 - commercial: no - sbc: finestra variant: indoor frequency: 868 - commercial: no - sbc: controllino variant: indoor frequency: 868 - commercial: no - sbc: cotx variant: indoor frequency: 868 - commercial: no - - sbc: pantherx1 - variant: indoor - frequency: 868 - commercial: no - - sbc: linxdot - variant: indoor - frequency: 868 - commercial: no - - sbc: linxdot-rkcm3 - variant: indoor - frequency: 868 - commercial: no - - sbc: syncrobit - variant: indoor - frequency: 868 - commercial: no - - sbc: syncrobit-rkcm3 - variant: indoor - frequency: 868 - commercial: no - - sbc: pycom - variant: indoor - frequency: 868 - commercial: no - - sbc: risinghf - variant: indoor - frequency: 868 - commercial: no steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v2 - name: Export short SHA of current commit - shell: bash run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - - # Get the latest GA release and branch - source <(grep FIRMWARE_VERSION settings.ini) - LATEST_GA=$FIRMWARE_VERSION - GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - - if [ "${{ matrix.commercial }}" = "yes" ] ; then - echo " Deploying to commercial fleet!" - COMMERCIAL="-c" - fi - - echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV - echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - echo "COMMERCIAL=$COMMERCIAL" >> $GITHUB_ENV - name: Random sleep (balena API workaround) - run: sleep $[ ( $RANDOM % 540 ) + 1 ]s + run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - name: Generate Docker Compose for ROCK Pi if: matrix.sbc == 'rockpi' run: | python gen_docker_compose.py rockpi -o docker-compose.yml ROCKPI="-rockpi" echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - cp balena/balena.yml.${{ matrix.sbc }}-${{ matrix.variant }} balena.yml - name: Generate Docker Compose for Nebra RasPi if: matrix.sbc == 'raspi' run: | python gen_docker_compose.py rpi -o docker-compose.yml - cp balena/balena.yml.${{ matrix.sbc }}-${{ matrix.variant }} balena.yml - name: Generate Docker Compose for RAK and Non-Nebra RasPi - if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'pycom' || matrix.sbc == 'risinghf' + if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' run: | python gen_docker_compose.py rpi -o docker-compose.yml cp balena/balena.yml.${{ matrix.sbc }} balena.yml - - name: Generate Docker Compose for Non-Nebra ROCK Pi - if: matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3' - run: | - python gen_docker_compose.py rockpi -o docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - cp balena/balena.yml.${{ matrix.sbc }} balena.yml - - name: Generate Docker Compose for Pycom - if: matrix.sbc == 'pycom' - run: | - python gen_docker_compose.py pycom -o docker-compose.yml - cp balena/balena.yml.pycom balena.yml - name: Generate Docker Compose for Pisces if: matrix.sbc == 'pisces' run: | python gen_docker_compose.py pisces -o docker-compose.yml cp balena/balena.yml.pisces balena.yml - name: Balena Deploy (Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'rockpi' && matrix.commercial == 'no' && success() + uses: nebraltd/balena-cli-action@v13.3.0 + if: matrix.sbc == 'rockpi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --debug --nocache --build" + balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --logs --debug --nocache --build" - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'raspi' && matrix.commercial == 'no' && success() + uses: nebraltd/balena-cli-action@v13.3.0 + if: matrix.sbc == 'raspi' && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --debug --nocache --build" - - name: Balena Deploy (Nebra ROCK Pi Commercial) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'rockpi' && matrix.commercial == 'yes' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }}${{ env.COMMERCIAL }} --debug --nocache --build" - - name: Balena Deploy (Nebra RasPi Commercial) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'raspi' && matrix.commercial == 'yes' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.COMMERCIAL }} --debug --nocache --build" + balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build" - name: Balena Deploy (RAK and Non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'risinghf' ) && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_4}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build" - - name: Balena Deploy (Non-Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: ( matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3' ) && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_5}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build" - - name: Balena Deploy (Pycom CM4) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'pycom' && success() + uses: nebraltd/balena-cli-action@v13.3.0 + if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' ) && success() with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_6}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build" + balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} + balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build" - name: Balena Deploy (Pisces P100) - uses: nebraltd/balena-cli-action@v15.0.0 + uses: nebraltd/balena-cli-action@v13.3.0 if: matrix.sbc == 'pisces' && success() with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_7}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --debug --nocache --build" - - name: Trigger build action in helium-${{ matrix.sbc }} repo - uses: peter-evans/repository-dispatch@v2 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'pisces' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit' || matrix.sbc == 'syncrobit-rkcm3' || matrix.sbc == 'pycom' || matrix.sbc == 'risinghf' ) && success() - with: - token: ${{ secrets.MR_BUMP }} - event-type: build-open-fleet - repository: NebraLtd/helium-${{ matrix.sbc }} - client-payload: '{"release": "${{ env.LATEST_GA }}_GA", "tag": "${{ env.LATEST_GA }}"}' + balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} + balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build" diff --git a/.github/workflows/push-to-testnet-draft.yml b/.github/workflows/push-to-testnet-draft.yml index 736b1831..55876dc0 100644 --- a/.github/workflows/push-to-testnet-draft.yml +++ b/.github/workflows/push-to-testnet-draft.yml @@ -8,93 +8,20 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, finestra, sensecap, og, controllino, pisces, cotx, pantherx1, linxdot, linxdot-rkcm3, syncrobit, syncrobit-rkcm3, pycom, risinghf] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v2 - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for RockPi and Non-Nebra ROCK Pi - if: matrix.sbc == 'rockpi' || matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3' + - name: Generate Docker Compose run: | - python gen_docker_compose.py rockpi -o device-compose-files/docker-compose-rockpi.yml - cp device-compose-files/docker-compose-rockpi.yml docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for RaspberryPi & RAK & Other RasPi based vendors - if: matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'risinghf' - run: | - python gen_docker_compose.py rpi -o device-compose-files/docker-compose-rpi.yml - cp device-compose-files/docker-compose-rpi.yml docker-compose.yml - - name: Generate Docker Compose for Pycom - if: matrix.sbc == 'pycom' - run: | - python gen_docker_compose.py pycom -o device-compose-files/docker-compose-pycom.yml - cp device-compose-files/docker-compose-pycom.yml docker-compose.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o device-compose-files/docker-compose-pisces.yml - cp device-compose-files/docker-compose-pisces.yml docker-compose.yml - - name: Balena Deploy (Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'rockpi' && success() + python gen_docker_compose.py -o docker-compose.yml + - name: Balena Deploy + uses: nebraltd/balena-cli-action@v13.3.0 with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --debug --nocache --build --draft" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-testnet --debug --nocache --build --draft" - - name: Balena Deploy (RAK and other non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: success() && (matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'pisces' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'pycom' || matrix.sbc == 'risinghf') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --debug --nocache --build --draft" - - name: Balena Deploy (Non-Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: success() && (matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --debug --nocache --build --draft" - - name: Push updated docker compose file (ROCK Pi) - if: (matrix.sbc == 'rockpi' || matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rockpi.yml - commit-msg: Update ROCK Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Nebra RasPi, RAK and other RasPi based vendors) - if: (matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'risinghf') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rpi.yml - commit-msg: Update Raspberry Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pycom) - if: matrix.sbc == 'pycom' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pycom.yml - commit-msg: Update Pycom docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pisces) - if: matrix.sbc == 'pisces' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pisces.yml - commit-msg: Update Pisces P100 docker compose output - github-token: ${{ secrets.MR_BUMP }} - + balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build --draft" diff --git a/.github/workflows/push-to-testnet.yml b/.github/workflows/push-to-testnet.yml index ff37aa85..eeb74c19 100644 --- a/.github/workflows/push-to-testnet.yml +++ b/.github/workflows/push-to-testnet.yml @@ -11,92 +11,20 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, finestra, sensecap, og, controllino, pisces, cotx, pantherx1, linxdot, linxdot-rkcm3, syncrobit, syncrobit-rkcm3, pycom, risinghf] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v2 - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for RockPi and Non-Nebra ROCK Pi - if: matrix.sbc == 'rockpi' || matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3' + - name: Generate Docker Compose run: | - python gen_docker_compose.py rockpi -o device-compose-files/docker-compose-rockpi.yml - cp device-compose-files/docker-compose-rockpi.yml docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for RaspberryPi & RAK & Other RasPi based vendors - if: matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'risinghf' - run: | - python gen_docker_compose.py rpi -o device-compose-files/docker-compose-rpi.yml - cp device-compose-files/docker-compose-rpi.yml docker-compose.yml - - name: Generate Docker Compose for Pycom - if: matrix.sbc == 'pycom' - run: | - python gen_docker_compose.py pycom -o device-compose-files/docker-compose-pycom.yml - cp device-compose-files/docker-compose-pycom.yml docker-compose.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o device-compose-files/docker-compose-pisces.yml - cp device-compose-files/docker-compose-pisces.yml docker-compose.yml - - name: Balena Deploy (Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'rockpi' && success() + python gen_docker_compose.py -o docker-compose.yml + - name: Balena Deploy + uses: nebraltd/balena-cli-action@v13.3.0 with: balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-testnet${{ env.ROCKPI }} --debug --nocache --build" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-testnet --debug --nocache --build" - - name: Balena Deploy (RAK and other non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: success() && (matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'pisces' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'pycom' || matrix.sbc == 'risinghf') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --debug --nocache --build" - - name: Balena Deploy (Non-Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v15.0.0 - if: success() && (matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3') - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} - balena_command: "deploy nebraltd/helium-testnet-${{ matrix.sbc }} --debug --nocache --build" - - name: Push updated docker compose file (ROCK Pi) - if: (matrix.sbc == 'rockpi' || matrix.sbc == 'linxdot-rkcm3' || matrix.sbc == 'syncrobit-rkcm3') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rockpi.yml - commit-msg: Update ROCK Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Nebra RasPi, RAK and other RasPi based vendors) - if: (matrix.sbc == 'raspi' || matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' || matrix.sbc == 'pantherx1' || matrix.sbc == 'linxdot' || matrix.sbc == 'syncrobit' || matrix.sbc == 'risinghf') && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-rpi.yml - commit-msg: Update Raspberry Pi docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pycom) - if: matrix.sbc == 'pycom' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pycom.yml - commit-msg: Update Pycom docker compose output - github-token: ${{ secrets.MR_BUMP }} - - name: Push updated docker compose file (Pisces) - if: matrix.sbc == 'pisces' && success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: device-compose-files/docker-compose-pisces.yml - commit-msg: Update Pisces P100 docker compose output - github-token: ${{ secrets.MR_BUMP }} + balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build" diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 4759bc7b..04fd6cd8 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -7,9 +7,9 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 - name: Set up Python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v1 with: python-version: 3.8 - name: Run PyTest diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 0276aee4..6ac49b13 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 - name: Set up Python 3.8 - uses: actions/setup-python@v4 + uses: actions/setup-python@v1 with: python-version: 3.8 - name: Run bandit against code base diff --git a/.github/workflows/update-gatewayrs.yml b/.github/workflows/update-gatewayrs.yml index 45fedbf4..8c260503 100644 --- a/.github/workflows/update-gatewayrs.yml +++ b/.github/workflows/update-gatewayrs.yml @@ -6,8 +6,8 @@ jobs: gatewayrs-update: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: + - uses: actions/checkout@v2 + with: ref: ${{ github.ref }} - run: | LATEST_GA=${{ github.event.client_payload.tag }} @@ -20,7 +20,7 @@ jobs: sed -i -E "s/FIRMWARE_VERSION=.*/FIRMWARE_VERSION=$LATEST_GA/g" settings.ini sed -i -E "s/GATEWAYRS_VERSION=.*/GATEWAYRS_VERSION=$SHORT_SHA/g" settings.ini - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v3 with: commit-message: Update Gateway-rs to latest GA ${{ env.LATEST_GA }} branch: gatewayrs-bump/${{ env.LATEST_GA }} diff --git a/.github/workflows/update-production.yml b/.github/workflows/update-production.yml index 97d3c40b..9c8756d1 100644 --- a/.github/workflows/update-production.yml +++ b/.github/workflows/update-production.yml @@ -10,7 +10,7 @@ jobs: if: github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 with: ref: ${{ github.ref }} fetch-depth: 0 @@ -32,7 +32,7 @@ jobs: fi - name: Create Pull Request if: env.UPDATED == 'true' - uses: devops-infra/action-pull-request@v0.5.3 + uses: devops-infra/action-pull-request@v0.4.2 with: source_branch: master target_branch: production diff --git a/README.md b/README.md index ef13a25a..83606f75 100644 --- a/README.md +++ b/README.md @@ -136,57 +136,6 @@ This can either be done manually by someone with the right privileges on our bal Once this has completed and the draft builds have been pushed to balena, you will need to either finalise the releases using balena CLI locally, or visit the releases menu of each fleet with a draft release, click on the release and then select `Finalize Release` from the dropdown menu. -# [BalenaHub](https://hub.balena.io) builds (OpenFleets) for Nebra and third party Helium Miners - -We are passionate about open source hardware and software and so we have put significant time and effort into making our software hardware agnostic, and a number of Helium manufacturers already use parts of our software on their devices. On that note, we maintain a variety of fully open source software builds for third party Helium Miners, as well as our Nebra miners. If you follow the links to the various repos below, you can find the builds and detailed instructions on how to deploy them on your [Nebra](#nebra-build-repos) or [third party hotspot miner](#third-party-build-repos). - -Not only does this further decentralise the software stack, but also future proofs the Helium network and the hotspot owners from their devices becoming obsolete from manufacturers going bankrupt or being unreliable with ongoing updates. - -This is the same full featured software that we run natively on our Nebra Helium Miners... - -**Key features:** - -- local IP diagnostics dashboard -- updated regularly (our automated system means this will get updates at the same time as the entire Nebra fleet) -- automatic updates (if installed via [balenaHub](https://hub.balena.io)) or option to fork and manage your own fleet -- powered by [balenaOS](https://balena.io/os) which is optimised for edge devices and very secure -- access to new features as added to the core Nebra software -- fully open source software stack (the only one in the Helium community!) -- COMING SOON: access to [remote management dashboard](https://dashboard.nebra.com) (paid extra) - -In the future, we also plan to add [Nebra dashboard](https://dashboard.nebra.com) support for third party miners. We also plan to apply for a Helium Foundation grant in order to expand this effort further, improve the software and add all currently available Helium Miners to the mix. - -**If you have found this software useful we would be very grateful if you would consider [sponsoring the project via GitHub Sponsors](https://github.com/sponsors/NebraLtd) as this will enable us to continue supporting this software into the future.** - -### Nebra build repos - -- [Indoor 470](https://github.com/NebraLtd/helium-indoor-470) -- [Indoor 868](https://github.com/NebraLtd/helium-indoor-868) -- [Indoor 915](https://github.com/NebraLtd/helium-indoor-915) -- [Outdoor 470](https://github.com/NebraLtd/helium-outdoor-470) -- [Outdoor 868](https://github.com/NebraLtd/helium-outdoor-868) -- [Outdoor 915](https://github.com/NebraLtd/helium-outdoor-915) -- [ROCK Pi Indoor 868](https://github.com/NebraLtd/helium-indoor-868-rockpi) -- [ROCK Pi Indoor 915](https://github.com/NebraLtd/helium-indoor-915-rockpi) -- [ROCK Pi Outdoor 915](https://github.com/NebraLtd/helium-outdoor-915-rockpi) - -### Third party build repos - -- [RAKwireless / MNTD (RAK v1.5, RAK v2, MNTD)](https://github.com/NebraLtd/helium-rak) -- [Sensecap (M1)](https://github.com/NebraLtd/helium-sensecap) -- [Controllino / Conelcom](https://github.com/NebraLtd/helium-controllino) -- [Pisces (P100)](https://github.com/NebraLtd/helium-pisces) -- [Linxdot (RasPi CM4 version)](https://github.com/NebraLtd/helium-linxdot) -- [Linxdot (ROCK / Radxa CM3 version)](https://github.com/NebraLtd/helium-linxdot-rkcm3) -- [Helium OG (RasPi 3 and RasPi 4 version)](https://github.com/NebraLtd/helium-og) -- [Pycom (RasPi CM4 version)](https://github.com/NebraLtd/helium-pycom) -- [Cotx (X3)](https://github.com/NebraLtd/helium-cotx) -- [Syncrobit (RasPi CM4 version)](https://github.com/NebraLtd/helium-syncrobit) -- [Syncrobit (ROCK / Radxa CM3 version)](https://github.com/NebraLtd/helium-syncrobit-rkcm3) -- [Panther (X1)](https://github.com/NebraLtd/helium-pantherx1) -- [Finestra / Mimiq](https://github.com/NebraLtd/helium-finestra) -- [Rising HF](https://github.com/NebraLtd/helium-risinghf) - # Production Checks @TODO: diff --git a/balena/balena.yml.controllino b/balena/balena.yml.controllino index 04b3bf24..a38eb354 100644 --- a/balena/balena.yml.controllino +++ b/balena/balena.yml.controllino @@ -1,7 +1,7 @@ name: nebra-helium-controllino type: sw.application description: >- - Manage your Controllino or Conelcom Helium Miner remotely using Nebra and balenaCloud. + Manage your Controllino Helium Miner remotely using Nebra and balenaCloud. post-provisioning: >- ## Usage instructions @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Controllino check out [our GitHub repo](https://github.com/NebraLtd/helium-controllino). - For support you can [open an issue](https://github.com/NebraLtd/helium-controllino/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). + For support you can [open an issue](https://github.com/NebraLtd/helium-controllino/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). assets: repository: type: blob.asset @@ -24,19 +24,6 @@ assets: url: >- https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 data: - applicationEnvironmentVariables: - - VARIANT: COMP-CONTROLLINO - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_HOST_CONFIG_gpio: '"17=op,dh"' - - RESIN_OVERRIDE_LOCK: 1 defaultDeviceType: raspberrypi4-64 supportedDeviceTypes: - raspberrypi4-64 diff --git a/balena/balena.yml.cotx b/balena/balena.yml.cotx index 236e280e..de1f59e1 100644 --- a/balena/balena.yml.cotx +++ b/balena/balena.yml.cotx @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium COTX check out [our GitHub repo](https://github.com/NebraLtd/helium-cotx). - For support you can [open an issue](https://github.com/NebraLtd/helium-cotx/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). + For support you can [open an issue](https://github.com/NebraLtd/helium-cotx/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). assets: repository: type: blob.asset @@ -24,18 +24,6 @@ assets: url: >- https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 data: - applicationEnvironmentVariables: - - VARIANT: COMP-COTX3 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 defaultDeviceType: raspberrypi4-64 supportedDeviceTypes: - raspberrypi4-64 diff --git a/balena/balena.yml.finestra b/balena/balena.yml.finestra index b3c3b3fb..4154531a 100644 --- a/balena/balena.yml.finestra +++ b/balena/balena.yml.finestra @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Finestra check out [our GitHub repo](https://github.com/NebraLtd/helium-finestra). - For support you can [open an issue](https://github.com/NebraLtd/helium-finestra/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). + For support you can [open an issue](https://github.com/NebraLtd/helium-finestra/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). assets: repository: type: blob.asset @@ -24,18 +24,6 @@ assets: url: >- https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 data: - applicationEnvironmentVariables: - - VARIANT: COMP-FINESTRA - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 defaultDeviceType: raspberrypi4-64 supportedDeviceTypes: - raspberrypi4-64 diff --git a/balena/balena.yml.linxdot b/balena/balena.yml.linxdot deleted file mode 100644 index c31cc311..00000000 --- a/balena/balena.yml.linxdot +++ /dev/null @@ -1,42 +0,0 @@ -name: nebra-helium-linxdot -type: sw.application -description: >- - Manage your Linxdot CM4 Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium Linxdot check out [our GitHub repo](https://github.com/NebraLtd/helium-linxdot). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-linxdot/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-linxdot" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: COMP-LINXDOTCM4 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: raspberrypicm4-ioboard - supportedDeviceTypes: - - raspberrypicm4-ioboard -version: 0.0.1 diff --git a/balena/balena.yml.linxdot-rkcm3 b/balena/balena.yml.linxdot-rkcm3 deleted file mode 100644 index 6276aa08..00000000 --- a/balena/balena.yml.linxdot-rkcm3 +++ /dev/null @@ -1,35 +0,0 @@ -name: nebra-helium-linxdot-rkcm3 -type: sw.application -description: >- - Manage your Linxdot ROCK CM3 Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium Linxdot ROCK CM3 check out [our GitHub repo](https://github.com/NebraLtd/helium-linxdot-rkcm3). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-linxdot-rkcm3/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-linxdot-rkcm3" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: COMP-LINXDOTRKCM3 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: rockpicm3-ioboard - supportedDeviceTypes: - - rockpicm3-ioboard -version: 0.0.1 diff --git a/balena/balena.yml.og b/balena/balena.yml.og index 74843619..b69c787a 100644 --- a/balena/balena.yml.og +++ b/balena/balena.yml.og @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium OG check out [our GitHub repo](https://github.com/NebraLtd/helium-og). - For support you can [open an issue](https://github.com/NebraLtd/helium-og/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). + For support you can [open an issue](https://github.com/NebraLtd/helium-og/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). assets: repository: type: blob.asset @@ -24,18 +24,6 @@ assets: url: >- https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 data: - applicationEnvironmentVariables: - - VARIANT: COMP-HELIUM - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs","vc4-kms-v3d"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 defaultDeviceType: raspberrypi4-64 supportedDeviceTypes: - raspberrypi4-64 diff --git a/balena/balena.yml.pantherx1 b/balena/balena.yml.pantherx1 deleted file mode 100644 index 0b9ba0ff..00000000 --- a/balena/balena.yml.pantherx1 +++ /dev/null @@ -1,42 +0,0 @@ -name: nebra-helium-pantherx1 -type: sw.application -description: >- - Manage your Panther X1 Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium Panther X1 check out [our GitHub repo](https://github.com/NebraLtd/helium-pantherx1). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-pantherx1/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-pantherx1" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: COMP-PANTHERX1 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: raspberrypi4-64 - supportedDeviceTypes: - - raspberrypi4-64 -version: 0.0.1 diff --git a/balena/balena.yml.pisces b/balena/balena.yml.pisces index 714dd6e4..28cb384c 100644 --- a/balena/balena.yml.pisces +++ b/balena/balena.yml.pisces @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Pisces check out [our GitHub repo](https://github.com/NebraLtd/helium-pisces). - For support you can [open an issue](https://github.com/NebraLtd/helium-pisces/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). + For support you can [open an issue](https://github.com/NebraLtd/helium-pisces/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). assets: repository: type: blob.asset @@ -24,18 +24,6 @@ assets: url: >- https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 data: - applicationEnvironmentVariables: - - VARIANT: COMP-PISCESP100 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on","i2c_vc=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 defaultDeviceType: raspberrypi4-64 supportedDeviceTypes: - raspberrypi4-64 diff --git a/balena/balena.yml.pycom b/balena/balena.yml.pycom deleted file mode 100644 index 01470581..00000000 --- a/balena/balena.yml.pycom +++ /dev/null @@ -1,44 +0,0 @@ -name: nebra-helium-pycom -type: sw.application -description: >- - Manage your Pycom CM4 Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium Pycom check out [our GitHub repo](https://github.com/NebraLtd/helium-pycom). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-pycom/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-pycom" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: COMP-PYCOM - - SX125x_RESET_PIN_OVERRIDE: 2 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on","i2c_vc=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_HOST_CONFIG_gpio: '"25=op,dh","13=op,dh"' - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: raspberrypicm4-ioboard - supportedDeviceTypes: - - raspberrypicm4-ioboard -version: 0.0.1 diff --git a/balena/balena.yml.rak b/balena/balena.yml.rak index 0a5a3aba..8ee5c789 100644 --- a/balena/balena.yml.rak +++ b/balena/balena.yml.rak @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium RAK check out [our GitHub repo](https://github.com/NebraLtd/helium-rak). - For support you can [open an issue](https://github.com/NebraLtd/helium-rak/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). + For support you can [open an issue](https://github.com/NebraLtd/helium-rak/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). assets: repository: type: blob.asset @@ -24,18 +24,6 @@ assets: url: >- https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 data: - applicationEnvironmentVariables: - - VARIANT: COMP-RAKHM - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs","vc4-kms-v3d"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 defaultDeviceType: raspberrypi4-64 supportedDeviceTypes: - raspberrypi4-64 diff --git a/balena/balena.yml.raspi-indoor b/balena/balena.yml.raspi-indoor deleted file mode 100644 index 02de88c5..00000000 --- a/balena/balena.yml.raspi-indoor +++ /dev/null @@ -1,42 +0,0 @@ -name: nebra-helium-raspi-indoor -type: sw.application -description: >- - Manage your Nebra Indoor RasPi Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium RasPi Indoor check out [our GitHub repo](https://github.com/NebraLtd/helium-miner-software). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-miner-software/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-miner-software" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: NEBHNT-IN1 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi1-3cs","vc4-kms-v3d","uart0,txd0_pin=32,rxd0_pin=33,pin_func=7"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 250 - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: raspberrypi3-64 - supportedDeviceTypes: - - raspberrypi3-64 -version: 0.0.1 diff --git a/balena/balena.yml.raspi-outdoor b/balena/balena.yml.raspi-outdoor deleted file mode 100644 index a5fa2195..00000000 --- a/balena/balena.yml.raspi-outdoor +++ /dev/null @@ -1,42 +0,0 @@ -name: nebra-helium-raspi-outdoor -type: sw.application -description: >- - Manage your Nebra Outdoor RasPi Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium RasPi Outdoor check out [our GitHub repo](https://github.com/NebraLtd/helium-miner-software). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-miner-software/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-miner-software" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: NEBHNT-OUT1 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi1-3cs","vc4-kms-v3d","uart0,txd0_pin=32,rxd0_pin=33,pin_func=7"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 250 - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: raspberrypi3-64 - supportedDeviceTypes: - - raspberrypi3-64 -version: 0.0.1 diff --git a/balena/balena.yml.risinghf b/balena/balena.yml.risinghf deleted file mode 100644 index 5e16096c..00000000 --- a/balena/balena.yml.risinghf +++ /dev/null @@ -1,44 +0,0 @@ -name: nebra-helium-risinghf -type: sw.application -description: >- - Manage your Rising HF Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium Rising HF check out [our GitHub repo](https://github.com/NebraLtd/helium-risinghf). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-risinghf/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-risinghf" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: COMP-RISINGHF - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on","watchdog=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi1-1cs","vc4-kms-v3d","uart1,txd1_pin=32,rxd1_pin=33","sdio,poll_once=off"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_HOST_CONFIG_max_framebuffers: 2 - - RESIN_HOST_CONFIG_arm_64bit: 1 - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: raspberrypi3-64 - supportedDeviceTypes: - - raspberrypi3-64 -version: 0.0.1 diff --git a/balena/balena.yml.rockpi-indoor b/balena/balena.yml.rockpi-indoor deleted file mode 100644 index 34d13fb7..00000000 --- a/balena/balena.yml.rockpi-indoor +++ /dev/null @@ -1,35 +0,0 @@ -name: nebra-helium-rockpi-indoor -type: sw.application -description: >- - Manage your Nebra Indoor ROCK Pi Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium ROCK Pi Indoor check out [our GitHub repo](https://github.com/NebraLtd/helium-miner-software). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-miner-software/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-miner-software" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: NEBHNT-HHRK4 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: rockpi-4b-rk3399 - supportedDeviceTypes: - - rockpi-4b-rk3399 -version: 0.0.1 diff --git a/balena/balena.yml.rockpi-outdoor b/balena/balena.yml.rockpi-outdoor deleted file mode 100644 index 50194d35..00000000 --- a/balena/balena.yml.rockpi-outdoor +++ /dev/null @@ -1,35 +0,0 @@ -name: nebra-helium-rockpi-outdoor -type: sw.application -description: >- - Manage your Nebra Outdoor ROCK Pi Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium ROCK Pi Outdoor check out [our GitHub repo](https://github.com/NebraLtd/helium-miner-software). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-miner-software/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-miner-software" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: NEBHNT-OUT1 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: rockpi-4b-rk3399 - supportedDeviceTypes: - - rockpi-4b-rk3399 -version: 0.0.1 diff --git a/balena/balena.yml.sensecap b/balena/balena.yml.sensecap index 14329427..3b6ab148 100644 --- a/balena/balena.yml.sensecap +++ b/balena/balena.yml.sensecap @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Sensecap check out [our GitHub repo](https://github.com/NebraLtd/helium-sensecap). - For support you can [open an issue](https://github.com/NebraLtd/helium-sensecap/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). + For support you can [open an issue](https://github.com/NebraLtd/helium-sensecap/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). assets: repository: type: blob.asset @@ -24,18 +24,6 @@ assets: url: >- https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 data: - applicationEnvironmentVariables: - - VARIANT: COMP-SENSECAPM1 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 defaultDeviceType: raspberrypi4-64 supportedDeviceTypes: - raspberrypi4-64 diff --git a/balena/balena.yml.syncrobit b/balena/balena.yml.syncrobit deleted file mode 100644 index edc36d04..00000000 --- a/balena/balena.yml.syncrobit +++ /dev/null @@ -1,42 +0,0 @@ -name: nebra-helium-syncrobit -type: sw.application -description: >- - Manage your Syncrobit CM4 Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium Syncrobit check out [our GitHub repo](https://github.com/NebraLtd/helium-syncrobit). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-syncrobit/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-syncrobit" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: COMP-SYNCROBITCM4 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_HOST_CONFIG_dtparam: '"i2c_arm=on","spi=on","audio=on"' - - RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs"' - - RESIN_HOST_CONFIG_gpu_mem: 16 - - RESIN_HOST_CONFIG_avoid_warnings: 1 - - RESIN_HOST_CONFIG_disable_overscan: 1 - - RESIN_HOST_CONFIG_disable_splash: "1" - - RESIN_HOST_CONFIG_core_freq: 400 - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: raspberrypicm4-ioboard - supportedDeviceTypes: - - raspberrypicm4-ioboard -version: 0.0.1 diff --git a/balena/balena.yml.syncrobit-rkcm3 b/balena/balena.yml.syncrobit-rkcm3 deleted file mode 100644 index a5b360df..00000000 --- a/balena/balena.yml.syncrobit-rkcm3 +++ /dev/null @@ -1,35 +0,0 @@ -name: nebra-helium-syncrobit-rkcm3 -type: sw.application -description: >- - Manage your Syncrobit ROCK CM3 Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium Syncrobit ROCK CM3 check out [our GitHub repo](https://github.com/NebraLtd/helium-syncrobit-rkcm3). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-syncrobit-rkcm3/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-syncrobit-rkcm3" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - applicationEnvironmentVariables: - - VARIANT: COMP-SYNCROBITRKCM3 - - HELIUM_MINER_HEIGHT_URL: "https://api.helium.io/v1/blocks/height" - applicationConfigVariables: - - RESIN_OVERRIDE_LOCK: 1 - defaultDeviceType: rockpicm3-ioboard - supportedDeviceTypes: - - rockpicm3-ioboard -version: 0.0.1 diff --git a/balena/config/config.txt.controllino b/balena/config/config.txt.controllino deleted file mode 100644 index aecee5e0..00000000 --- a/balena/config/config.txt.controllino +++ /dev/null @@ -1,10 +0,0 @@ -core_freq=400 -dtoverlay=spi0-1cs -dtparam=i2c_arm=on -dtparam=spi=on -dtparam=audio=on -avoid_warnings=1 -disable_overscan=1 -disable_splash=1 -gpu_mem=16 -gpio=17=op,dh diff --git a/balena/config/config.txt.pisces b/balena/config/config.txt.pisces deleted file mode 100644 index 575eff9a..00000000 --- a/balena/config/config.txt.pisces +++ /dev/null @@ -1,11 +0,0 @@ -core_freq=400 -dtoverlay=spi0-1cs -dtoverlay=vc4-fkms-v3d -dtparam=i2c_arm=on -dtparam=spi=on -dtparam=audio=on -dtparam=i2c_vc=on -avoid_warnings=1 -disable_overscan=1 -disable_splash=1 -gpu_mem=16 diff --git a/balena/config/config.txt.pycom b/balena/config/config.txt.pycom deleted file mode 100644 index a57b36eb..00000000 --- a/balena/config/config.txt.pycom +++ /dev/null @@ -1,13 +0,0 @@ -core_freq=400 -dtoverlay=spi0-1cs -dtoverlay=vc4-fkms-v3d -dtparam=i2c_arm=on -dtparam=spi=on -dtparam=audio=on -dtparam=i2c_vc=on -avoid_warnings=1 -disable_overscan=1 -disable_splash=1 -gpu_mem=16 -gpio=25=op,dh -gpio=13=op,dh diff --git a/balena/config/config.txt.rak b/balena/config/config.txt.rak deleted file mode 100644 index 70ca46e3..00000000 --- a/balena/config/config.txt.rak +++ /dev/null @@ -1,10 +0,0 @@ -core_freq=400 -dtoverlay=spi0-1cs -dtoverlay=vc4-fkms-v3d -dtparam=i2c_arm=on -dtparam=spi=on -dtparam=audio=on -avoid_warnings=1 -disable_overscan=1 -disable_splash=1 -gpu_mem=16 diff --git a/balena/config/config.txt.risinghf b/balena/config/config.txt.risinghf deleted file mode 100644 index 8caf1907..00000000 --- a/balena/config/config.txt.risinghf +++ /dev/null @@ -1,11 +0,0 @@ -dtoverlay=vc4-kms-v3d -max_framebuffers=2 -arm_64bit=1 -dtparam=i2c_arm=on -dtoverlay=uart1,txd1_pin=32,rxd1_pin=33 -core_freq=400 -dtoverlay=sdio,poll_once=off -dtparam=watchdog=on -dtparam=spi=on -dtparam=audio=on -dtoverlay=spi1-1cs diff --git a/balena/config/config.txt.sensecap b/balena/config/config.txt.sensecap deleted file mode 100644 index b48c97aa..00000000 --- a/balena/config/config.txt.sensecap +++ /dev/null @@ -1,9 +0,0 @@ -core_freq=400 -dtoverlay=spi0-1cs -dtparam=i2c_arm=on -dtparam=spi=on -dtparam=audio=on -avoid_warnings=1 -disable_overscan=1 -disable_splash=1 -gpu_mem=16 diff --git a/balena/workflows/build-open-fleet.yml b/balena/workflows/build-open-fleet.yml deleted file mode 100644 index 8724edff..00000000 --- a/balena/workflows/build-open-fleet.yml +++ /dev/null @@ -1,281 +0,0 @@ -name: Build and Preload OpenFleet - -on: - repository_dispatch: - types: [build-open-fleet] - workflow_dispatch: - -env: - balena-cli: v15.0.0 - raspberrypi3-64: 2022.10.0 - raspberrypi4-64: 2022.10.0 - raspberrypicm4-ioboard: 2.88.4+rev0 - rockpi-4b-rk3399: 2022.4.2 - -jobs: - build-open-fleet: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v3 - with: - ref: master - - - name: Determine if Raspberry Pi 3 - run: | - repo="${{ github.event.repository.name }}" - - if grep -q "-rockpi" <<<"$repo"; then - echo "Not RasPi 3" - RASPI3="NO" - ROCKPI="YES" - elif grep -q "outdoor" <<<"$repo"; then - echo "RasPi Outdoor" - RASPI3="YES" - ROCKPI="NO" - elif grep -q "indoor" <<<"$repo"; then - echo "RasPi Indoor" - RASPI3="YES" - ROCKPI="NO" - elif grep -q "risinghf" <<<"$repo"; then - echo "RisingHF" - RASPI3="YES" - ROCKPI="NO" - else - echo "Not RasPi 3" - RASPI3="NO" - ROCKPI="NO" - fi - - echo "RASPI3=$RASPI3" >> $GITHUB_ENV - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - - name: Random sleep (balena API workaround) - run: sleep $[ ( $RANDOM % 540 ) + 1 ]s - - - name: Install latest balena-cli (raspi 3) - if: env.RASPI3 == 'YES' - run: | - sudo apt-get update - sudo apt-get install -y curl unzip zip lxc libarchive-tools aufs-tools - sudo modprobe aufs - cd /opt/ - echo "Uses Balena CLI version: ${{ env.balena-cli }}" - cat /etc/docker/daemon.json - echo "$(grep aufs /proc/filesystems)" - echo "$(docker info)" - curl -O -sSL "https://github.com/balena-io/balena-cli/releases/download/${{ env.balena-cli }}/balena-cli-${{ env.balena-cli }}-linux-x64-standalone.zip" - unzip balena-cli-*-linux-x64-standalone.zip - sudo ln -s /opt/balena-cli/balena /usr/bin/ - cd ~ - - - name: Install latest balena-cli (rockpi, raspi4) - if: env.RASPI3 == 'NO' - run: | - sudo apt-get update - sudo apt-get install -y curl unzip zip - cd /opt/ - echo "Uses Balena CLI version: ${{ env.balena-cli }}" - curl -O -sSL "https://github.com/balena-io/balena-cli/releases/download/${{ env.balena-cli }}/balena-cli-${{ env.balena-cli }}-linux-x64-standalone.zip" - unzip balena-cli-*-linux-x64-standalone.zip - sudo ln -s /opt/balena-cli/balena /usr/bin/ - cd ~ - - - name: Balena login - run: | - if [ ${{ env.RASPI3 }} == 'YES' ] ; then - balena login --token ${{ secrets.BALENA_API_TOKEN }} > /dev/null - elif [ ${{ github.event.repository.name }} == 'helium-syncrobit' ] || [ ${{ github.event.repository.name }} == 'helium-linxdot' ] || [ ${{ github.event.repository.name }} == 'helium-pycom' ] ; then - balena login --token ${{ secrets.BALENA_API_TOKEN_2 }} > /dev/null - elif [ ${{ env.ROCKPI }} == 'YES' ] ; then - balena login --token ${{ secrets.BALENA_API_TOKEN_3 }} > /dev/null - else - balena login --token ${{ secrets.BALENA_API_TOKEN_4 }} > /dev/null - fi - - - name: Generate a Balena OS image for the given board, variant, frequency - run: | - LATEST_GA=${{ github.event.client_payload.tag }} - if [ $LATEST_GA != "" ] ; then - echo "New releae pushed to main repo: $LATEST_GA" - echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV - else - echo "No release version provided! Applying tag TEST" - echo "LATEST_GA=TEST" >> $GITHUB_ENV - fi - - IMAGE_BASE_PATH="$HOME/images" - DATE=$(date +%F) - USER="" - NODRYRUN=true - VERBOSE=true - - # Make the base path for the generated images. - mkdir -p "$IMAGE_BASE_PATH" - - # Print the parameters for generating images. - - if [[ $USER != "" ]]; then - echo " - user: ${USER}" - fi - - if [[ $NODRYRUN == false ]]; then - echo "(Dryrun mode enabled)" - fi - - if $VERBOSE ; then - echo "(Verbose mode enabled)" - fi - - # Download balena OS - - if [ ${{ env.RASPI3 }} == 'YES' ] ; then - balena_os="raspberrypi3-64" - balena_os_version="${{ env.raspberrypi3-64 }}" - elif [ ${{ github.event.repository.name }} == 'helium-syncrobit' ] || [ ${{ github.event.repository.name }} == 'helium-linxdot' ] || [ ${{ github.event.repository.name }} == 'helium-pycom' ] ; then - balena_os="raspberrypicm4-ioboard" - balena_os_version="${{ env.raspberrypicm4-ioboard }}" - elif [ ${{ env.ROCKPI }} == 'YES' ] ; then - balena_os="rockpi-4b-rk3399" - balena_os_version="${{ env.rockpi-4b-rk3399 }}" - else - balena_os="raspberrypi4-64" - balena_os_version="${{ env.raspberrypi4-64 }}" - fi - - base_image_path="$IMAGE_BASE_PATH/balena-base-${{ github.event.repository.name }}.img" - - if $VERBOSE ; then - echo -e "Downloading image ${balena_os} for version ${balena_os_version} and writing to ${base_image_path}" - fi - - if $NODRYRUN ; then - # Download the base image - balena os download "$balena_os" \ - -o "$base_image_path" \ - --version "$balena_os_version" - fi - - # Generate image path for the given board, variant, frequency and user - - fleet_name="${{ github.event.repository.name }}" - image_name="${fleet_name}-${DATE}" - image_path="${IMAGE_BASE_PATH}/${image_name}.img" - - # Minimum output - echo "Generating image for ${fleet_name} fleet" - - if $VERBOSE ; then - echo "Image path is ${image_path}" - fi - - # Configure balena OS image - - if $VERBOSE ; then - echo "Configuring image" - fi - - # Copy base balena image to target image - if $NODRYRUN ; then - cp "$base_image_path" "$image_path" - fi - - if $NODRYRUN ; then - balena os configure "$image_path" \ - --fleet "nebraltd/$fleet_name" \ - --config-network ethernet \ - --version "$balena_os_version" - fi - - if $VERBOSE ; then - echo "Pre-loading apps" - fi - - # Preload balena OS image - - if $NODRYRUN ; then - balena preload "$image_path" \ - --pin-device-to-release \ - --fleet "nebraltd/$fleet_name" \ - -c "current" - fi - - # Copy configuration files into boot and root partition of the balena image - - if $VERBOSE ; then - echo "Copying configuration files..." - fi - - if $NODRYRUN ; then - if [ -f "./config.txt" ] ; then - echo "Config.txt file found..." - mountpoints=/tmp/balena-image-mountpoints - balena_image_boot_mnt=${mountpoints}/resin-boot - - # Setup mountpoints - sudo rm -rf $mountpoints > /dev/null 2>&1 || true - sudo mkdir -p $balena_image_boot_mnt - - balena_image_loop_dev="$(sudo losetup -fP --show "$image_path")" - - sudo mount "${balena_image_loop_dev}p1" "$balena_image_boot_mnt" - sudo cp "./config.txt" "$balena_image_boot_mnt/config.txt" - - sleep 5 # Waits 5 seconds. - - # Cleanup - sudo umount "$balena_image_boot_mnt" - sudo losetup -d "$balena_image_loop_dev" - else - echo "Config.txt file not found..." - fi - fi - - # Compress Balena image file and generate SHA512 checksum file - # Make the compressed file name from the image file name - - compressed_image_path=${image_path/img/zip} - - if $VERBOSE ; then - echo "Compressing image" - fi - - if $NODRYRUN ; then - zip -9 -j "$compressed_image_path" "$image_path" - fi - - if $VERBOSE ; then - echo "Generating checkum" - fi - - if $NODRYRUN ; then - sha512sum "$compressed_image_path" > "$compressed_image_path.sha512" - fi - - # Export image name and compressed image path to the environment - export IMAGE_NAME="$image_name" - export COMPRESSED_IMAGE_PATH="$compressed_image_path" - - echo "Image Name: ${IMAGE_NAME}" - echo "Compressed Image Path: ${COMPRESSED_IMAGE_PATH}" - echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV - echo "COMPRESSED_IMAGE_PATH=${COMPRESSED_IMAGE_PATH}" >> $GITHUB_ENV - - - name: Set date - run: | - echo "timestamp=$(date +'%s')" >> $GITHUB_ENV - echo "day=$(date +'%F')" >> $GITHUB_ENV - - - name: Copy OS image file and checksum to final location - run: | - cp "${{ env.COMPRESSED_IMAGE_PATH }}" "${{ env.IMAGE_NAME }}.zip" - cp "${{ env.COMPRESSED_IMAGE_PATH }}.sha512" "${{ env.IMAGE_NAME }}.zip.sha512" - - - name: Upload image file and checksum to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ env.IMAGE_NAME }}.* - tag: ${{ env.LATEST_GA }}-${{ env.IMAGE_NAME }}-OpenFleet - overwrite: true - file_glob: true diff --git a/balena/workflows/update-action-prod.yml b/balena/workflows/update-action-prod.yml deleted file mode 100644 index 8b137891..00000000 --- a/balena/workflows/update-action-prod.yml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/balena/workflows/update-files.yml b/balena/workflows/update-files.yml deleted file mode 100644 index e0cf6aa7..00000000 --- a/balena/workflows/update-files.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Update Files -on: - repository_dispatch: - types: [file-update] - workflow_dispatch: -jobs: - file-update-prod: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: master - - run: | - cd /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }} - rm -f balena.yml - rm -f docker-compose.yml - rm -f .github/workflows/*.yml - rm -f config.txt - - miner="$(echo ${{ github.event.repository.name }} | cut -d '-' -f2-)" - echo "$miner" - - if [ $miner == 'indoor-868' ] || [ $miner == 'indoor-915' ] || [ $miner == 'indoor-470' ] ; then - balena="raspi-indoor" - elif [ $miner == 'outdoor-868' ] || [ $miner == 'outdoor-915' ] || [ $miner == 'outdoor-470' ] ; then - balena="raspi-outdoor" - elif [ $miner == 'indoor-868-rockpi' ] || [ $miner == 'indoor-915-rockpi' ] || [ $miner == 'indoor-470-rockpi' ] ; then - balena="rockpi-indoor" - elif [ $miner == 'oudoor-868-rockpi' ] || [ $miner == 'outdoor-915-rockpi' ] || [ $miner == 'outdoor-470-rockpi' ] ; then - balena="rockpi-outdoor" - else - balena="$miner" - fi - - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/balena.yml."$balena" -O balena.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/workflows/update-files.yml -O .github/workflows/update-files.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/workflows/build-open-fleet.yml -O .github/workflows/build-open-fleet.yml - - if [ $miner == 'pisces' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-pisces.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/config/config.txt.pisces -O config.txt - elif [ $miner == 'pycom' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-pycom.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/config/config.txt.pycom -O config.txt - elif [ $miner == 'indoor-868' ] || [ $miner == 'indoor-915' ] || [ $miner == 'indoor-470' ] || [ $miner == 'outdoor-915' ] || [ $miner == 'outdoor-868' ] || [ $miner == 'outdoor-470' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/config/config.txt.nebra-raspi -O config.txt - elif [ $miner == 'indoor-868-rockpi' ] || [ $miner == 'indoor-915-rockpi' ] || [ $miner == 'indoor-470-rockpi' ] || [ $miner == 'oudoor-868-rockpi' ] || [ $miner == 'outdoor-915-rockpi' ] || [ $miner == 'outdoor-470-rockpi' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-rockpi.yml -O docker-compose.yml - elif [ $miner == 'linxdot-rkcm3' ] || [ $miner == 'syncrobit-rkcm3' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-rockpi.yml -O docker-compose.yml - elif [ $miner == 'controllino' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/config/config.txt.controllino -O config.txt - elif [ $miner == 'sensecap' ] || [ $miner == 'cotx' ] || [ $miner == 'finestra' ] || [ $miner == 'linxdot' ] || [ $miner == 'pantherx1' ] || [ $miner == 'syncrobit' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/config/config.txt.sensecap -O config.txt - elif [ $miner == 'risinghf' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/config/config.txt.risinghf -O config.txt - else - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/production/balena/config/config.txt.rak -O config.txt - fi - - name: Push updated docker compose and balena.yml files - if: success() - uses: test-room-7/action-update-file@v1 - with: - branch: master - file-path: | - balena.yml - docker-compose.yml - config.* - .github/workflows/*.yml - commit-msg: Update OpenFleet core files (production) - github-token: ${{ secrets.MR_BUMP }} - - file-update-test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: testnet - - run: | - cd /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }} - rm -f balena.yml - rm -f docker-compose.yml - rm -f .github/workflows/*.yml - rm -f config.txt - - miner="$(echo ${{ github.event.repository.name }} | cut -d '-' -f2-)" - echo "$miner" - - if [ $miner == 'indoor-868' ] || [ $miner == 'indoor-915' ] || [ $miner == 'indoor-470' ] ; then - balena="raspi-indoor" - elif [ $miner == 'outdoor-868' ] || [ $miner == 'outdoor-915' ] || [ $miner == 'outdoor-470' ] ; then - balena="raspi-outdoor" - elif [ $miner == 'indoor-868-rockpi' ] || [ $miner == 'indoor-915-rockpi' ] || [ $miner == 'indoor-470-rockpi' ] ; then - balena="rockpi-indoor" - elif [ $miner == 'oudoor-868-rockpi' ] || [ $miner == 'outdoor-915-rockpi' ] || [ $miner == 'outdoor-470-rockpi' ] ; then - balena="rockpi-outdoor" - else - balena="$miner" - fi - - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/balena.yml."$balena" -O balena.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/workflows/update-files.yml -O .github/workflows/update-files.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/workflows/build-open-fleet.yml -O .github/workflows/build-open-fleet.yml - - if [ $miner == 'pisces' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-pisces.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/config/config.txt.pisces -O config.txt - elif [ $miner == 'pycom' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-pycom.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/config/config.txt.pycom -O config.txt - elif [ $miner == 'indoor-868' ] || [ $miner == 'indoor-915' ] || [ $miner == 'indoor-470' ] || [ $miner == 'outdoor-915' ] || [ $miner == 'outdoor-868' ] || [ $miner == 'outdoor-470' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/config/config.txt.nebra-raspi -O config.txt - elif [ $miner == 'indoor-868-rockpi' ] || [ $miner == 'indoor-915-rockpi' ] || [ $miner == 'indoor-470-rockpi' ] || [ $miner == 'oudoor-868-rockpi' ] || [ $miner == 'outdoor-915-rockpi' ] || [ $miner == 'outdoor-470-rockpi' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-rockpi.yml -O docker-compose.yml - elif [ $miner == 'linxdot-rkcm3' ] || [ $miner == 'syncrobit-rkcm3' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-rockpi.yml -O docker-compose.yml - elif [ $miner == 'controllino' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/config/config.txt.controllino -O config.txt - elif [ $miner == 'sensecap' ] || [ $miner == 'cotx' ] || [ $miner == 'finestra' ] || [ $miner == 'linxdot' ] || [ $miner == 'pantherx1' ] || [ $miner == 'syncrobit' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/config/config.txt.sensecap -O config.txt - elif [ $miner == 'risinghf' ] ; then - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/config/config.txt.risinghf -O config.txt - else - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/device-compose-files/docker-compose-rpi.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/NebraLtd/helium-miner-software/master/balena/config/config.txt.rak -O config.txt - fi - - name: Push updated docker compose and balena.yml files - if: success() - uses: test-room-7/action-update-file@v1 - with: - branch: testnet - file-path: | - balena.yml - docker-compose.yml - config.* - .github/workflows/*.yml - commit-msg: Update OpenFleet core files (testnet) - github-token: ${{ secrets.MR_BUMP }} diff --git a/balena/config/config.txt.nebra-raspi b/config.txt similarity index 100% rename from balena/config/config.txt.nebra-raspi rename to config.txt diff --git a/device-compose-files/docker-compose-pycom.yml b/device-compose-files/docker-compose-pycom.yml deleted file mode 100644 index 00b61ae9..00000000 --- a/device-compose-files/docker-compose-pycom.yml +++ /dev/null @@ -1,110 +0,0 @@ -version: '2' - -services: - - gateway-config: - image: nebraltd/hm-config:f48079c - depends_on: - - dbus-session - - diagnostics - environment: - - FIRMWARE_VERSION=2022.12.13.0-4 - - FIRMWARE_SHORT_HASH=cc36ada - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - privileged: true - network_mode: host - cap_add: - - NET_ADMIN - volumes: - - miner-storage:/var/data - - dbus:/session/dbus - labels: - io.balena.features.sysfs: 1 - io.balena.features.kernel-modules: 1 - io.balena.features.dbus: 1 - stop_signal: SIGINT - - packet-forwarder: - image: nebraltd/hm-pktfwd:0b5ee97 - depends_on: - - helium-miner - restart: always - privileged: true - volumes: - - pktfwdr:/var/pktfwd - environment: - - FIRMWARE_VERSION=2022.12.13.0-4 - - FIRMWARE_SHORT_HASH=cc36ada - - helium-miner: - image: nebraltd/hm-miner:arm64-c1f8791 - depends_on: - - dbus-session - - diagnostics - expose: - - "1680" - - "4467" - ports: - - "44158:44158/tcp" - volumes: - - miner-storage:/var/data - - miner-log:/var/log/miner - - pktfwdr:/var/pktfwd - - dbus:/session/dbus - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-10:/dev/i2c-10 - restart: on-failure - environment: - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.12.13.0-4 - - FIRMWARE_SHORT_HASH=cc36ada - - diagnostics: - image: nebraltd/hm-diag:2d72741 - depends_on: - - dbus-session - environment: - - FIRMWARE_VERSION=2022.12.13.0-4 - - FIRMWARE_SHORT_HASH=cc36ada - - DIAGNOSTICS_VERSION=2d72741 - - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket - volumes: - - pktfwdr:/var/pktfwd - - miner-storage:/var/data - - watchdog-log:/var/watchdog - ports: - - "80:5000" - cap_add: - - SYS_RAWIO - devices: - - /dev/i2c-10:/dev/i2c-10 - - /dev/ttyUSB0:/dev/ttyUSB0 - - /dev/ttyUSB1:/dev/ttyUSB1 - - /dev/ttyUSB2:/dev/ttyUSB2 - - /dev/ttyUSB3:/dev/ttyUSB3 - privileged: true - labels: - io.balena.features.sysfs: 1 - io.balena.features.procfs: 1 - io.balena.features.dbus: 1 - io.balena.features.supervisor-api: '1' - - dbus-session: - image: balenablocks/dbus:rpi-0.0.2 - restart: always - volumes: - - dbus:/session/dbus - environment: - - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket - - FIRMWARE_VERSION=2022.12.13.0-4 - - FIRMWARE_SHORT_HASH=cc36ada - -volumes: - miner-storage: - miner-log: - watchdog-log: - pktfwdr: - dbus: \ No newline at end of file diff --git a/gen_docker_compose.py b/gen_docker_compose.py index 44250755..d46bb7da 100644 --- a/gen_docker_compose.py +++ b/gen_docker_compose.py @@ -1,5 +1,5 @@ """ -Generate docker-compose.yml based on docker-compose.template file. +Generate docker-compose.yml based on docker-compose.tempalte file. Some how balena doesn't like output of: diff --git a/settings.ini b/settings.ini index a22cd053..a4b5fb76 100644 --- a/settings.ini +++ b/settings.ini @@ -1,28 +1,6 @@ [versions] -FIRMWARE_VERSION=v1.0.0-alpha.33 -DIAGNOSTICS_VERSION=96d12da -CONFIG_VERSION=0a014a3 -PKTFWD_VERSION=634a53a -GATEWAYRS_VERSION=fc8eb86 - -[quectel_modem] -MODEM_SERIAL0=/dev/ttyUSB0 -MODEM_SERIAL1=/dev/ttyUSB1 -MODEM_SERIAL2=/dev/ttyUSB2 -MODEM_SERIAL3=/dev/ttyUSB3 - -[device_rpi] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-1 - -[device_rockpi] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-7 - -[device_pisces] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-0 - -[device_pycom] -ARCH=arm64 -I2C_DEVICE=/dev/i2c-10 +FIRMWARE_VERSION=v1.0.0-alpha.23 +DIAGNOSTICS_VERSION=fb63618 +CONFIG_VERSION=b5fa96c +PKTFWD_VERSION=b95cc46 +GATEWAYRS_VERSION=d3b1c78 From 9b8b1dfd1f1f59db526cddcae9f1391a528f4043 Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Fri, 13 Jan 2023 23:50:27 +0530 Subject: [PATCH 16/26] Revert "Merge pull request #576 from NebraLtd/pritam/light-hotspot-update" This reverts commit 7fe1e6c29efa3ccb939a52b642a175767a5b92da, reversing changes made to 52bdfe46fbc2a36808b5e6b26c0c3021535b171d. --- .github/FUNDING.yml | 3 --- .github/workflows/openfleet-file-update.yml | 2 +- .github/workflows/push-to-prod-draft.yml | 12 +++------ .github/workflows/push-to-prod.yml | 12 +++------ balena/balena.yml.cotx | 30 --------------------- how_to_add_new_hotspot.md | 8 ------ templates/docker-compose.template | 4 --- 7 files changed, 9 insertions(+), 62 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 balena/balena.yml.cotx diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index be1cf823..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms - -github: [NebraLtd] diff --git a/.github/workflows/openfleet-file-update.yml b/.github/workflows/openfleet-file-update.yml index b85349ca..725ac9aa 100644 --- a/.github/workflows/openfleet-file-update.yml +++ b/.github/workflows/openfleet-file-update.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - sbc: [rak, pisces, og, sensecap, finestra, controllino, cotx] + sbc: [rak, pisces, og, sensecap, finestra, controllino] steps: - name: Trigger PR action in helium-${{ matrix.sbc }} repo uses: peter-evans/repository-dispatch@v1 diff --git a/.github/workflows/push-to-prod-draft.yml b/.github/workflows/push-to-prod-draft.yml index 51b76edf..edc5d136 100644 --- a/.github/workflows/push-to-prod-draft.yml +++ b/.github/workflows/push-to-prod-draft.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino, cotx] + sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino] frequency: [470, 868, 915] variant: [indoor, outdoor] exclude: @@ -19,7 +19,6 @@ jobs: - sbc: sensecap - sbc: finestra - sbc: controllino - - sbc: cotx include: - sbc: pisces variant: indoor @@ -39,9 +38,6 @@ jobs: - sbc: controllino variant: indoor frequency: 868 - - sbc: cotx - variant: indoor - frequency: 868 steps: - name: Checkout uses: actions/checkout@v2 @@ -64,9 +60,9 @@ jobs: run: | python gen_docker_compose.py rpi -o docker-compose.yml - name: Generate Docker Compose for RAK and Non-Nebra RasPi - if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' + if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' run: | - python gen_docker_compose.py rpi -o docker-compose.yml + python gen_docker_compose.py rpi -o docker-compose.yml cp balena/balena.yml.${{ matrix.sbc }} balena.yml - name: Generate Docker Compose for Pisces if: matrix.sbc == 'pisces' @@ -87,7 +83,7 @@ jobs: balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build --draft" - name: Balena Deploy (RAK and Non-Nebra RasPi) uses: nebraltd/balena-cli-action@v13.3.0 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' ) && success() + if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' ) && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build --draft" diff --git a/.github/workflows/push-to-prod.yml b/.github/workflows/push-to-prod.yml index 161a1eb9..215efff2 100644 --- a/.github/workflows/push-to-prod.yml +++ b/.github/workflows/push-to-prod.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino, cotx] + sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino] frequency: [470, 868, 915] variant: [indoor, outdoor] exclude: @@ -22,7 +22,6 @@ jobs: - sbc: sensecap - sbc: finestra - sbc: controllino - - sbc: cotx include: - sbc: pisces variant: indoor @@ -42,9 +41,6 @@ jobs: - sbc: controllino variant: indoor frequency: 868 - - sbc: cotx - variant: indoor - frequency: 868 steps: - name: Checkout uses: actions/checkout@v2 @@ -65,9 +61,9 @@ jobs: run: | python gen_docker_compose.py rpi -o docker-compose.yml - name: Generate Docker Compose for RAK and Non-Nebra RasPi - if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' + if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' run: | - python gen_docker_compose.py rpi -o docker-compose.yml + python gen_docker_compose.py rpi -o docker-compose.yml cp balena/balena.yml.${{ matrix.sbc }} balena.yml - name: Generate Docker Compose for Pisces if: matrix.sbc == 'pisces' @@ -88,7 +84,7 @@ jobs: balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build" - name: Balena Deploy (RAK and Non-Nebra RasPi) uses: nebraltd/balena-cli-action@v13.3.0 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' || matrix.sbc == 'cotx' ) && success() + if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' ) && success() with: balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build" diff --git a/balena/balena.yml.cotx b/balena/balena.yml.cotx deleted file mode 100644 index de1f59e1..00000000 --- a/balena/balena.yml.cotx +++ /dev/null @@ -1,30 +0,0 @@ -name: nebra-helium-cotx -type: sw.application -description: >- - Manage your COTX X3 Helium Miner remotely using Nebra and balenaCloud. -post-provisioning: >- - ## Usage instructions - - - Once your device joins the fleet you'll need to allow some time for it to download the application and start forwarding packets to the Helium Network. - - - For detailed instructions on how to use Nebra Helium COTX check out [our GitHub repo](https://github.com/NebraLtd/helium-cotx). - - - For support you can [open an issue](https://github.com/NebraLtd/helium-cotx/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). -assets: - repository: - type: blob.asset - data: - url: "https://github.com/NebraLtd/helium-cotx" - logo: - type: blob.asset - data: - url: >- - https://cdn.shopify.com/s/files/1/0071/2281/3001/files/Nebra-Icon-Blue_bb758eaa-b10d-4ea6-a55e-babd69135b69.png?v=1620938774 -data: - defaultDeviceType: raspberrypi4-64 - supportedDeviceTypes: - - raspberrypi4-64 -version: 0.0.1 diff --git a/how_to_add_new_hotspot.md b/how_to_add_new_hotspot.md index 37c9a153..ce0aa3fc 100644 --- a/how_to_add_new_hotspot.md +++ b/how_to_add_new_hotspot.md @@ -65,14 +65,6 @@ The LoRa concentrator hardware is designed to work on a SPI (Serial Peripheral I #### KEY_STORAGE_BUS All hotspots has to have a valid cryptography integrated circuit (IC), which is called ECC. This IC works on I2C bus and this parameter is defining the Linux IO device path for this particular I2C bus. Unlike SPIBUS, this path has to be absolute. -#### SWARM_KEY_URI -This is the new format of the ECC device specification [gateway-mfr-rs v0.2.1](https://github.com/helium/gateway-mfr-rs/tree/4c8f7b4b9c488099afd67b32c5951c5049e11a81#addressing). - -Format: `ecc:[:address][?slot=]` -- dev the device file name (usually begins with i2c or tty) -- address the bus address (default 96) -- slot the slot to use for key lookup/manipulation (default: 0) - #### RESET This is the GPIO index of the digital output, which is connected to the RF Concentrator chip (e.g. SX1301, SX1302 ...) reset. diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 67e483b7..2f0ecc76 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -63,7 +63,6 @@ services: volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data - - watchdog-log:/var/watchdog network_mode: host # host networking doesn't export hostnames extra_hosts: @@ -75,12 +74,9 @@ services: io.balena.features.sysfs: 1 io.balena.features.procfs: 1 io.balena.features.dbus: 1 - io.balena.features.supervisor-api: '1' volumes: miner-storage: - miner-log: - watchdog-log: pktfwdr: # balena keeps on changing the subnet, making it impossible From f0c886c35706f79594cd6b84fdc045e19fcd5fc9 Mon Sep 17 00:00:00 2001 From: "pritam.ghanghas@gmail.com" Date: Fri, 13 Jan 2023 23:55:50 +0530 Subject: [PATCH 17/26] fix: Update gateway-rs for light hotspot #213 * updated container hashes after update. --- settings.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/settings.ini b/settings.ini index a4b5fb76..c8bfb6ca 100644 --- a/settings.ini +++ b/settings.ini @@ -1,6 +1,6 @@ [versions] -FIRMWARE_VERSION=v1.0.0-alpha.23 -DIAGNOSTICS_VERSION=fb63618 -CONFIG_VERSION=b5fa96c -PKTFWD_VERSION=b95cc46 -GATEWAYRS_VERSION=d3b1c78 +FIRMWARE_VERSION=v1.0.0-alpha.33 +DIAGNOSTICS_VERSION=96d12da +CONFIG_VERSION=0a014a3 +PKTFWD_VERSION=634a53a +GATEWAYRS_VERSION=fc8eb86 \ No newline at end of file From f3c65dfc3efc7251a6479bead7f40ac1662a898e Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 10 Mar 2023 14:30:16 +0300 Subject: [PATCH 18/26] Updated light hotspot branch for newest gateway-rs Added variant based docker compose file generator Updated all other containers, except multiplexer. --- gen_docker_compose_by_variant.py | 100 ++++++++++++++++++++++++++++++ requirements.txt | 1 + settings.ini | 17 +++-- templates/docker-compose.template | 40 ++++++++++-- test-requirements.txt | 1 + tests/test_output.py | 6 +- 6 files changed, 153 insertions(+), 12 deletions(-) create mode 100644 gen_docker_compose_by_variant.py diff --git a/gen_docker_compose_by_variant.py b/gen_docker_compose_by_variant.py new file mode 100644 index 00000000..5690d464 --- /dev/null +++ b/gen_docker_compose_by_variant.py @@ -0,0 +1,100 @@ +""" +Generate docker-compose.yml based on docker-compose.template file. + +Some how balena doesn't like output of: + + `docker-compose -f docker-compose.template config > docker-compose.yml` + +That's probably because output for `docker-compose config` does not retain the +order of the sections present in the file. So as a workaround this small file +uses jinja2 and tries to do the same thing but without re-arranging sections +and just replacing placeholder values. +""" + +import os +import argparse +from typing import Union +from configparser import ConfigParser +from jinja2 import Environment, select_autoescape, FileSystemLoader +from hm_pyhelper.hardware_definitions import variant_definitions + + +prog_name = os.path.basename(os.path.abspath(__file__)) +here = os.path.dirname(os.path.abspath(__file__)) + + +class DockerComposer: + """ + A class to facilitate generation of docker-compose.yml files + from templates. + """ + + def __init__(self, templates_folder: Union[str, None] = None): + if templates_folder is None: + templates_folder = os.path.join(here, 'templates') + + self.jinja_env = Environment( + loader=FileSystemLoader(templates_folder), + autoescape=select_autoescape() + ) + + config = ConfigParser(strict=True) + # Suppress default behavior of converting key names to lower-case. + config.optionxform = lambda option: option + config.read('settings.ini') + self.config = config + + def generate_compose_file( + self, + variant_type: str, + template_file: str, + output_file: str + ) -> None: + """generate_compose_file Render template_file to generate compose file. + + Args: + variant_type (str): The target device variant for the docker compose file. + template_file (str): Template file name without folder name. + Should be present in the templates folder. + output_file (str): Output filename. Can be a path. Otherwise + file is created in current folder. + """ + template = self.jinja_env.get_template(template_file) + + template_args = {} + + if 'versions' not in self.config: + raise RuntimeError("Bad config, no [versions] section found") + + for k, v in self.config['versions'].items(): + template_args[k] = v + + template_args["ENV"] = os.environ + + template_args['ARCH'] = variant_definitions[variant_type]['CPU_ARCH'] + template_args['I2C_DEVICE'] = variant_definitions[variant_type]['KEY_STORAGE_BUS'] + + for k, v in self.config['quectel_modem'].items(): + template_args[k] = v + + output = template.render(**template_args) + with open(output_file, 'w') as template_output: + template_output.write(output) + + +if __name__ == '__main__': + + parser = argparse.ArgumentParser("Generate docker-compose.yml.") + parser.add_argument('variant_type', + help="Target variant.") + parser.add_argument('--template', '-t', default='docker-compose.template', + help="Input template file. Should be present in " + "templates folder.") + parser.add_argument('--output', '-o', default='docker-compose.yml', + help="Output file. Created in current folder.") + args = parser.parse_args() + # print(args) + + composer = DockerComposer() + composer.generate_compose_file( + args.variant_type, args.template, args.output) diff --git a/requirements.txt b/requirements.txt index db088176..619ea0f9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ jinja2==3.0.2 +hm_pyhelper==0.13.52 diff --git a/settings.ini b/settings.ini index c8bfb6ca..74145df3 100644 --- a/settings.ini +++ b/settings.ini @@ -1,6 +1,13 @@ [versions] -FIRMWARE_VERSION=v1.0.0-alpha.33 -DIAGNOSTICS_VERSION=96d12da -CONFIG_VERSION=0a014a3 -PKTFWD_VERSION=634a53a -GATEWAYRS_VERSION=fc8eb86 \ No newline at end of file +FIRMWARE_VERSION=v1.0.0-0 +DIAGNOSTICS_VERSION=f911b1c +CONFIG_VERSION=711dd63 +PKTFWD_VERSION=cbb8ce5 +GATEWAYRS_VERSION=c6fb46e +MULTIPLEXER_VERSION=e44e6a4 + +[quectel_modem] +MODEM_SERIAL0=/dev/ttyUSB0 +MODEM_SERIAL1=/dev/ttyUSB1 +MODEM_SERIAL2=/dev/ttyUSB2 +MODEM_SERIAL3=/dev/ttyUSB3 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 2f0ecc76..f6dd77d4 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -5,16 +5,23 @@ services: gateway-config: image: nebraltd/hm-config:{{CONFIG_VERSION}} depends_on: + - dbus-session - helium-miner - diagnostics environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket + - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket + restart: on-failure privileged: true network_mode: host cap_add: - NET_ADMIN + volumes: + - miner-storage:/var/data + - dbus:/session/dbus + - nebra:/var/nebra labels: io.balena.features.sysfs: 1 io.balena.features.kernel-modules: 1 @@ -28,14 +35,17 @@ services: restart: always privileged: true network_mode: host - # host networking doesn't export hostnames extra_hosts: - "helium-miner:127.0.0.1" volumes: - pktfwdr:/var/pktfwd + - nebra:/var/nebra environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} + labels: + io.balena.features.sysfs: 1 + io.balena.features.procfs: 1 helium-miner: image: nebraltd/hm-gatewayrs:{{GATEWAYRS_VERSION}} @@ -54,7 +64,7 @@ services: diagnostics: image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} depends_on: - - helium-miner + - dbus-session environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} @@ -63,21 +73,41 @@ services: volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data + - watchdog-log:/var/watchdog + - nebra:/var/nebra network_mode: host - # host networking doesn't export hostnames - extra_hosts: - - "helium-miner:127.0.0.1" cap_add: - SYS_RAWIO + devices: + - {{I2C_DEVICE}}:{{I2C_DEVICE}} + - {{MODEM_SERIAL0}}:{{MODEM_SERIAL0}} + - {{MODEM_SERIAL1}}:{{MODEM_SERIAL1}} + - {{MODEM_SERIAL2}}:{{MODEM_SERIAL2}} + - {{MODEM_SERIAL3}}:{{MODEM_SERIAL3}} + restart: always privileged: true labels: io.balena.features.sysfs: 1 io.balena.features.procfs: 1 io.balena.features.dbus: 1 + io.balena.features.supervisor-api: '1' + + dbus-session: + image: balenablocks/dbus:rpi-0.0.2 + restart: always + volumes: + - dbus:/session/dbus + environment: + - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket + - FIRMWARE_VERSION={{FIRMWARE_VERSION}} + - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} volumes: miner-storage: pktfwdr: + dbus: + nebra: + watchdog-log: # balena keeps on changing the subnet, making it impossible # to use extra_hosts for naming host IPs diff --git a/test-requirements.txt b/test-requirements.txt index e51938ab..d9e3a109 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,3 +2,4 @@ flake8==3.9.2 bandit==1.7.0 pytest==6.2.4 pytest-cov==2.12.1 +hm_pyhelper==0.13.52 diff --git a/tests/test_output.py b/tests/test_output.py index bcc057a4..29b8ad69 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -4,13 +4,14 @@ import unittest from os import unlink from subprocess import check_call -from gen_docker_compose import DockerComposer +from gen_docker_compose_by_variant import DockerComposer from os.path import abspath, dirname, join, exists here = dirname(abspath(__file__)) parent = dirname(here) template_file = 'docker-compose.template' output_file = join(here, 'dc.yml') +variant_type = "nebra-indoor2" sys.path.insert(1, parent) @@ -33,7 +34,8 @@ def test_compose_output_is_valid(self): # Uncomment line below if want to test custom templates. # dc = DockerComposer(templates_folder=templates_folder) dc = DockerComposer() - dc.generate_compose_file(template_file, output_file) + print(f"Output File: {output_file}") + dc.generate_compose_file(variant_type, template_file, output_file) # On failure or non-zero return code this returns CalledProcessError # so if this runs without that, it's considered successful as From ddf8e6d4d637163699f9222f67bf07be51ced6c1 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 7 Apr 2023 11:04:16 +0300 Subject: [PATCH 19/26] Everthing is ready for light-hotspots except mux --- gen_docker_compose_by_variant.py | 7 ++----- requirements.txt | 2 +- settings.ini | 10 ++-------- templates/docker-compose.template | 13 +++++-------- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/gen_docker_compose_by_variant.py b/gen_docker_compose_by_variant.py index 5690d464..c17ebcc6 100644 --- a/gen_docker_compose_by_variant.py +++ b/gen_docker_compose_by_variant.py @@ -71,11 +71,8 @@ def generate_compose_file( template_args["ENV"] = os.environ - template_args['ARCH'] = variant_definitions[variant_type]['CPU_ARCH'] - template_args['I2C_DEVICE'] = variant_definitions[variant_type]['KEY_STORAGE_BUS'] - - for k, v in self.config['quectel_modem'].items(): - template_args[k] = v + template_args["ARCH"] = variant_definitions[variant_type]["CPU_ARCH"] + template_args["SWARM_KEY_URI"] = variant_definitions[variant_type]["SWARM_KEY_URI"][0] output = template.render(**template_args) with open(output_file, 'w') as template_output: diff --git a/requirements.txt b/requirements.txt index 619ea0f9..121834fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ jinja2==3.0.2 -hm_pyhelper==0.13.52 +hm-pyhelper==0.14.0 diff --git a/settings.ini b/settings.ini index 74145df3..433608dc 100644 --- a/settings.ini +++ b/settings.ini @@ -1,13 +1,7 @@ [versions] FIRMWARE_VERSION=v1.0.0-0 -DIAGNOSTICS_VERSION=f911b1c +DIAGNOSTICS_VERSION=94b7acd CONFIG_VERSION=711dd63 PKTFWD_VERSION=cbb8ce5 -GATEWAYRS_VERSION=c6fb46e +GATEWAYRS_VERSION=05c94f4 MULTIPLEXER_VERSION=e44e6a4 - -[quectel_modem] -MODEM_SERIAL0=/dev/ttyUSB0 -MODEM_SERIAL1=/dev/ttyUSB1 -MODEM_SERIAL2=/dev/ttyUSB2 -MODEM_SERIAL3=/dev/ttyUSB3 diff --git a/templates/docker-compose.template b/templates/docker-compose.template index f6dd77d4..3b7433b4 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -48,7 +48,7 @@ services: io.balena.features.procfs: 1 helium-miner: - image: nebraltd/hm-gatewayrs:{{GATEWAYRS_VERSION}} + image: nebraltd/hm-gatewayrs:{{ARCH}}-{{GATEWAYRS_VERSION}} network_mode: host cap_add: - SYS_RAWIO @@ -57,12 +57,13 @@ services: environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} + - SWARM_KEY_URI={{SWARM_KEY_URI}} volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data diagnostics: - image: nebraltd/hm-diag:{{DIAGNOSTICS_VERSION}} + image: nebraltd/hm-diag:{{ARCH}}-{{DIAGNOSTICS_VERSION}} depends_on: - dbus-session environment: @@ -76,14 +77,10 @@ services: - watchdog-log:/var/watchdog - nebra:/var/nebra network_mode: host + extra_hosts: + - "helium-miner:127.0.0.1" cap_add: - SYS_RAWIO - devices: - - {{I2C_DEVICE}}:{{I2C_DEVICE}} - - {{MODEM_SERIAL0}}:{{MODEM_SERIAL0}} - - {{MODEM_SERIAL1}}:{{MODEM_SERIAL1}} - - {{MODEM_SERIAL2}}:{{MODEM_SERIAL2}} - - {{MODEM_SERIAL3}}:{{MODEM_SERIAL3}} restart: always privileged: true labels: From a7c473001d109712c1105872e9349726002b7349 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 7 Apr 2023 11:46:42 +0300 Subject: [PATCH 20/26] Added multiplexer container back --- settings.ini | 6 +++--- templates/docker-compose.template | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/settings.ini b/settings.ini index 433608dc..7e80f5c7 100644 --- a/settings.ini +++ b/settings.ini @@ -1,7 +1,7 @@ [versions] FIRMWARE_VERSION=v1.0.0-0 DIAGNOSTICS_VERSION=94b7acd -CONFIG_VERSION=711dd63 -PKTFWD_VERSION=cbb8ce5 +CONFIG_VERSION=1f564d0 +PKTFWD_VERSION=c39fcf7 GATEWAYRS_VERSION=05c94f4 -MULTIPLEXER_VERSION=e44e6a4 +MULTIPLEXER_VERSION=a1fc09b diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 3b7433b4..73fdad0a 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -31,12 +31,12 @@ services: packet-forwarder: image: nebraltd/hm-pktfwd:{{PKTFWD_VERSION}} depends_on: - - helium-miner + - multiplexer restart: always privileged: true network_mode: host extra_hosts: - - "helium-miner:127.0.0.1" + - "multiplexer:127.0.0.1" volumes: - pktfwdr:/var/pktfwd - nebra:/var/nebra @@ -47,6 +47,20 @@ services: io.balena.features.sysfs: 1 io.balena.features.procfs: 1 + multiplexer: + image: nebraltd/hm-multiplexer:{{MULTIPLEXER_VERSION}} + restart: always + depends_on: + - helium-miner + network_mode: host + extra_hosts: + - "helium-miner:127.0.0.1" + labels: + io.balena.features.sysfs: 1 + io.balena.features.procfs: 1 + volumes: + - nebra:/var/nebra + helium-miner: image: nebraltd/hm-gatewayrs:{{ARCH}}-{{GATEWAYRS_VERSION}} network_mode: host From 23e0594e6e04390c77eb410b40afd5c4103bc76b Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 7 Apr 2023 12:09:32 +0300 Subject: [PATCH 21/26] White space cleanup --- ...to-prod-new-fleets-nebraos-cloud-draft.yml | 22 +++++++------- .../push-to-prod-new-fleets-nebraos-cloud.yml | 22 +++++++------- ...to-prod-old-fleets-nebraos-cloud-draft.yml | 30 +++++++++---------- .../push-to-prod-old-fleets-nebraos-cloud.yml | 28 ++++++++--------- ...testnet-new-fleets-nebraos-cloud-draft.yml | 20 ++++++------- ...sh-to-testnet-new-fleets-nebraos-cloud.yml | 20 ++++++------- ...testnet-old-fleets-nebraos-cloud-draft.yml | 24 +++++++-------- ...sh-to-testnet-old-fleets-nebraos-cloud.yml | 24 +++++++-------- .github/workflows/update-production.yml | 6 ++-- 9 files changed, 98 insertions(+), 98 deletions(-) diff --git a/.github/workflows/push-to-prod-new-fleets-nebraos-cloud-draft.yml b/.github/workflows/push-to-prod-new-fleets-nebraos-cloud-draft.yml index 945e600e..93ad761e 100644 --- a/.github/workflows/push-to-prod-new-fleets-nebraos-cloud-draft.yml +++ b/.github/workflows/push-to-prod-new-fleets-nebraos-cloud-draft.yml @@ -16,38 +16,38 @@ jobs: uses: actions/checkout@v3 with: ref: production - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 540 ) + 1 ]s - + - name: Generate Docker Compose run: | repo="helium-${{matrix.variant}}" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py ${{matrix.variant}} -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: @@ -60,7 +60,7 @@ jobs: with: name: docker-compose.yml.${{ env.REPO }} path: docker-compose.yml - + - name: Upload docker-compose.yml to release uses: svenstaro/upload-release-action@v2 with: @@ -70,7 +70,7 @@ jobs: tag: ${{ env.LATEST_GA }}-${{ env.day }} overwrite: true body: "This is helium-miner-software release ${{ env.LATEST_GA }}-${{ env.day }}" - + - name: Trigger build action in ${{ env.REPO }} repo uses: peter-evans/repository-dispatch@v2 with: diff --git a/.github/workflows/push-to-prod-new-fleets-nebraos-cloud.yml b/.github/workflows/push-to-prod-new-fleets-nebraos-cloud.yml index b9a8c1fc..8f73ca8f 100644 --- a/.github/workflows/push-to-prod-new-fleets-nebraos-cloud.yml +++ b/.github/workflows/push-to-prod-new-fleets-nebraos-cloud.yml @@ -19,38 +19,38 @@ jobs: uses: actions/checkout@v3 with: ref: production - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 540 ) + 1 ]s - + - name: Generate Docker Compose run: | repo="helium-${{matrix.variant}}" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py ${{matrix.variant}} -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: @@ -63,7 +63,7 @@ jobs: with: name: docker-compose.yml.${{ env.REPO }} path: docker-compose.yml - + - name: Upload docker-compose.yml to release uses: svenstaro/upload-release-action@v2 with: @@ -73,7 +73,7 @@ jobs: tag: ${{ env.LATEST_GA }}-${{ env.day }} overwrite: true body: "This is helium-miner-software release ${{ env.LATEST_GA }}-${{ env.day }}" - + - name: Trigger build action in ${{ env.REPO }} repo uses: peter-evans/repository-dispatch@v2 with: diff --git a/.github/workflows/push-to-prod-old-fleets-nebraos-cloud-draft.yml b/.github/workflows/push-to-prod-old-fleets-nebraos-cloud-draft.yml index 99252531..ebf164ea 100644 --- a/.github/workflows/push-to-prod-old-fleets-nebraos-cloud-draft.yml +++ b/.github/workflows/push-to-prod-old-fleets-nebraos-cloud-draft.yml @@ -2,7 +2,7 @@ name: NebraOS Cloud Deploy (Production - old fleets - draft) on: workflow_dispatch: - + jobs: build-prod: runs-on: ubuntu-latest @@ -79,34 +79,34 @@ jobs: uses: actions/checkout@v3 with: ref: production - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit shell: bash run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 540 ) + 1 ]s - + - name: Generate Docker Compose run: | miner="${{ matrix.sbc }}" type="${{ matrix.variant }}" - + if [[ "$miner" == "raspi" ]] && [[ "$type" == "indoor" ]] ; then variant="nebra-indoor1" elif [[ "$miner" == "raspi" ]] && [[ "$type" == "outdoor" ]] ; then @@ -120,25 +120,25 @@ jobs: else variant="$miner-fl1" fi - + if [[ "$miner" == "rockpi" ]] ; then ROCKPI="-rockpi" fi - + if [[ "$miner" == "rockpi" ]] || [[ "$miner" == "raspi" ]] ; then repo="helium-${{ matrix.variant }}-${{ matrix.frequency }}$ROCKPI" else repo="helium-$miner" fi - + echo "Variant: $variant" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py "$variant" -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: @@ -161,7 +161,7 @@ jobs: tag: ${{ env.LATEST_GA }}-${{ env.day }} overwrite: true body: "This is helium-miner-software release ${{ env.LATEST_GA }}-${{ env.day }}" - + - name: Trigger build action in ${{ env.REPO }} repo uses: peter-evans/repository-dispatch@v2 if: matrix.sbc != 'raspi' && matrix.sbc != 'rockpi' diff --git a/.github/workflows/push-to-prod-old-fleets-nebraos-cloud.yml b/.github/workflows/push-to-prod-old-fleets-nebraos-cloud.yml index 6f3e5d59..2d33d707 100644 --- a/.github/workflows/push-to-prod-old-fleets-nebraos-cloud.yml +++ b/.github/workflows/push-to-prod-old-fleets-nebraos-cloud.yml @@ -82,34 +82,34 @@ jobs: uses: actions/checkout@v3 with: ref: production - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit shell: bash run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 540 ) + 1 ]s - + - name: Generate Docker Compose run: | miner="${{ matrix.sbc }}" type="${{ matrix.variant }}" - + if [[ "$miner" == "raspi" ]] && [[ "$type" == "indoor" ]] ; then variant="nebra-indoor1" elif [[ "$miner" == "raspi" ]] && [[ "$type" == "outdoor" ]] ; then @@ -123,32 +123,32 @@ jobs: else variant="$miner-fl1" fi - + if [[ "$miner" == "rockpi" ]] ; then ROCKPI="-rockpi" fi - + if [[ "$miner" == "rockpi" ]] || [[ "$miner" == "raspi" ]] ; then repo="helium-${{ matrix.variant }}-${{ matrix.frequency }}$ROCKPI" else repo="helium-$miner" fi - + echo "Variant: $variant" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py "$variant" -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: balena_api_token: ${{secrets.NEBRAOS_CLOUD_TOKEN}} nebraos_cloud: true balena_command: "deploy nebraltd/${{ env.REPO }} --debug --nocache --build" - + - name: Upload docker-compose.yml artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud-draft.yml b/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud-draft.yml index d50bc102..97f69e12 100644 --- a/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud-draft.yml +++ b/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud-draft.yml @@ -13,38 +13,38 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - + - name: Generate Docker Compose run: | repo="helium-${{matrix.variant}}" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py ${{matrix.variant}} -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: @@ -67,7 +67,7 @@ jobs: tag: TESTNET-${{ env.LATEST_GA }}-${{ env.day }} overwrite: true body: "TESTNET: This is helium-miner-software release TESTNET-${{ env.LATEST_GA }}-${{ env.day }}" - + - name: Trigger build action in ${{ env.REPO }} repo uses: peter-evans/repository-dispatch@v2 with: diff --git a/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud.yml b/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud.yml index a4ba87fa..660ade06 100644 --- a/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud.yml +++ b/.github/workflows/push-to-testnet-new-fleets-nebraos-cloud.yml @@ -16,38 +16,38 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - + - name: Generate Docker Compose run: | repo="helium-${{matrix.variant}}" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py ${{matrix.variant}} -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: @@ -70,7 +70,7 @@ jobs: tag: TESTNET-${{ env.LATEST_GA }}-${{ env.day }} overwrite: true body: "TESTNET: This is helium-miner-software release TESTNET-${{ env.LATEST_GA }}-${{ env.day }}" - + - name: Trigger build action in ${{ env.REPO }} repo uses: peter-evans/repository-dispatch@v2 with: diff --git a/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud-draft.yml b/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud-draft.yml index 8a1ac138..f4c28f2c 100644 --- a/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud-draft.yml +++ b/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud-draft.yml @@ -13,32 +13,32 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - + - name: Generate Docker Compose run: | miner="${{ matrix.sbc }}" - + if [[ "$miner" == "raspi" ]] ; then variant="nebra-indoor1" fleet="helium-testnet" @@ -56,17 +56,17 @@ jobs: fleet="helium-testnet-$miner" repo="helium-$miner" fi - + echo "Variant: $variant" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" echo "FLEET=$fleet" >> $GITHUB_ENV echo "Fleet: $fleet" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py "$variant" -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: @@ -89,7 +89,7 @@ jobs: tag: TESTNET-${{ env.LATEST_GA }}-${{ env.day }} overwrite: true body: "TESTNET: This is helium-miner-software release TESTNET-${{ env.LATEST_GA }}-${{ env.day }}" - + - name: Trigger build action in ${{ env.REPO }} repo uses: peter-evans/repository-dispatch@v2 if: matrix.sbc != 'raspi' && matrix.sbc != 'rockpi' diff --git a/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud.yml b/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud.yml index e6f84c0c..64cbad9c 100644 --- a/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud.yml +++ b/.github/workflows/push-to-testnet-old-fleets-nebraos-cloud.yml @@ -16,32 +16,32 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + - name: Setup Python Libraries run: pip install -r requirements.txt - + - name: Export short SHA of current commit run: | FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - + # Get the latest GA release and branch source <(grep FIRMWARE_VERSION settings.ini) LATEST_GA=$FIRMWARE_VERSION GITHUB_BRANCH=$( echo "${{ github.ref }}" | sed 's/refs\/heads\///g' ) - + echo "timestamp=$(date +'%s')" >> $GITHUB_ENV echo "day=$(date +'%F')" >> $GITHUB_ENV echo "LATEST_GA=$LATEST_GA" >> $GITHUB_ENV echo "GITHUB_BRANCH=$GITHUB_BRANCH" >> $GITHUB_ENV - + - name: Random sleep (balena API workaround) run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - + - name: Generate Docker Compose run: | miner="${{ matrix.sbc }}" - + if [[ "$miner" == "raspi" ]] ; then variant="nebra-indoor1" fleet="helium-testnet" @@ -59,17 +59,17 @@ jobs: fleet="helium-testnet-$miner" repo="helium-$miner" fi - + echo "Variant: $variant" echo "REPO=$repo" >> $GITHUB_ENV echo "Repo: $repo" echo "FLEET=$fleet" >> $GITHUB_ENV echo "Fleet: $fleet" - + FIRMWARE_SHORT_HASH=${{ env.FIRMWARE_SHORT_HASH }} - + python gen_docker_compose_by_variant.py "$variant" -o docker-compose.yml - + - name: Balena Deploy uses: nebraltd/balena-cli-action@v15.1.2 with: @@ -92,7 +92,7 @@ jobs: tag: TESTNET-${{ env.LATEST_GA }}-${{ env.day }} overwrite: true body: "TESTNET: This is helium-miner-software release TESTNET-${{ env.LATEST_GA }}-${{ env.day }}" - + - name: Trigger build action in ${{ env.REPO }} repo uses: peter-evans/repository-dispatch@v2 if: matrix.sbc != 'raspi' && matrix.sbc != 'rockpi' diff --git a/.github/workflows/update-production.yml b/.github/workflows/update-production.yml index 9c8756d1..f721393e 100644 --- a/.github/workflows/update-production.yml +++ b/.github/workflows/update-production.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: + with: ref: ${{ github.ref }} fetch-depth: 0 - name: Set current date and latest GA as env variable, check PR title @@ -40,8 +40,8 @@ jobs: title: "release(prod): Update miner to latest GA ${{ env.LATEST_GA }}" body: | Update miner to latest GA ${{ env.LATEST_GA }} - + Ref #${{ github.event.number }} - + Pushed to testnet at ${{ env.NOW }} draft: false From b38aff7aacf0b26f30e8eef9bc12387a58e61a4d Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 7 Apr 2023 12:17:10 +0300 Subject: [PATCH 22/26] Fixed tests and merge issues --- gen_docker_compose_by_variant.py | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/gen_docker_compose_by_variant.py b/gen_docker_compose_by_variant.py index 9c11a1f5..c17ebcc6 100644 --- a/gen_docker_compose_by_variant.py +++ b/gen_docker_compose_by_variant.py @@ -1,5 +1,5 @@ """ -Generate docker-compose.yml based on docker-compose.tempalte file. +Generate docker-compose.yml based on docker-compose.template file. Some how balena doesn't like output of: @@ -14,7 +14,6 @@ import os import argparse from typing import Union -from urllib.parse import urlparse from configparser import ConfigParser from jinja2 import Environment, select_autoescape, FileSystemLoader from hm_pyhelper.hardware_definitions import variant_definitions @@ -47,20 +46,14 @@ def __init__(self, templates_folder: Union[str, None] = None): def generate_compose_file( self, -<<<<<<<< HEAD:gen_docker_compose.py -======== variant_type: str, ->>>>>>>> master:gen_docker_compose_by_variant.py template_file: str, output_file: str ) -> None: """generate_compose_file Render template_file to generate compose file. Args: -<<<<<<<< HEAD:gen_docker_compose.py -======== variant_type (str): The target device variant for the docker compose file. ->>>>>>>> master:gen_docker_compose_by_variant.py template_file (str): Template file name without folder name. Should be present in the templates folder. output_file (str): Output filename. Can be a path. Otherwise @@ -78,20 +71,9 @@ def generate_compose_file( template_args["ENV"] = os.environ -<<<<<<<< HEAD:gen_docker_compose.py -======== - for k, v in self.config['quectel_modem'].items(): - template_args[k] = v - - swarm_key_uri = variant_definitions[variant_type]['SWARM_KEY_URI'][0] - parse_result = urlparse(swarm_key_uri) - i2c_bus = parse_result.hostname - i2c_device = f'/dev/{i2c_bus}' + template_args["ARCH"] = variant_definitions[variant_type]["CPU_ARCH"] + template_args["SWARM_KEY_URI"] = variant_definitions[variant_type]["SWARM_KEY_URI"][0] - template_args['ARCH'] = variant_definitions[variant_type]['CPU_ARCH'] - template_args['I2C_DEVICE'] = i2c_device - ->>>>>>>> master:gen_docker_compose_by_variant.py output = template.render(**template_args) with open(output_file, 'w') as template_output: template_output.write(output) @@ -100,12 +82,8 @@ def generate_compose_file( if __name__ == '__main__': parser = argparse.ArgumentParser("Generate docker-compose.yml.") -<<<<<<<< HEAD:gen_docker_compose.py - -======== parser.add_argument('variant_type', help="Target variant.") ->>>>>>>> master:gen_docker_compose_by_variant.py parser.add_argument('--template', '-t', default='docker-compose.template', help="Input template file. Should be present in " "templates folder.") @@ -115,9 +93,5 @@ def generate_compose_file( # print(args) composer = DockerComposer() -<<<<<<<< HEAD:gen_docker_compose.py - composer.generate_compose_file(args.template, args.output) -======== composer.generate_compose_file( args.variant_type, args.template, args.output) ->>>>>>>> master:gen_docker_compose_by_variant.py From f97e4163c6d79bee1c4bfe52a9b7fff929562e1c Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 7 Apr 2023 14:42:22 +0300 Subject: [PATCH 23/26] Removed unnecessary stub workflow --- .github/workflows/push-to-testnet.yml | 30 --------------------------- 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/push-to-testnet.yml diff --git a/.github/workflows/push-to-testnet.yml b/.github/workflows/push-to-testnet.yml deleted file mode 100644 index eeb74c19..00000000 --- a/.github/workflows/push-to-testnet.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: BalenaCloud Deploy (Testnet) - -on: - push: - # Only run workflow for pushes to specific branches - branches: - - light-hotspot - -jobs: - testnet: - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Export short SHA of current commit - run: | - FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) - echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - - name: Random sleep (balena API workaround) - run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose - run: | - python gen_docker_compose.py -o docker-compose.yml - - name: Balena Deploy - uses: nebraltd/balena-cli-action@v13.3.0 - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build" From 19a7445a300272ac72cf9cdf3e8ad0b0f5b4e9cb Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Fri, 7 Apr 2023 17:56:30 +0300 Subject: [PATCH 24/26] Fixed regressions after light-spot branch merge --- .github/FUNDING.yml | 3 + .github/workflows/linter.yml | 2 +- .github/workflows/push-to-prod-draft.yml | 95 ---------- .github/workflows/push-to-prod.yml | 96 ----------- .github/workflows/push-to-testnet-draft.yml | 27 --- .github/workflows/python-tests.yml | 2 +- .github/workflows/security-audit.yml | 6 +- .github/workflows/update-production.yml | 2 +- README.md | 2 +- balena/balena.yml.controllino | 4 +- balena/balena.yml.finestra | 2 +- balena/balena.yml.og | 2 +- balena/balena.yml.pisces | 2 +- balena/balena.yml.rak | 2 +- balena/balena.yml.sensecap | 2 +- balena/config/config.txt.controllino | 10 ++ balena/config/config.txt.nebra-raspi | 10 ++ balena/config/config.txt.pisces | 11 ++ balena/config/config.txt.pycom | 13 ++ balena/config/config.txt.rak | 10 ++ balena/config/config.txt.risinghf | 11 ++ balena/config/config.txt.sensecap | 9 + balena/workflows/update-action-prod.yml | 1 + how_to_add_new_hotspot.md | 181 ++++++++++++++++++++ requirements.txt | 2 +- tests/test_output.py | 44 ----- 26 files changed, 274 insertions(+), 277 deletions(-) create mode 100644 .github/FUNDING.yml delete mode 100644 .github/workflows/push-to-prod-draft.yml delete mode 100644 .github/workflows/push-to-prod.yml delete mode 100644 .github/workflows/push-to-testnet-draft.yml create mode 100644 balena/config/config.txt.controllino create mode 100644 balena/config/config.txt.nebra-raspi create mode 100644 balena/config/config.txt.pisces create mode 100644 balena/config/config.txt.pycom create mode 100644 balena/config/config.txt.rak create mode 100644 balena/config/config.txt.risinghf create mode 100644 balena/config/config.txt.sensecap create mode 100644 balena/workflows/update-action-prod.yml delete mode 100644 tests/test_output.py diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..be1cf823 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [NebraLtd] diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 8bf8e388..fd896127 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -36,7 +36,7 @@ jobs: # Checkout the code base # ########################## - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # Full git history is needed to get a proper list of changed files within `super-linter` fetch-depth: 0 diff --git a/.github/workflows/push-to-prod-draft.yml b/.github/workflows/push-to-prod-draft.yml deleted file mode 100644 index edc5d136..00000000 --- a/.github/workflows/push-to-prod-draft.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: BalenaCloud Deploy (Production - Draft Deploy) - -on: - workflow_dispatch: - -jobs: - build-prod: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino] - frequency: [470, 868, 915] - variant: [indoor, outdoor] - exclude: - - sbc: rak - - sbc: pisces - - sbc: og - - sbc: sensecap - - sbc: finestra - - sbc: controllino - include: - - sbc: pisces - variant: indoor - frequency: 868 - - sbc: rak - variant: indoor - frequency: 868 - - sbc: og - variant: indoor - frequency: 868 - - sbc: sensecap - variant: indoor - frequency: 868 - - sbc: finestra - variant: indoor - frequency: 868 - - sbc: controllino - variant: indoor - frequency: 868 - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: production - - name: Export short SHA of current commit - run: | - FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) - echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - - name: Random sleep (balena API workaround) - run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for ROCK Pi - if: matrix.sbc == 'rockpi' - run: | - python gen_docker_compose.py rockpi -o docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for Nebra RasPi - if: matrix.sbc == 'raspi' - run: | - python gen_docker_compose.py rpi -o docker-compose.yml - - name: Generate Docker Compose for RAK and Non-Nebra RasPi - if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' - run: | - python gen_docker_compose.py rpi -o docker-compose.yml - cp balena/balena.yml.${{ matrix.sbc }} balena.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o docker-compose.yml - cp balena/balena.yml.pisces balena.yml - - name: Balena Deploy (Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'rockpi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --logs --debug --nocache --build --draft" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build --draft" - - name: Balena Deploy (RAK and Non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' ) && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build --draft" - - name: Balena Deploy (Pisces P100) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'pisces' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build --draft" diff --git a/.github/workflows/push-to-prod.yml b/.github/workflows/push-to-prod.yml deleted file mode 100644 index 215efff2..00000000 --- a/.github/workflows/push-to-prod.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: BalenaCloud Deploy (Production) - -on: - push: - # Only run workflow for pushes to specific branches - branches: - - production - -jobs: - build-prod: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sbc: [raspi, rockpi, rak, pisces, og, sensecap, finestra, controllino] - frequency: [470, 868, 915] - variant: [indoor, outdoor] - exclude: - - sbc: rak - - sbc: pisces - - sbc: og - - sbc: sensecap - - sbc: finestra - - sbc: controllino - include: - - sbc: pisces - variant: indoor - frequency: 868 - - sbc: rak - variant: indoor - frequency: 868 - - sbc: og - variant: indoor - frequency: 868 - - sbc: sensecap - variant: indoor - frequency: 868 - - sbc: finestra - variant: indoor - frequency: 868 - - sbc: controllino - variant: indoor - frequency: 868 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Export short SHA of current commit - run: | - FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) - echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - - name: Random sleep (balena API workaround) - run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose for ROCK Pi - if: matrix.sbc == 'rockpi' - run: | - python gen_docker_compose.py rockpi -o docker-compose.yml - ROCKPI="-rockpi" - echo "ROCKPI=$ROCKPI" >> $GITHUB_ENV - - name: Generate Docker Compose for Nebra RasPi - if: matrix.sbc == 'raspi' - run: | - python gen_docker_compose.py rpi -o docker-compose.yml - - name: Generate Docker Compose for RAK and Non-Nebra RasPi - if: matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' - run: | - python gen_docker_compose.py rpi -o docker-compose.yml - cp balena/balena.yml.${{ matrix.sbc }} balena.yml - - name: Generate Docker Compose for Pisces - if: matrix.sbc == 'pisces' - run: | - python gen_docker_compose.py pisces -o docker-compose.yml - cp balena/balena.yml.pisces balena.yml - - name: Balena Deploy (Nebra ROCK Pi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'rockpi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }}${{ env.ROCKPI }} --logs --debug --nocache --build" - - name: Balena Deploy (Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'raspi' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_1}} - balena_command: "deploy nebraltd/helium-${{ matrix.variant }}-${{ matrix.frequency }} --logs --debug --nocache --build" - - name: Balena Deploy (RAK and Non-Nebra RasPi) - uses: nebraltd/balena-cli-action@v13.3.0 - if: ( matrix.sbc == 'rak' || matrix.sbc == 'og' || matrix.sbc == 'sensecap' || matrix.sbc == 'finestra' || matrix.sbc == 'controllino' ) && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_2}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build" - - name: Balena Deploy (Pisces P100) - uses: nebraltd/balena-cli-action@v13.3.0 - if: matrix.sbc == 'pisces' && success() - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN_3}} - balena_command: "deploy nebraltd/helium-${{ matrix.sbc }} --logs --debug --nocache --build" diff --git a/.github/workflows/push-to-testnet-draft.yml b/.github/workflows/push-to-testnet-draft.yml deleted file mode 100644 index 55876dc0..00000000 --- a/.github/workflows/push-to-testnet-draft.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: BalenaCloud Deploy (Testnet - Draft Deploy) - -on: - workflow_dispatch: - -jobs: - testnet: - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Export short SHA of current commit - run: | - FIRMWARE_SHORT_HASH=$( echo ${GITHUB_SHA:0:7} ) - echo "FIRMWARE_SHORT_HASH=$FIRMWARE_SHORT_HASH" >> $GITHUB_ENV - - name: Random sleep (balena API workaround) - run: sleep $[ ( $RANDOM % 360 ) + 1 ]s - - name: Generate Docker Compose - run: | - python gen_docker_compose.py -o docker-compose.yml - - name: Balena Deploy - uses: nebraltd/balena-cli-action@v13.3.0 - with: - balena_api_token: ${{secrets.BALENA_API_TOKEN}} - balena_command: "deploy nebraltd/helium-light-test --logs --debug --nocache --build --draft" diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 84fadc95..7d1eae90 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python 3.8 - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: 3.8 - name: Run PyTest diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 6ac49b13..3d13c64c 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -1,4 +1,4 @@ -name: Code Security Audit +name: Code Security Audit on: [push, pull_request] @@ -10,10 +10,10 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python 3.8 - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Run bandit against code base + - name: Run bandit against code base run: | pip install bandit bandit -r . -x "./tests/*" diff --git a/.github/workflows/update-production.yml b/.github/workflows/update-production.yml index f721393e..b68cf44e 100644 --- a/.github/workflows/update-production.yml +++ b/.github/workflows/update-production.yml @@ -32,7 +32,7 @@ jobs: fi - name: Create Pull Request if: env.UPDATED == 'true' - uses: devops-infra/action-pull-request@v0.4.2 + uses: devops-infra/action-pull-request@v0.5.3 with: source_branch: master target_branch: production diff --git a/README.md b/README.md index 36a9b1f3..9aeef3a6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repository generates the main docker-compose.yml (follow the steps to gener The `docker-compose.yml` file is pushed to [Balena](https://www.balena.io/) (using GitHub Actions), which in turn pulls down the various Docker images outlined below. -There are currently four different services running within this device, which are all outlined below. +There are currently five different services running within this device, which are all outlined below. ## Diagnostics diff --git a/balena/balena.yml.controllino b/balena/balena.yml.controllino index a07bbac5..2f907950 100644 --- a/balena/balena.yml.controllino +++ b/balena/balena.yml.controllino @@ -1,7 +1,7 @@ name: nebra-helium-controllino type: sw.application description: >- - Manage your Controllino Helium Miner remotely using Nebra and balenaCloud. + Manage your Controllino or Conelcom Helium Miner remotely using Nebra and balenaCloud. post-provisioning: >- ## Usage instructions @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Controllino check out [our GitHub repo](https://github.com/NebraLtd/helium-controllino). - For support you can [open an issue](https://github.com/NebraLtd/helium-controllino/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). + For support you can [open an issue](https://github.com/NebraLtd/helium-controllino/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). assets: repository: type: blob.asset diff --git a/balena/balena.yml.finestra b/balena/balena.yml.finestra index 7a251533..96e59a20 100644 --- a/balena/balena.yml.finestra +++ b/balena/balena.yml.finestra @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Finestra check out [our GitHub repo](https://github.com/NebraLtd/helium-finestra). - For support you can [open an issue](https://github.com/NebraLtd/helium-finestra/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). + For support you can [open an issue](https://github.com/NebraLtd/helium-finestra/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). assets: repository: type: blob.asset diff --git a/balena/balena.yml.og b/balena/balena.yml.og index 9975c51e..2cb21850 100644 --- a/balena/balena.yml.og +++ b/balena/balena.yml.og @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium OG check out [our GitHub repo](https://github.com/NebraLtd/helium-og). - For support you can [open an issue](https://github.com/NebraLtd/helium-og/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). + For support you can [open an issue](https://github.com/NebraLtd/helium-og/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). assets: repository: type: blob.asset diff --git a/balena/balena.yml.pisces b/balena/balena.yml.pisces index dbcc7c75..a8ef27d7 100644 --- a/balena/balena.yml.pisces +++ b/balena/balena.yml.pisces @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Pisces check out [our GitHub repo](https://github.com/NebraLtd/helium-pisces). - For support you can [open an issue](https://github.com/NebraLtd/helium-pisces/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). + For support you can [open an issue](https://github.com/NebraLtd/helium-pisces/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). assets: repository: type: blob.asset diff --git a/balena/balena.yml.rak b/balena/balena.yml.rak index 36dbc090..9bf47e7e 100644 --- a/balena/balena.yml.rak +++ b/balena/balena.yml.rak @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium RAK check out [our GitHub repo](https://github.com/NebraLtd/helium-rak). - For support you can [open an issue](https://github.com/NebraLtd/helium-rak/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). + For support you can [open an issue](https://github.com/NebraLtd/helium-rak/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). assets: repository: type: blob.asset diff --git a/balena/balena.yml.sensecap b/balena/balena.yml.sensecap index 648dca7c..042e605b 100644 --- a/balena/balena.yml.sensecap +++ b/balena/balena.yml.sensecap @@ -12,7 +12,7 @@ post-provisioning: >- For detailed instructions on how to use Nebra Helium Sensecap check out [our GitHub repo](https://github.com/NebraLtd/helium-sensecap). - For support you can [open an issue](https://github.com/NebraLtd/helium-sensecap/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com/support). + For support you can [open an issue](https://github.com/NebraLtd/helium-sensecap/issues) on the repo or reach out to us via one of the methods listed [on our support page](https://helium.nebra.com). assets: repository: type: blob.asset diff --git a/balena/config/config.txt.controllino b/balena/config/config.txt.controllino new file mode 100644 index 00000000..aecee5e0 --- /dev/null +++ b/balena/config/config.txt.controllino @@ -0,0 +1,10 @@ +core_freq=400 +dtoverlay=spi0-1cs +dtparam=i2c_arm=on +dtparam=spi=on +dtparam=audio=on +avoid_warnings=1 +disable_overscan=1 +disable_splash=1 +gpu_mem=16 +gpio=17=op,dh diff --git a/balena/config/config.txt.nebra-raspi b/balena/config/config.txt.nebra-raspi new file mode 100644 index 00000000..49451ce4 --- /dev/null +++ b/balena/config/config.txt.nebra-raspi @@ -0,0 +1,10 @@ +core_freq=250 +dtoverlay=spi1-3cs +dtoverlay=uart0,txd0_pin=32,rxd0_pin=33,pin_func=7 +dtparam=i2c_arm=on +dtparam=spi=on +dtparam=audio=on +avoid_warnings=1 +disable_overscan=1 +disable_splash=1 +gpu_mem=16 diff --git a/balena/config/config.txt.pisces b/balena/config/config.txt.pisces new file mode 100644 index 00000000..575eff9a --- /dev/null +++ b/balena/config/config.txt.pisces @@ -0,0 +1,11 @@ +core_freq=400 +dtoverlay=spi0-1cs +dtoverlay=vc4-fkms-v3d +dtparam=i2c_arm=on +dtparam=spi=on +dtparam=audio=on +dtparam=i2c_vc=on +avoid_warnings=1 +disable_overscan=1 +disable_splash=1 +gpu_mem=16 diff --git a/balena/config/config.txt.pycom b/balena/config/config.txt.pycom new file mode 100644 index 00000000..a57b36eb --- /dev/null +++ b/balena/config/config.txt.pycom @@ -0,0 +1,13 @@ +core_freq=400 +dtoverlay=spi0-1cs +dtoverlay=vc4-fkms-v3d +dtparam=i2c_arm=on +dtparam=spi=on +dtparam=audio=on +dtparam=i2c_vc=on +avoid_warnings=1 +disable_overscan=1 +disable_splash=1 +gpu_mem=16 +gpio=25=op,dh +gpio=13=op,dh diff --git a/balena/config/config.txt.rak b/balena/config/config.txt.rak new file mode 100644 index 00000000..70ca46e3 --- /dev/null +++ b/balena/config/config.txt.rak @@ -0,0 +1,10 @@ +core_freq=400 +dtoverlay=spi0-1cs +dtoverlay=vc4-fkms-v3d +dtparam=i2c_arm=on +dtparam=spi=on +dtparam=audio=on +avoid_warnings=1 +disable_overscan=1 +disable_splash=1 +gpu_mem=16 diff --git a/balena/config/config.txt.risinghf b/balena/config/config.txt.risinghf new file mode 100644 index 00000000..8caf1907 --- /dev/null +++ b/balena/config/config.txt.risinghf @@ -0,0 +1,11 @@ +dtoverlay=vc4-kms-v3d +max_framebuffers=2 +arm_64bit=1 +dtparam=i2c_arm=on +dtoverlay=uart1,txd1_pin=32,rxd1_pin=33 +core_freq=400 +dtoverlay=sdio,poll_once=off +dtparam=watchdog=on +dtparam=spi=on +dtparam=audio=on +dtoverlay=spi1-1cs diff --git a/balena/config/config.txt.sensecap b/balena/config/config.txt.sensecap new file mode 100644 index 00000000..b48c97aa --- /dev/null +++ b/balena/config/config.txt.sensecap @@ -0,0 +1,9 @@ +core_freq=400 +dtoverlay=spi0-1cs +dtparam=i2c_arm=on +dtparam=spi=on +dtparam=audio=on +avoid_warnings=1 +disable_overscan=1 +disable_splash=1 +gpu_mem=16 diff --git a/balena/workflows/update-action-prod.yml b/balena/workflows/update-action-prod.yml new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/balena/workflows/update-action-prod.yml @@ -0,0 +1 @@ + diff --git a/how_to_add_new_hotspot.md b/how_to_add_new_hotspot.md index ce0aa3fc..5b665b0c 100644 --- a/how_to_add_new_hotspot.md +++ b/how_to_add_new_hotspot.md @@ -53,6 +53,62 @@ Here, you can find an example for such variant: **Important Note:** GPIO index numbers used for parameters like `BUTTON` or `STATUS` are getting their values from CPU GPIO peripheral. So the developer should not mix them with CPU's or any connectors (like HAT connector) pin numbers. The corresponding GPIO index number of a particular physical pin could be found on the hardware design document of the new hotspot. +#### FRIENDLY +It is the human readable and explanatory name of the device.# How To Add A New Hotspot Into Nebra Firmware + +The Nebra firmware stack has been designed to support various different architectures and vendors. Hence it is very flexible by design. But this also gives the developers a responsibility about supplying correct hardware configuration. + +This configuration information has to be supplied in different places of the stack. Let's review them one by one. + +## Checklist for adding a new hotspot type + +* Add variant into `variant_definitions` in hm-pyhelper repository +* Create custom inputs (e.g. additional buttons) and outputs (e.g. additional LED's) in the new variant and update the logic in other repositories if necessary. +* Release and publish it via CI/CD pipeline +* Bump hm-pyhelper for hm-pktfwd, hm-diag and hm-config repositories and push them to create necessary docker images (could take a while) (Example [pull request](https://github.com/NebraLtd/hm-config/pull/169) for hm-config in such case) +* Create related production Balena fleets (will be called just fleets from now on) as "helium--[variant]-[frequency]-[user]" (parameters in brackets are optional) +* Edit configuration parameters of the fleet +* Add `VARIANT` and `FREQ` environment variables into fleet variables +* Update automation steps in this repository for newly created fleets +* Add sentry environment variables into fleet variables +* Modify `generate-images.sh` from NebraLtd/hotspot-production-images repo root. +* Modify `generate-urls.sh` from NebraLtd/hotspot-production-images repo root. +* Modify `generate-images.yml` from NebraLtd/hotspot-production-images repo under `.github/workflows` folder. +* Modify `settings.ini` file if necessary + +## Defining the variant in hm-pyhelper project and releasing it + +As its name suggests, the NebraLtd/hm-pyhelper repository is designed as a helper library and is not a directly executable container project. It is used in various projects as a library and hence needs to be published to pypi.org to make a change effective in other projects. Thankfully it is automatically updated with the help of our CI/CD pipeline. + +The first task would be creating a variant in [`variant_definitions`](https://github.com/NebraLtd/hm-pyhelper/blob/06a752a196e05a602506db1b779a5fa62fd55f3d/hm_pyhelper/hardware_definitions.py#L31) dictionary from [hardware_definitions.py](https://github.com/NebraLtd/hm-pyhelper/blob/master/hm_pyhelper/hardware_definitions.py) file. + +### Example Variant +Here, you can find an example for such variant: + +``` +'NEBHNT-IN1': { + 'FRIENDLY': 'Nebra Indoor Hotspot Gen 1', + 'APPNAME': 'Indoor', + 'SPIBUS': 'spidev1.2', + 'KEY_STORAGE_BUS': '/dev/i2c-1', + 'RESET': 38, + 'MAC': 'eth0', + 'STATUS': 25, + 'BUTTON': 26, + 'ECCOB': True, + 'TYPE': 'Full', + 'CELLULAR': False, + 'FCC_IDS': ['2AZDM-HNTIN'], + 'CONTAINS_FCC_IDS': ['2AHRD-EPN8531', '2AB8JCSR40', '2ARPP-GL5712UX'], + 'IC_IDS': ['27187-HNTIN'], + 'CONTAINS_IC_IDS': [] + }, +``` + +### Variant Parameters + +**Important Note:** GPIO index numbers used for parameters like `BUTTON` or `STATUS` are getting their values from CPU GPIO peripheral. So the developer should not mix them with CPU's or any connectors (like HAT connector) pin numbers. The corresponding GPIO index number of a particular physical pin could be found on the hardware design document of the new hotspot. + #### FRIENDLY It is the human readable and explanatory name of the device. @@ -65,6 +121,14 @@ The LoRa concentrator hardware is designed to work on a SPI (Serial Peripheral I #### KEY_STORAGE_BUS All hotspots has to have a valid cryptography integrated circuit (IC), which is called ECC. This IC works on I2C bus and this parameter is defining the Linux IO device path for this particular I2C bus. Unlike SPIBUS, this path has to be absolute. +#### SWARM_KEY_URI +This is the new format of the ECC device specification [gateway-mfr-rs v0.2.1](https://github.com/helium/gateway-mfr-rs/tree/4c8f7b4b9c488099afd67b32c5951c5049e11a81#addressing). + +Format: `ecc:[:address][?slot=]` +- dev the device file name (usually begins with i2c or tty) +- address the bus address (default 96) +- slot the slot to use for key lookup/manipulation (default: 0) + #### RESET This is the GPIO index of the digital output, which is connected to the RF Concentrator chip (e.g. SX1301, SX1302 ...) reset. @@ -153,6 +217,123 @@ Sentry API endpoint for `diagnostics` container. Sentry API endpoint for `packet_forwarder` container. +## Modifying hotspot-production-images repo +This repo is used to create production images for the devices. The scripts in the repo could be used with automation pipeline or manually. The YAML files under the `.github/workflows` folder are the CI/CD automation pipeline configurations. + +### Modifying generate-images.sh +Usually adding the new device type into [the three lines](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L12) should be enough if the new device will need an image for all variant and frequency combinations. + +If not, like RAK, then the device should be also included in [the if clause](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L301). + +If the device needs config.txt injection like our RaspberryPi based miners or RAK, then this should be indicated in [this if clause](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L105). Also if it need a different configuration than the default, a new type of `config.txt.` has to be created in root folder and this has to be supplied in [the necessary if clause](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L122) + +### Modifying generate-urls.sh +This script is used for creating URL's which are posted to our Slack channel. This way, the manufacturer(s) would be able to see the updates automatically and use the most recent one in production. It has be in sync with `generate-images.sh` as the URL's would be pointing the URLs actually created and uploaded by it. + +### Modifying generate-images.yml +The CI/CD automation has to be updated for the new device type. Usually addition to the [pipeline matrix](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/.github/workflows/generate-images.yml#L16) would be enough. But if it needs special exclusions, like RAK device, then it would be necessary to add those into the [exclude](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/.github/workflows/generate-images.yml#L19) section. + +## Modifying settings.ini +The necessary `docker-compose.yml` file is created by the `gen_docker_compose.py` script via consuming the parameters from the `settings.ini` file. The current logic includes also a hardware definition for CPU architecture and I2C bus device. It is not strictly necessary to add those if they are equal to an existing option (Like similarity between Nebra RasPi devices and RAK devices). + + +#### APPNAME +Explains usage detail + +#### SPIBUS +The LoRa concentrator hardware is designed to work on a SPI (Serial Peripheral Interface) Bus. This has to be defined as found in Linux IO device, which should be found in `/dev` path. + +#### KEY_STORAGE_BUS +All hotspots has to have a valid cryptography integrated circuit (IC), which is called ECC. This IC works on I2C bus and this parameter is defining the Linux IO device path for this particular I2C bus. Unlike SPIBUS, this path has to be absolute. + +#### RESET +This is the GPIO index of the digital output, which is connected to the RF Concentrator chip (e.g. SX1301, SX1302 ...) reset. + +For a correct RF Concentrator opearation, the concentrator chip has to be reset between configuration changes. It is reset at the start of the `packet_forwarder` container. This is the primary source of the problem if a concentrator is not functioning as expected. + +#### MAC +This parameter defines which network interface is used for MAC (Media Access Control) code. It has to be found in the devices network interfaces. + +#### STATUS +This is the hotspots status LED's output GPIO index, which is usually a single green LED on most SBC's. + +#### BUTTON +This parameter defines the GPIO input for Bluetooth advertisement start. + +Hotspots needed to be accessed via Bluetooth sometimes. Especially at the beginning, onboarding time. But keeping the required Bluetooth interface on all the time imposes two problems. Firstly, it is a security threat and leaks some information to trace the devices. It also effects power consumption negatively as the device is expected to work 7/24. + +This input triggers the Bluetooth advertisement process and then the user can access it via Bluetooth interface. + +#### ECCOB +Indicates whether the ECC is onboard or not. It is a bool parameter. + +#### TYPE +Defines Helium Miner type (e.g. Full, Light etc.) + +#### CELLULAR +Defines whether the device has cellular (mobile) hardware or not. It's a bool parameter. + +#### FCC_IDS, IC_IDS +ID's given to the device by the regulatory bodies. They are only required for Nebra hotspots as used for label printing in the production. + +#### CONTAINS_FCC_IDS, CONTAINS_IC_IDS +The regulatory body ID's which could be found on inner modules like a cellular modem or concentrator module. They are only required for Nebra hotspots as used for label printing in the production. + +## Adding automation steps +If the new hotspot type would need a new fleet, as we do right now, it would need some changes on our automation pipeline. + +The developer should add necessary steps into the GitHub Action files which could be found [here](https://github.com/NebraLtd/helium-miner-software/tree/master/.github/workflows) + +## Modifying settings.ini +The new hotspot could need to define another I2C bus path. Then it needed to be added into the settings.ini file and `gen_docker_compose.py` file needs to be updated, if necessary. + +## Defining configuration parameters in the Balena Fleet +A single board computer generally wouldn't have a BIOS due to constraints. Therefore manufacturers like Raspberry Pi Foundation created a clever way to keep boot parameters on the device. For example there is a `config.txt` file under `/boot` for Rasspberry Pi SBC's and it defines the parameters which is cruical to make the device work properly. + +In Balena, such critical parameters are defined in Fleet Configuration and passed down to the device. So before adding a new device type into a new fleet configuration parameters need to be set in Fleet Configuration. + +## Defining variant and frequency in the Belana Fleet +There are two critical parameters which has to be defined in a Balena Fleet before adding a new device into it. + +### VARIANT +This parameter defines which variant will be used in the whole firmware stack. The name is the key from the `variant_definitions` dictionary which is detailed above. + +**Example:** +| Name | Value | Service +|------|-------|-------- +| VARIANT | NEBHNT-IN1 | All Services + +### FREQ +Like in many things, the world also has been divided about the RF frequency spectrum. So fleets are separated also with their center frequencies because hotspots acts differently regarding to their RF bands. + +If this parameter wouldn't be defined in a fleet, the `packet_forwarder` container could not progress further and waits for this parameters in a restart loop. + +The expected values are: 470, 868 and 915. + +**Example:** +| Name | Value | Service +|------|-------|-------- +| FREQ | 868 | All Services + +### HELIUM_MINER_HEIGHT_URL +This parameter is added to test fleets. It is an API endpoint used for fetching current miner height from Stakejoy API. Current value is [this link](https://fuzzy-marmalade-warlock.skittles.stakejoy.com/v1/blocks/height) + +### OVERRIDE_CONFIG_URL +This parameter is added to test fleets. It helps testing new miner configurations. Current value is [this link](https://helium-assets-stage.nebra.com/docker.config) + +### Sentry Entries +We use Sentry.io for monitoring the performance and status of our hotspots. Every critical container needs a Sentry API endpoint address. + +#### SENTRY_CONFIG +Sentry API endpoint for `gateway_config` container. + +#### SENTRY_DIAG +Sentry API endpoint for `diagnostics` container. + +#### SENTRY_PKTFWD +Sentry API endpoint for `packet_forwarder` container. + + ## Modifying hotspot-production-images repo This repo is used to create production images for the devices. The scripts in the repo could be used with automation pipeline or manually. The YAML files under the `.github/workflows` folder are the CI/CD automation pipeline configurations. diff --git a/requirements.txt b/requirements.txt index 121834fd..ce117099 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -jinja2==3.0.2 +jinja2==3.1.2 hm-pyhelper==0.14.0 diff --git a/tests/test_output.py b/tests/test_output.py deleted file mode 100644 index 29b8ad69..00000000 --- a/tests/test_output.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Test cases for confirming that generated docker compose files are valid.""" - -import sys -import unittest -from os import unlink -from subprocess import check_call -from gen_docker_compose_by_variant import DockerComposer -from os.path import abspath, dirname, join, exists - -here = dirname(abspath(__file__)) -parent = dirname(here) -template_file = 'docker-compose.template' -output_file = join(here, 'dc.yml') -variant_type = "nebra-indoor2" - -sys.path.insert(1, parent) - - -class TestValidComposeFileOutput(unittest.TestCase): - - def setUp(self) -> None: - self._remove_output_files() - return super().setUp() - - def tearDown(self) -> None: - self._remove_output_files() - return super().tearDown() - - def _remove_output_files(self): - if exists(output_file): - unlink(output_file) - - def test_compose_output_is_valid(self): - # Uncomment line below if want to test custom templates. - # dc = DockerComposer(templates_folder=templates_folder) - dc = DockerComposer() - print(f"Output File: {output_file}") - dc.generate_compose_file(variant_type, template_file, output_file) - - # On failure or non-zero return code this returns CalledProcessError - # so if this runs without that, it's considered successful as - # `docker-compose config -q` returns 1 on invalid config - check_call( - f'docker-compose -f {output_file} config -q', shell=True) From 60b9f4153e191a14f5605060df581f1577166a59 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Mon, 10 Apr 2023 22:42:08 +0300 Subject: [PATCH 25/26] All problems ironed out Gateway-rs container correctly gets all keys and region No need to maintain settings file --- docker-compose.yml | 133 ++++++++++++++++++++++++++++++ gen_docker_compose_by_variant.py | 1 - requirements.txt | 3 +- settings.ini | 4 +- templates/docker-compose.template | 6 +- test-requirements.txt | 3 +- 6 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..5806e8d0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,133 @@ +version: '2' + +services: + + gateway-config: + image: nebraltd/hm-config:1f564d0 + depends_on: + - dbus-session + - helium-miner + - diagnostics + environment: + - FIRMWARE_VERSION=v1.0.0-RC48 + - FIRMWARE_SHORT_HASH=FFFFFFF + - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket + - DBUS_SESSION_BUS_ADDRESS=unix:path=/session/dbus/session_bus_socket + restart: on-failure + privileged: true + network_mode: host + cap_add: + - NET_ADMIN + volumes: + - miner-storage:/var/data + - dbus:/session/dbus + - nebra:/var/nebra + labels: + io.balena.features.sysfs: 1 + io.balena.features.kernel-modules: 1 + io.balena.features.dbus: 1 + stop_signal: SIGINT + + packet-forwarder: + image: nebraltd/hm-pktfwd:c39fcf7 + depends_on: + - multiplexer + restart: always + privileged: true + network_mode: host + extra_hosts: + - "multiplexer:127.0.0.1" + volumes: + - pktfwdr:/var/pktfwd + - nebra:/var/nebra + environment: + - FIRMWARE_VERSION=v1.0.0-RC48 + - FIRMWARE_SHORT_HASH=FFFFFFF + labels: + io.balena.features.sysfs: 1 + io.balena.features.procfs: 1 + + multiplexer: + image: nebraltd/hm-multiplexer:a1fc09b + restart: always + depends_on: + - helium-miner + network_mode: host + extra_hosts: + - "helium-miner:127.0.0.1" + labels: + io.balena.features.sysfs: 1 + io.balena.features.procfs: 1 + volumes: + - nebra:/var/nebra + environment: + - FIRMWARE_VERSION=v1.0.0-RC48 + - FIRMWARE_SHORT_HASH=FFFFFFF + + helium-miner: + image: nebraltd/hm-gatewayrs:arm64-ca18684 + network_mode: host + cap_add: + - SYS_RAWIO + privileged: true + restart: always + environment: + - FIRMWARE_VERSION=v1.0.0-RC48 + - FIRMWARE_SHORT_HASH=FFFFFFF + volumes: + - pktfwdr:/var/pktfwd + - miner-storage:/var/data + + diagnostics: + image: nebraltd/hm-diag:arm64-5bc4892 + depends_on: + - dbus-session + environment: + - FIRMWARE_VERSION=v1.0.0-RC48 + - FIRMWARE_SHORT_HASH=FFFFFFF + - DIAGNOSTICS_VERSION=5bc4892 + - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket + volumes: + - pktfwdr:/var/pktfwd + - miner-storage:/var/data + - watchdog-log:/var/watchdog + - nebra:/var/nebra + network_mode: host + extra_hosts: + - "helium-miner:127.0.0.1" + cap_add: + - SYS_RAWIO + restart: always + privileged: true + labels: + io.balena.features.sysfs: 1 + io.balena.features.procfs: 1 + io.balena.features.dbus: 1 + io.balena.features.supervisor-api: '1' + + dbus-session: + image: balenablocks/dbus:rpi-0.0.2 + restart: always + volumes: + - dbus:/session/dbus + environment: + - DBUS_ADDRESS=unix:path=/session/dbus/session_bus_socket + - FIRMWARE_VERSION=v1.0.0-RC48 + - FIRMWARE_SHORT_HASH=FFFFFFF + +volumes: + miner-storage: + pktfwdr: + dbus: + nebra: + watchdog-log: + +# balena keeps on changing the subnet, making it impossible +# to use extra_hosts for naming host IPs +networks: + default: + driver: bridge + ipam: + driver: default + config: + - subnet: 172.20.0.0/16 \ No newline at end of file diff --git a/gen_docker_compose_by_variant.py b/gen_docker_compose_by_variant.py index c17ebcc6..c1bf7894 100644 --- a/gen_docker_compose_by_variant.py +++ b/gen_docker_compose_by_variant.py @@ -72,7 +72,6 @@ def generate_compose_file( template_args["ENV"] = os.environ template_args["ARCH"] = variant_definitions[variant_type]["CPU_ARCH"] - template_args["SWARM_KEY_URI"] = variant_definitions[variant_type]["SWARM_KEY_URI"][0] output = template.render(**template_args) with open(output_file, 'w') as template_output: diff --git a/requirements.txt b/requirements.txt index ce117099..ccf9d071 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ jinja2==3.1.2 -hm-pyhelper==0.14.0 +grpcio==1.53.0 +hm-pyhelper==0.14.4 diff --git a/settings.ini b/settings.ini index 7e80f5c7..734c60dc 100644 --- a/settings.ini +++ b/settings.ini @@ -1,7 +1,7 @@ [versions] FIRMWARE_VERSION=v1.0.0-0 -DIAGNOSTICS_VERSION=94b7acd +DIAGNOSTICS_VERSION=5bc4892 CONFIG_VERSION=1f564d0 PKTFWD_VERSION=c39fcf7 -GATEWAYRS_VERSION=05c94f4 +GATEWAYRS_VERSION=b0e27e1 MULTIPLEXER_VERSION=a1fc09b diff --git a/templates/docker-compose.template b/templates/docker-compose.template index 73fdad0a..6f2850d0 100644 --- a/templates/docker-compose.template +++ b/templates/docker-compose.template @@ -60,6 +60,9 @@ services: io.balena.features.procfs: 1 volumes: - nebra:/var/nebra + environment: + - FIRMWARE_VERSION={{FIRMWARE_VERSION}} + - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} helium-miner: image: nebraltd/hm-gatewayrs:{{ARCH}}-{{GATEWAYRS_VERSION}} @@ -67,11 +70,10 @@ services: cap_add: - SYS_RAWIO privileged: true - restart: on-failure + restart: always environment: - FIRMWARE_VERSION={{FIRMWARE_VERSION}} - FIRMWARE_SHORT_HASH={{ENV.FIRMWARE_SHORT_HASH}} - - SWARM_KEY_URI={{SWARM_KEY_URI}} volumes: - pktfwdr:/var/pktfwd - miner-storage:/var/data diff --git a/test-requirements.txt b/test-requirements.txt index c89478e2..66115340 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,4 +2,5 @@ flake8==6.0.0 bandit==1.7.4 pytest==7.2.1 pytest-cov==4.0.0 -hm_pyhelper==0.14.0 +grpcio==1.53.0 +hm_pyhelper==0.14.4 From 976eae2576407cccc68cb9d585a67f685d2b4a70 Mon Sep 17 00:00:00 2001 From: Murat Ursavas Date: Tue, 11 Apr 2023 08:53:48 +0300 Subject: [PATCH 26/26] Fixed duplication issue of the new_hotspot readme --- how_to_add_new_hotspot.md | 175 +------------------------------------- 1 file changed, 1 insertion(+), 174 deletions(-) diff --git a/how_to_add_new_hotspot.md b/how_to_add_new_hotspot.md index 5b665b0c..04a2d39b 100644 --- a/how_to_add_new_hotspot.md +++ b/how_to_add_new_hotspot.md @@ -53,62 +53,6 @@ Here, you can find an example for such variant: **Important Note:** GPIO index numbers used for parameters like `BUTTON` or `STATUS` are getting their values from CPU GPIO peripheral. So the developer should not mix them with CPU's or any connectors (like HAT connector) pin numbers. The corresponding GPIO index number of a particular physical pin could be found on the hardware design document of the new hotspot. -#### FRIENDLY -It is the human readable and explanatory name of the device.# How To Add A New Hotspot Into Nebra Firmware - -The Nebra firmware stack has been designed to support various different architectures and vendors. Hence it is very flexible by design. But this also gives the developers a responsibility about supplying correct hardware configuration. - -This configuration information has to be supplied in different places of the stack. Let's review them one by one. - -## Checklist for adding a new hotspot type - -* Add variant into `variant_definitions` in hm-pyhelper repository -* Create custom inputs (e.g. additional buttons) and outputs (e.g. additional LED's) in the new variant and update the logic in other repositories if necessary. -* Release and publish it via CI/CD pipeline -* Bump hm-pyhelper for hm-pktfwd, hm-diag and hm-config repositories and push them to create necessary docker images (could take a while) (Example [pull request](https://github.com/NebraLtd/hm-config/pull/169) for hm-config in such case) -* Create related production Balena fleets (will be called just fleets from now on) as "helium--[variant]-[frequency]-[user]" (parameters in brackets are optional) -* Edit configuration parameters of the fleet -* Add `VARIANT` and `FREQ` environment variables into fleet variables -* Update automation steps in this repository for newly created fleets -* Add sentry environment variables into fleet variables -* Modify `generate-images.sh` from NebraLtd/hotspot-production-images repo root. -* Modify `generate-urls.sh` from NebraLtd/hotspot-production-images repo root. -* Modify `generate-images.yml` from NebraLtd/hotspot-production-images repo under `.github/workflows` folder. -* Modify `settings.ini` file if necessary - -## Defining the variant in hm-pyhelper project and releasing it - -As its name suggests, the NebraLtd/hm-pyhelper repository is designed as a helper library and is not a directly executable container project. It is used in various projects as a library and hence needs to be published to pypi.org to make a change effective in other projects. Thankfully it is automatically updated with the help of our CI/CD pipeline. - -The first task would be creating a variant in [`variant_definitions`](https://github.com/NebraLtd/hm-pyhelper/blob/06a752a196e05a602506db1b779a5fa62fd55f3d/hm_pyhelper/hardware_definitions.py#L31) dictionary from [hardware_definitions.py](https://github.com/NebraLtd/hm-pyhelper/blob/master/hm_pyhelper/hardware_definitions.py) file. - -### Example Variant -Here, you can find an example for such variant: - -``` -'NEBHNT-IN1': { - 'FRIENDLY': 'Nebra Indoor Hotspot Gen 1', - 'APPNAME': 'Indoor', - 'SPIBUS': 'spidev1.2', - 'KEY_STORAGE_BUS': '/dev/i2c-1', - 'RESET': 38, - 'MAC': 'eth0', - 'STATUS': 25, - 'BUTTON': 26, - 'ECCOB': True, - 'TYPE': 'Full', - 'CELLULAR': False, - 'FCC_IDS': ['2AZDM-HNTIN'], - 'CONTAINS_FCC_IDS': ['2AHRD-EPN8531', '2AB8JCSR40', '2ARPP-GL5712UX'], - 'IC_IDS': ['27187-HNTIN'], - 'CONTAINS_IC_IDS': [] - }, -``` - -### Variant Parameters - -**Important Note:** GPIO index numbers used for parameters like `BUTTON` or `STATUS` are getting their values from CPU GPIO peripheral. So the developer should not mix them with CPU's or any connectors (like HAT connector) pin numbers. The corresponding GPIO index number of a particular physical pin could be found on the hardware design document of the new hotspot. - #### FRIENDLY It is the human readable and explanatory name of the device. @@ -181,123 +125,6 @@ There are two critical parameters which has to be defined in a Balena Fleet befo ### VARIANT This parameter defines which variant will be used in the whole firmware stack. The name is the key from the `variant_definitions` dictionary which is detailed above. -**Example:** -| Name | Value | Service -|------|-------|-------- -| VARIANT | NEBHNT-IN1 | All Services - -### FREQ -Like in many things, the world also has been divided about the RF frequency spectrum. So fleets are separated also with their center frequencies because hotspots acts differently regarding to their RF bands. - -If this parameter wouldn't be defined in a fleet, the `packet_forwarder` container could not progress further and waits for this parameters in a restart loop. - -The expected values are: 470, 868 and 915. - -**Example:** -| Name | Value | Service -|------|-------|-------- -| FREQ | 868 | All Services - -### HELIUM_MINER_HEIGHT_URL -This parameter is added to test fleets. It is an API endpoint used for fetching current miner height from Stakejoy API. Current value is [this link](https://fuzzy-marmalade-warlock.skittles.stakejoy.com/v1/blocks/height) - -### OVERRIDE_CONFIG_URL -This parameter is added to test fleets. It helps testing new miner configurations. Current value is [this link](https://helium-assets-stage.nebra.com/docker.config) - -### Sentry Entries -We use Sentry.io for monitoring the performance and status of our hotspots. Every critical container needs a Sentry API endpoint address. - -#### SENTRY_CONFIG -Sentry API endpoint for `gateway_config` container. - -#### SENTRY_DIAG -Sentry API endpoint for `diagnostics` container. - -#### SENTRY_PKTFWD -Sentry API endpoint for `packet_forwarder` container. - - -## Modifying hotspot-production-images repo -This repo is used to create production images for the devices. The scripts in the repo could be used with automation pipeline or manually. The YAML files under the `.github/workflows` folder are the CI/CD automation pipeline configurations. - -### Modifying generate-images.sh -Usually adding the new device type into [the three lines](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L12) should be enough if the new device will need an image for all variant and frequency combinations. - -If not, like RAK, then the device should be also included in [the if clause](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L301). - -If the device needs config.txt injection like our RaspberryPi based miners or RAK, then this should be indicated in [this if clause](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L105). Also if it need a different configuration than the default, a new type of `config.txt.` has to be created in root folder and this has to be supplied in [the necessary if clause](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/generate-images.sh#L122) - -### Modifying generate-urls.sh -This script is used for creating URL's which are posted to our Slack channel. This way, the manufacturer(s) would be able to see the updates automatically and use the most recent one in production. It has be in sync with `generate-images.sh` as the URL's would be pointing the URLs actually created and uploaded by it. - -### Modifying generate-images.yml -The CI/CD automation has to be updated for the new device type. Usually addition to the [pipeline matrix](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/.github/workflows/generate-images.yml#L16) would be enough. But if it needs special exclusions, like RAK device, then it would be necessary to add those into the [exclude](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/.github/workflows/generate-images.yml#L19) section. - -## Modifying settings.ini -The necessary `docker-compose.yml` file is created by the `gen_docker_compose.py` script via consuming the parameters from the `settings.ini` file. The current logic includes also a hardware definition for CPU architecture and I2C bus device. It is not strictly necessary to add those if they are equal to an existing option (Like similarity between Nebra RasPi devices and RAK devices). - - -#### APPNAME -Explains usage detail - -#### SPIBUS -The LoRa concentrator hardware is designed to work on a SPI (Serial Peripheral Interface) Bus. This has to be defined as found in Linux IO device, which should be found in `/dev` path. - -#### KEY_STORAGE_BUS -All hotspots has to have a valid cryptography integrated circuit (IC), which is called ECC. This IC works on I2C bus and this parameter is defining the Linux IO device path for this particular I2C bus. Unlike SPIBUS, this path has to be absolute. - -#### RESET -This is the GPIO index of the digital output, which is connected to the RF Concentrator chip (e.g. SX1301, SX1302 ...) reset. - -For a correct RF Concentrator opearation, the concentrator chip has to be reset between configuration changes. It is reset at the start of the `packet_forwarder` container. This is the primary source of the problem if a concentrator is not functioning as expected. - -#### MAC -This parameter defines which network interface is used for MAC (Media Access Control) code. It has to be found in the devices network interfaces. - -#### STATUS -This is the hotspots status LED's output GPIO index, which is usually a single green LED on most SBC's. - -#### BUTTON -This parameter defines the GPIO input for Bluetooth advertisement start. - -Hotspots needed to be accessed via Bluetooth sometimes. Especially at the beginning, onboarding time. But keeping the required Bluetooth interface on all the time imposes two problems. Firstly, it is a security threat and leaks some information to trace the devices. It also effects power consumption negatively as the device is expected to work 7/24. - -This input triggers the Bluetooth advertisement process and then the user can access it via Bluetooth interface. - -#### ECCOB -Indicates whether the ECC is onboard or not. It is a bool parameter. - -#### TYPE -Defines Helium Miner type (e.g. Full, Light etc.) - -#### CELLULAR -Defines whether the device has cellular (mobile) hardware or not. It's a bool parameter. - -#### FCC_IDS, IC_IDS -ID's given to the device by the regulatory bodies. They are only required for Nebra hotspots as used for label printing in the production. - -#### CONTAINS_FCC_IDS, CONTAINS_IC_IDS -The regulatory body ID's which could be found on inner modules like a cellular modem or concentrator module. They are only required for Nebra hotspots as used for label printing in the production. - -## Adding automation steps -If the new hotspot type would need a new fleet, as we do right now, it would need some changes on our automation pipeline. - -The developer should add necessary steps into the GitHub Action files which could be found [here](https://github.com/NebraLtd/helium-miner-software/tree/master/.github/workflows) - -## Modifying settings.ini -The new hotspot could need to define another I2C bus path. Then it needed to be added into the settings.ini file and `gen_docker_compose.py` file needs to be updated, if necessary. - -## Defining configuration parameters in the Balena Fleet -A single board computer generally wouldn't have a BIOS due to constraints. Therefore manufacturers like Raspberry Pi Foundation created a clever way to keep boot parameters on the device. For example there is a `config.txt` file under `/boot` for Rasspberry Pi SBC's and it defines the parameters which is cruical to make the device work properly. - -In Balena, such critical parameters are defined in Fleet Configuration and passed down to the device. So before adding a new device type into a new fleet configuration parameters need to be set in Fleet Configuration. - -## Defining variant and frequency in the Belana Fleet -There are two critical parameters which has to be defined in a Balena Fleet before adding a new device into it. - -### VARIANT -This parameter defines which variant will be used in the whole firmware stack. The name is the key from the `variant_definitions` dictionary which is detailed above. - **Example:** | Name | Value | Service |------|-------|-------- @@ -351,4 +178,4 @@ This script is used for creating URL's which are posted to our Slack channel. Th The CI/CD automation has to be updated for the new device type. Usually addition to the [pipeline matrix](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/.github/workflows/generate-images.yml#L16) would be enough. But if it needs special exclusions, like RAK device, then it would be necessary to add those into the [exclude](https://github.com/NebraLtd/hotspot-production-images/blob/3929275e5fe13950326b9c0f816f1f5d4eedf543/.github/workflows/generate-images.yml#L19) section. ## Modifying settings.ini -The necessary `docker-compose.yml` file is created by the `gen_docker_compose.py` script via consuming the parameters from the `settings.ini` file. The current logic includes also a hardware definition for CPU architecture and I2C bus device. It is not strictly necessary to add those if they are equal to an existing option (Like similarity between Nebra RasPi devices and RAK devices). +The necessary `docker-compose.yml` file is created by the `gen_docker_compose.py` script via consuming the parameters from the `settings.ini` file. The current logic includes also a hardware definition for CPU architecture and I2C bus device. It is not strictly necessary to add those if they are equal to an existing option (Like similarity between Nebra RasPi devices and RAK devices). \ No newline at end of file