Run your private The Things Stack network server on a Raspberry Pi with balena

Hello. I’m new to the community and a bit of a noob with using Balena, but followed the guide and got the stack installed, but when I tried to access the webpage (IP address is reserved in my router) it wouldn’t load due to ‘too many redirects’.

I’d like to try and create a ‘on premise’ private solution with gateway incorporated.

I’m not sure where I’m going wrong?

Thanks

1 Like

@t_judd1 welcome to the balena community!

did you try with the Public device URL?

Hi, no I didn’t unfortunately. I figured I’d screwed something up so decided to try and start again.

I followed this guide the-things-stack-basicstation-balena trying to build it manually and push to the fleet. I did this part, modified the docker-compose.yml file and uncomment the BasicStation service

cd ~/workspace
git clone https://github.com/xoseperez/balena-tts-lns.git
cd balena-tts-lns
git submodule update --init

but when I tried to push it, I got this error

I’m kinda stuck now.

@t_judd1 what device are you using?

@mpous Pi 3 model B

1 Like

Thank you @t_judd1 let me try to reproduce this on a Pi 3 model B. BTW what device type did you choose on your fleet on balenaCloud?

Could you please confirm that you are running a fleet with Pi 3 (32 bits)?

Thank you @mpous, appreciate the help.

On balenaCloud I selected standard Pi 3 as attached


e

@t_judd1 share a screenshot of your fleet to see the Device Type of the fleet please

Hi @mpous. Screenshot attached. Thanks

@t_judd1 it’s weird that you don’t have any release due the error that you shared before.

This is what i did:

mp@Marc-macbook balena % mkdir the-things-stack

mp@Marc-macbook balena % cd the-things-stack

mp@Marc-macbook the-things-stack % git clone https://github.com/xoseperez/balena-tts-lns.git
Cloning into 'balena-tts-lns'...
remote: Enumerating objects: 116, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 116 (delta 24), reused 22 (delta 22), pack-reused 89
Receiving objects: 100% (116/116), 303.33 KiB | 1.27 MiB/s, done.
Resolving deltas: 100% (69/69), done.

mp@Marc-macbook the-things-stack % cd balena-tts-lns

