Giter VIP home page Giter VIP logo

gateway-rs's Introduction

Helium Gateway

ci

The Helium Gateway application is a service designed to run on Linux-based LoRaWAN gateways.

It's intended to run alongside a typical LoRa packet forwarder and to connect via Semtech's Gateway Messaging Protocol (GWMP, using JSON v1 or v2).

In turn, the Helium Gateway application does two things:

  • fetches blockchain context, such as routing tables and OUI endpoints, from a Gateway Service; this means the application does not need to maintain a full ledger of copy of the blockchain
  • connects and routes packets to the appropriates OUI endpoints (ie: Helium Routers)
                                                                 +-----------+
+-----------+                       +------------+               |  Gateway  |
|           |                       |            |<--- gRPC ---->|  Service  |
|  packet   |<--- Semtech GWMP ---->|   Helium   |               +-----------+
| forwarder |       over UDP        |   Gateway  |               +-----------+
|           |                       |            |<--- gRPC ---->|  Helium   |
+-----------+                       +------------+               |  Routers  |
                                                                 +-----------+

The current gateway project forwards packets to the router but does not yet use state channels which means forwarded packets are not yet rewarded by the blockchain.

The project builds ipk packaged releases for Linux-based LoRa gateways. These packages attempt to be self-updating to be able to track improvements to the service. Updates are delivered through the following channels which a gateway can subscribe to by a channel setting in the update section of the settings file:

  • alpha - Early development releases. These will happen frequently as functionality is developed and may be unstable. Expect to need to log into your gateway to restart or manually fix your light gateway.
  • beta - Pre-release candidates which are considered to be stable enough for early access. Breaking issues can still happen but should be rare.
  • release - The main release channel. Updates are considered to be stable for all platforms.
  • semver - This is the default channel and selects the channel based on the installed package version identifier.

NOTE: Gateways should have at least 16Mb of available application file space to handle gateway installation and updates.

Linux Dependencies

This application requires a Linux-based environment for two big reasons:

  • tokio: the gateway-rs application, written in Rust, depends on Tokio for its runtime. Tokio binds to Linux interfaces such as epoll and kqeueue. It is technically possible to port Tokio to another OS or RTOS (this has been done for Windows), but it would be no simple undertaking.
  • curl: for fetching releases over SSL, curl is used. This was a simple way to use SSL without bloating the helium_gateway binary with additional libraries. Note that the updater may be disabled and thus this dependency may be removed.

Installing

If your supported LoRa gateway did not come with helium-gateway pre-installed, manual installation requires you to:

  1. Configure the packet forwarder on the gateway to forward to the helium-gateway application. This varies per gateway but the goal is to set the packet forwarder to forward to the (default) configured helium-gateway on 127.0.0.1 at udp port 1680

  2. Set up ssh acccess to the gateway. Depending on the gateway that may require going through a web interface, while others already have ssh configured.

  3. scp a downloaded release package for the supported platform to the gateway. e.g.

    scp helium-gateway-<version>-<platform>.ipk <gateway>:/tmp/
  4. ssh into the device and install the service using a command like:

    opkg install /tmp/helium-gateway-<version>-<platform>.ipk

    or

    dpkg --install /tmp/helium-gateway-<version>-<platform>.deb

    NOTE: Some platform have custom package installation requirements. Refer to the developer instructions for that platform on how to install a package.

    The default region of the gateway is US915, if your region is different you can set the right one in /etc/helium_gateway/settings.toml. Just add the following line :

    region = "<region>"

    Possible values are : US915| EU868 | EU433 | CN470 | CN779 | AU915 | AS923_1 | AS923_2 | AS923_3 | AS923_4 | KR920 | IN865. After updating the value you need to restart the service :

    /etc/init.d/helium_gateway restart

If this command succeeds the logs on the gateway will show the service starting and the local packet forwarder client connecting to the gateway service.

Supported Platforms

The following platforms have already been tested by Helium and our community. Our plan is to test this on all relevant hardware platforms used by the Helium Network. If your preferred platform isn't listed yet, here's how to get it added.

  • Review the open issues to see if it's already in progress. If not, file an issue.
  • Join the #gateway channel on Helium Discord and let us know what platform we're missing.

Note that platforms will be tested much faster if you join the development process!

Platform Target Products
ramips_24kec mipsel-unknown-linux-musl RAK833 EVB Kit
RAK7258 (WisGate Edge Lite)
RAK7249 (WisGate Edge Max)
RAK7240 (WisGate Edge Prime)
klkgw armv7-unknown-linux-musleabihf ✅ Kerlink Wirnet iFemtoCell Evolution
dragino mips-unknown-linux-musl ✅ Dragino LPS8
❔ Dragino DLOS8
mtcdt armv5te-unknown-linux-musleabi ✅ Multitech Conduit MTCDT (mLinux)
resiot armv7-unknown-linux-gnueabihf ✅ ResIOT X gateways resiot
cotx aarch64-unknown-linux-gnu ✅ Cotx X3 gateways cotx
x86_64 x86_64-unknown-linux-gnu ✅ Debian x86_64
raspi01 arm-unknown-linux-gnueabihf ❔ Raspberry Pi 0 or 1 running Raspian / Raspberry Pi OS or another Debian-based Linux distro
raspi234 armv7-unknown-linux-gnueabihf ❔ Raspberry Pi 2, 3, or 4 running Raspian / Raspberry Pi OS or another Debian-based Linux distro

Building

Use one of the existing releases if you can, or build your own by hand using the instructions below.

If you want to support a new platform, please consider submitting a PR to get the package as part of the supported matrix of gateway platforms!

  1. Install rust
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Install cargo cross, cargo-make, and, if needed, cargo-deb. The cross command allows for cross compiling to hardware targets using docker images, while the cargo-make command is used to package up. If creating a deb package, cargo-deb is also needed.
    cargo install cross
    cargo install cargo-make
    cargo install cargo-deb
  3. Build the application or package using one of the following:
    1. Build the application binary using the target triplet from the supported targets. Note the use of the --release flag to optimize the target binary for size. Debug builds may be to large to run on some targets.

      cross build --target <target> --release

      The resulting application binary is located in

      target/<target>/release/helium_gateway
      
    2. Build an application package using one of the target system profile names

      cargo make --profile <platform> pkg

      The resulting ipk or deb will be located in

      target/ipk/helium-gateway-<version>-<platform>.<ipk or deb>
      

gateway-rs's People

Contributors

madninja avatar paulvmo avatar lthiery avatar jaykickliter avatar abhay avatar cotxliang avatar pharkmillups avatar said026 avatar stevenresiot avatar amit2n avatar fishpepper avatar

Watchers

James Cloos 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.