Git Product home page Git Product logo

hm-config's Introduction

hm-config: Helium Miner Config Container

This repository contains the Dockerfile, basic scripts and additional libraries required for the BTLE Application tool. helium/gateway-config is the upstream repo that this is built against.

Directory layout:

  • .github/: Github workflows and other settings.
  • example/: Files that are examples of what will be loaded on an actual hotspot. These files are especially useful for testing without a full hotspot.
  • gatewayconfig/: The main Python application.
  • lib/: Python files copied from other reposittories.
  • protos/: Protobuf definitions. Generated protos go to gatewayconfig/protos/ by default.
  • tests/: Test files.

Local development environment

Running locally:

PYTHONPATH=./ MINER_KEYS_FILEPATH=./example/onboarding_key.txt ETH0_MAC_ADDRESS_PATH=./example/eth0_mac_address.txt python minerconfig

Because the stack is tightly intertwined with Balena, the easiest way to test the code base on your own Raspberry Pi in your own Balena project. The code has been developped and tested with the Raspberry Pi 3 B+. There are a few ways to build this app:

  1. Cross-compile locally and deploy to Balena: balena deploy dev-XXX --build (preferred method)
  2. Cross-compile locally only: docker buildx build --platform linux/arm64 .
  3. ARM build on Balena: git push balena YourLocalBranch:master (deprecated)
  4. Build directly on device with local mode: balena push local (over 10 hours)
balena deploy hm-diag --build --debug

Balena setup

  • Create a new Balena project for Raspberry Pi 3 (64 Bit)
  • Download and flash out the disk image provided and boot the device
  • Add the remote Balena repo (git remote add balena [email protected]:BALENA_USERNAME/BALENA_PROJECT.git)
  • The following ENV variables must be set: FREQ, SENTRY_CONFIG, SENTRY_DIAG, SENTRY_PKTFWD, and VARIANT
  • Add the remote Balena repo (git remote add balena [email protected]:YourUser/YourProject.git)

You can now push your changes using the following command:

$ git push balena YourLocalBranch:master

Setting up Python on Ubuntu

These are optional instructions to have an Ubuntu environment closely mimic production.

  1. Install pyenv: curl https://pyenv.run | bash
  2. Install Python 3.7.3 dependency:
sudo apt-get install -y libffi-dev libssl-dev make build-essential libssl-dev zlib1g-dev libbz2-dev \
    libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
    xz-utils tk-dev libffi-dev liblzma-dev python-openssl git \
     libdbus-glib-1-dev libgirepository1.0-dev python3-gi bluez
  1. Install Python 3.9.16: pyenv install 3.9.16 && pyenv local 3.9.16
  2. Check correctly installed: python -V
  3. Setup virtualenv: python3 -m venv venv && source venv/bin/activate
  4. Install python wheel package: python3 -m pip install wheel
  5. Install poetry package: python3 -m pip install poetry
  6. Install dependencies: poetry install --with dev

Testing

Assuming virtualenv has been activated, execute the following command to run the tests:

poetry install --with dev
poetry run pytest --cov=gatewayconfig --cov=lib --cov-fail-under=70

Generating protobufs

  • Install protobuf
    • Ubuntu: sudo snap install protobuf
    • Mac: brew install protobuf (also see here)
  • Run generate-protos.sh
    • sh protos/generate-protos.sh or simply protos/generate-protos.sh if it is executable

Pre built containers

This repo automatically builds docker containers and uploads them to two repositories for easy access:

The images are tagged using the docker long and short commit SHAs for that release. The current version deployed to miners can be found in the helium-miner-software repo.

hm-config's People

Contributors

ryanteck avatar shawaj avatar vpetersson avatar posterzh avatar marvinmarnold avatar pritamghanghas avatar ccrisan avatar muratursavas avatar ilyastrodubtsev avatar kashifpk avatar kevinwassermann94 avatar robputt avatar kerrryu avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.