From fdd29af43483c854a37e5ad7a8ff8b0f09965126 Mon Sep 17 00:00:00 2001 From: Timothy Sealy Date: Thu, 6 Apr 2017 20:42:59 +0200 Subject: [PATCH 1/3] Update README.md Added troubleshooting information on push remote resin error. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index e604c20..28f6f33 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,19 @@ RESIN_HOST_CONFIG_core_freq | 250 git commit -m "first upload of ttn files to resin" git push -f resin master ``` + + **Troubleshooting:** + If you get the error below please check if your ssh public key has been added to you resin account. In addition verify whether your private key has the correct permissions (i.e. chmod 400 ~/.ssh/id_rsa). + + ```bash + $ git push -f resin master + Connection closed by xxx.xxx.xxx.xxx port 22 + fatal: Could not read from remote repository. + + Please make sure you have the correct access rights + and the repository exists. + $ + ``` 5. What you'll now see happening in terminal is that this "git push" does an incredible amount of work: 1. It will upload a Dockerfile, a "build script", and a "run script" to resin 2. It will start to do a "docker build" using that Dockerfile, running it within a QEMU ARM virtual machine on the resin service. From e3ffbcc42b546da2e97ca3cac0cc984da9a8cd9f Mon Sep 17 00:00:00 2001 From: JP Meijers Date: Fri, 7 Apr 2017 00:07:40 +0200 Subject: [PATCH 2/3] Update README.md --- README.md | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 28f6f33..cf20a40 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,11 @@ This resin.io setup is based on the [Multi-protocol Packet Forwarder by Jac Kers If you want a stable gateway setup, stick to the [old poly-packet-forwarder resin.io setup](https://github.com/rayozzie/ttn-resin-gateway-rpi) for now. You will be able to update from the old one to this repo quite seamlessly in the future. +## Difference between Poly-packet-forwarder and Multi-protocol-packet-forwarder +mp-pkt-fwd uses the new protocolbuffers-over-mqtt-over-tcp protocol for gateways, as defined by TTN and used by the TTN kickstarter gateway. Using this protcol the gateway is authenticated, which means it is registered under a specific user and can thus be trusted. Because it uses TCP, the chance of packet loss is much lower than with the previous protocol that used UDP. Protocolbuffers packs the data in a compact binary mode into packets, using much less space than the plaintext json that was previously used. It should therefore consume less bandwidth. + +When you use this repository, the settings you set on the TTN console are taken as the primary settings. The settings from the console are read and applied at gateway startup. If you for example change the location of the gateway on the console, that setting will only be applied when the gateway restarts. + # Resin.io TTN Gateway Connector for Raspberry Pi Resin Dockerfile & scripts for [The Things Network](http://thethingsnetwork.org/) gateways based on the Raspberry Pi. This updated version uses the gateway connector protocol, not the old packet forwarder. See the [TTN documentation on Gateway Registration](https://www.thethingsnetwork.org/docs/gateways/registration.html). @@ -80,7 +85,7 @@ If you get the message after resin.io is finished downloading the application, or when restarting the gateway, it most likely means the `GW_RESET_PIN` you defined is incorrect. -## SPECIAL Note for using the LinkLabs gateway on a Raspberry Pi 3 +## Special note for using the LinkLabs gateway on a Raspberry Pi 3 There is a backward incomatibility between the Raspberry Pi 1 and 2 hardware, and Raspberry Pi 3. For Raspberry Pi 3, it is necessary to make a small additional configuration change. @@ -117,9 +122,19 @@ RESIN_HOST_CONFIG_core_freq | 250 git commit -m "first upload of ttn files to resin" git push -f resin master ``` + +5. What you'll now see happening in terminal is that this "git push" does an incredible amount of work: + 1. It will upload a Dockerfile, a "build script", and a "run script" to resin + 2. It will start to do a "docker build" using that Dockerfile, running it within a QEMU ARM virtual machine on the resin service. + 3. In processing this docker build, it will run a "build.sh" script that downloads and builds the packet forwarder executable from source code, for RPi+iC880A-SPI. + 4. When the build is completed, you'll see a unicorn 🦄 ASCII graphic displayed in your terminal. - **Troubleshooting:** - If you get the error below please check if your ssh public key has been added to you resin account. In addition verify whether your private key has the correct permissions (i.e. chmod 400 ~/.ssh/id_rsa). +6. Now, switch back to your device dashboard, you'll see that your Raspberry Pi is now "updating" by pulling the Docker container from the resin.io service. Then, after "updating", you'll see the gateway's log file in the window at the lower right corner. You'll see it initializing, and will also see log output each time a packet is forwarded to TTN. You're done! + + + +## Troubleshooting ## +If you get the error below please check if your ssh public key has been added to you resin account. In addition verify whether your private key has the correct permissions (i.e. chmod 400 ~/.ssh/id_rsa). ```bash $ git push -f resin master @@ -130,27 +145,20 @@ RESIN_HOST_CONFIG_core_freq | 250 and the repository exists. $ ``` -5. What you'll now see happening in terminal is that this "git push" does an incredible amount of work: - 1. It will upload a Dockerfile, a "build script", and a "run script" to resin - 2. It will start to do a "docker build" using that Dockerfile, running it within a QEMU ARM virtual machine on the resin service. - 3. In processing this docker build, it will run a "build.sh" script that downloads and builds the packet forwarder executable from source code, for RPi+iC880A-SPI. - 4. When the build is completed, you'll see a unicorn 🦄 ASCII graphic displayed in your terminal. - -6. Now, switch back to your device dashboard, you'll see that your Raspberry Pi is now "updating" by pulling the Docker container from the resin.io service. Then, after "updating", you'll see the gateway's log file in the window at the lower right corner. You'll see it initializing, and will also see log output each time a packet is forwarded to TTN. You're done! - -## PRO TIPS + +# Pro Tips - At some point if you would like to add a second gateway, third gateway, or a hundred gateways, all you need to do is to add a new device to your existing Application. You needn't upload any new software to Resin, because Resin already knows what software belongs on the gateway. So long as the environment variables are configured correctly for that new device, it'll be up and running immediately after you burn an SD card and boot it. - Resin will automatically restart the gateway software any time you change the environment variables. You'll see this in the log. Also, note that Resin restarts the gateway properly after power failures. If the packet forwarder fails because of an error, it will also automatically attempt to restart. - If you'd like to update the software across all the gateways in your device fleet, simply do the following: - - Edit the Dockerfile to bump the TTN_GATEWAY_VERSION number + ``` git add . git commit -m "Updated gateway version" git push -f resin master" - + ``` + - For devices without a GPS, the location that is configured on the TTN console is used. This location is only read at startup of the gateway. Therefore, after you set or changed the location, restart the application from the resin.io console. # Credits From f1c21afa7f5bf4840383574dbd35a9a8577c3600 Mon Sep 17 00:00:00 2001 From: JP Meijers Date: Sun, 7 May 2017 20:33:32 +0200 Subject: [PATCH 3/3] Update README.md Remove beta --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cf20a40..98be285 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ -# WARNING: Beta, unstable, testing software -This resin.io setup is based on the [Multi-protocol Packet Forwarder by Jac Kersing](https://github.com/kersing/packet_forwarder/tree/master/mp_pkt_fwd). His packet forwarder, as well as this resin.io setup, are changing constantly. You therefore need to `git pull origin master` and `git push -f resin master` at least once a week to make sure your gateway is running the latest software. - -If you want a stable gateway setup, stick to the [old poly-packet-forwarder resin.io setup](https://github.com/rayozzie/ttn-resin-gateway-rpi) for now. You will be able to update from the old one to this repo quite seamlessly in the future. +# Introduction +This resin.io setup is based on the [Multi-protocol Packet Forwarder by Jac Kersing](https://github.com/kersing/packet_forwarder/tree/master/mp_pkt_fwd). ## Difference between Poly-packet-forwarder and Multi-protocol-packet-forwarder mp-pkt-fwd uses the new protocolbuffers-over-mqtt-over-tcp protocol for gateways, as defined by TTN and used by the TTN kickstarter gateway. Using this protcol the gateway is authenticated, which means it is registered under a specific user and can thus be trusted. Because it uses TCP, the chance of packet loss is much lower than with the previous protocol that used UDP. Protocolbuffers packs the data in a compact binary mode into packets, using much less space than the plaintext json that was previously used. It should therefore consume less bandwidth.