mp@Marc-macbook balena-tts-lns % git submodule update --init
Submodule 'balena-legacy-packet-forwarder' (https://github.com/AllWize/balena-legacy-packet-forwarder/) registered for path 'balena-legacy-packet-forwarder'
Submodule 'basicstation' (https://github.com/balenalabs/basicstation) registered for path 'basicstation'
Submodule 'wifi-connect' (https://github.com/balena-os/wifi-connect) registered for path 'wifi-connect'
Cloning into '/Users/mp/balena/the-things-stack/balena-tts-lns/balena-legacy-packet-forwarder'...
Cloning into '/Users/mp/balena/the-things-stack/balena-tts-lns/basicstation'...
Cloning into '/Users/mp/balena/the-things-stack/balena-tts-lns/wifi-connect'...
Submodule path 'balena-legacy-packet-forwarder': checked out '5c9e15aa3199ab1a0bcbe5cbb56eda6d99210811'
Submodule path 'basicstation': checked out '7cfb25097f29cc37c7cfd3b7152a7cd138cd59e5'
Submodule path 'wifi-connect': checked out '9ed3f963bd5f699c4324b5478025693373f76ce9'

mp@Marc-macbook balena-tts-lns % balena push marc6/the-things-stack-32

i didn’t get any error doing this. Could you please confirm that this is what you did?

I followed these instructions here

cd ~/workspace
git clone https://github.com/xoseperez/balena-tts-lns.git
cd balena-tts-lns
git submodule update --init

Before I pushed it, a un-rem’d the basic-station items in the compose file and that was all.

I will try again now from scratch and see what happens
Thanks

@mpous. OK so I tried again using the same commands as in your post and it still fails with same issue.

I can see there is some kind of permission error in the log (below)

[Info]          Dashboard link: https://dashboard.balena-cloud.com/apps/1927116/devices
[Info]          Building on arm05
[stack]         Step 1/15 : FROM thethingsnetwork/lorawan-stack:3.13.1-armv7
[basicstation]  Step 1/11 : FROM balenalib/raspberrypi3-debian:buster-build as builder
[basicstation]   ---> cfc0b6ef90b5
[basicstation]  Step 2/11 : WORKDIR /usr/src/app
[basicstation]   ---> Running in 1a866328aad0
[basicstation]  Removing intermediate container 1a866328aad0
[basicstation]   ---> 6bb024025656
[basicstation]  Step 3/11 : COPY . .
[basicstation]   ---> e67ad08f37af
[basicstation]  Step 4/11 : RUN make platform=rpi variant=std arch=armv7hf
[basicstation]   ---> Running in 0834d8e0812f
[basicstation]  Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/):
[basicstation]  Architecture: ARM v7
[basicstation]  OS: Debian Buster
[basicstation]  Variant: build variant
[basicstation]  Default variable(s): UDEV=off
[basicstation]  Extra features:
[basicstation]  - Easy way to install packages with `install_packages <package-name>` command
[basicstation]  - Run anywhere with cross-build feature  (for ARM only)
[basicstation]  - Keep the container idling with `balena-idle` command
[basicstation]  - Show base image details with `balena-info` command
[basicstation]  mkdir -p build-local/bin
[basicstation]  gcc -std=gnu11 -Isrc -DCFG_prog_crc32 src/crc32.c -o build-local/bin/crc32
[basicstation]  mkdir -p build-local/bin
[basicstation]  gcc -std=gnu11 -Isrc -DCFG_prog_genkwcrcs src/genkwcrcs.c -o build-local/bin/genkwcrcs
[basicstation]  build-local/bin/genkwcrcs $(cat src/kwlist.txt | sed -e '/^#/d;s/[ \t]\+#.*//') > build-local/temp-kwcrc.h
[basicstation]  mv build-local/temp-kwcrc.h src/kwcrc.h
[basicstation]  platform=rpi variant=std make -C deps/mbedtls
[basicstation]  make[1]: Entering directory '/usr/src/app/deps/mbedtls'
[basicstation]  platform=rpi variant=std ./prep.sh
[basicstation]  /bin/sh: 1: ./prep.sh: Permission denied
[basicstation]
[basicstation]  make[1]: *** [makefile:55: platform-rpi] Error 126
[basicstation]
[basicstation]  make[1]: Leaving directory '/usr/src/app/deps/mbedtls'
[basicstation]  make: *** [makefile:67: deps/mbedtls] Error 2
[basicstation]
[basicstation]  Removing intermediate container 0834d8e0812f
[basicstation]  The command '/bin/sh -c make platform=rpi variant=std arch=armv7hf' returned a non-zero code: 2
[stack]          ---> 234149665977
[stack]         Step 2/15 : USER root:root
[stack]          ---> Running in 7cd47e1b605d
[stack]         Removing intermediate container 7cd47e1b605d

and then at the end of the log I get

[Info]          Uploading images
[Success]       Successfully uploaded images
[Error]         Some services failed to build:
[Error]           Service: basicstation
[Error]             Error: The command '/bin/sh -c make platform=rpi variant=std arch=armv7hf' returned a non-zero code: 2
[Info]          Built on arm05
[Error]         Not deploying release.
Remote build failed

That’s weird! maybe @xoseperez can help here!

I am having problems logging in, I am using the admin id and the changeme password and it gives an error (login failed driver error)

@rojasyal first of all, welcome to the balena community!

Could you please share a screenshot of the balenaCloud Variables for the device?


please help me

Hi @rojasyal
Not 100% sure if it’s related but there was a typo in the last docker-compose.yml file that was pushing the amd64 image regardless of the platform…
I have fixed it in the new image. Can you please update the release (or redeploy) and test?
Thank you!

1 Like

Hi Xosé Perez, I did the deploy again and now I get the following error. Please help me.

Hi
Most probably you have not set the TTS_DOMAIN variable correctly. It must have the IP of the device (mind it should be static) or a domain name pointing to it.

2 Likes