@@ -16,39 +16,121 @@ The Kerlink IOT station has a meganism to start "custom" application on boot.
1616These steps will install the LoRa Gateway Bridge ARM build on the Kerlink.
1717
18181 . Create the the directories needed:
19+ {{<highlight bash >}}
20+ mkdir -p /mnt/fsuser-1/lora-gateway-bridge/bin
21+ {{< /highlight >}}
1922
20- {{<highlight bash >}}
21- mkdir -p /mnt/fsuser-1/lora-gateway-bridge/bin
22- {{< /highlight >}}
23-
24- 2 . Download and extract the LoRa Gateway Bridge ARM binary into the above
23+ 2 . Download and extract the LoRa Gateway Bridge ARMv5 binary into the above
2524 directory. See [ downloads] ({{< ref "/overview/downloads.md" >}}).
2625 Make sure the binary is marked as executable.
2726
28273 . Save the following content as ` /mnt/fsuser-1/lora-gateway-bridge/start.sh ` :
28+ {{<highlight bash >}}
29+ #!/bin/bash
2930
30- {{<highlight bash >}}
31- #!/bin/bash
32-
33- LOGGER="logger -p local1.notice"
31+ LOGGER="logger -p local1.notice"
3432
35- # mosquitto
36- iptables -A INPUT -p tcp --sport 1883 -j ACCEPT
33+ # mosquitto
34+ iptables -A INPUT -p tcp --sport 1883 -j ACCEPT
3735
38- /mnt/fsuser-1/lora-gateway-bridge/bin/lora-gateway-bridge --mqtt-server tcp://YOURSERVER:1883 2>&1 | $LOGGER &
39- {{< /highlight >}}
36+ /mnt/fsuser-1/lora-gateway-bridge/bin/lora-gateway-bridge --mqtt-server tcp://YOURSERVER:1883 2>&1 | $LOGGER &
37+ {{< /highlight >}}
4038
4139 Make sure to replace `YOURSERVER` with the hostname / IP of your MQTT
4240 broker. Also make sure the file is marked as executable.
4341
44424 . Save the following content as ` /mnt/fsuser-1/lora-gateway-bridge/manifest.xml ` :
43+ {{<highlight xml >}}
44+ <? xml version="1.0"?>
45+ <manifest >
46+ <app name="lora-gateway-bridge" appid="1" binary="start.sh" >
47+ <start param="" autostart="y"/>
48+ <stop kill="9"/>
49+ </app>
50+ </manifest >
51+ {{< /highlight >}}
52+
53+ ## Kerlink iBTS
54+
55+ * [ Product detail page] ( https://www.kerlink.com/product/wirnet-ibts/ )
56+
57+ The following steps describe how to install the LoRa Gateway Bridge component
58+ on the Kerlink iBTS gateway. These steps must be executed on the gateway.
59+
60+ 1 . Create a path for the LoRa Gateway Bridge binary:
61+ {{<highlight bash >}}
62+ mkdir /user/lora-gateway-bridge
63+ cd /user/lora-gateway-bridge
64+ {{< /highlight >}}
65+
66+ 2 . Download the latest LoRa Gateway Bridge ARMv5 binary from the
67+ [ Downloads] ( https://www.loraserver.io/lora-gateway-bridge/overview/downloads/ )
68+ page and extract it:
69+ {{<highlight bash >}}
70+ # replace VERSION with the version to download
71+ wget https://artifacts.loraserver.io/downloads/lora-gateway-bridge/lora-gateway-bridge_VERSION_linux_armv5.tar.gz
72+
73+ # extract the .tar.gz file
74+ tar zxf lora-gateway-bridge_VERSION_linux_armv5.tar.gz
75+ {{</highlight >}}
76+
77+ 3 . Create the LoRa Gateway Bridge configuration file and modify it:
78+ {{<highlight bash >}}
79+ # create the lora-gateway-bridge.toml configuration file
80+ ./lora-gateway-bridge configfile > lora-gateway-bridge.toml
81+
82+ # modify it using vim
83+ vim lora-gateway-bridge.toml
84+ {{</highlight >}}
85+
86+ 4 . In the ` /user/lora-gateway-bridge ` directory create a file named
87+ ` execute_lgb.sh ` file with the following content:
88+ {{<highlight bash >}}
89+ #!/bin/sh -e
90+
91+ # Open firewall ports
92+ iptables_accept() {
93+ [ -n "${1}" ] || exit 1
94+ local RULE="OUTPUT -t filter -p tcp --dport ${1} -j ACCEPT"
95+ iptables -C ${RULE} 2> /dev/null || iptables -I ${RULE}
96+ local RULE="INPUT -t filter -p tcp --sport ${1} -j ACCEPT"
97+ iptables -C ${RULE} 2> /dev/null || iptables -I ${RULE}
98+ }
99+
100+ iptables_accept 1883
101+ iptables_accept 8883
102+
103+ (
104+ # Lock on pid file
105+ exec 8> /var/run/lora-gateway-bridge.pid
106+ flock -n -x 8
107+ trap "rm -f /var/run/lora-gateway-bridge.pid" EXIT
108+
109+ # Start LoRa Gateway Bridge
110+ /user/lora-gateway-bridge/lora-gateway-bridge -c /user/lora-gateway-bridge/lora-gateway-bridge.toml 2>&1 | logger -p local1.notice -t lora-gateway-bridge &
111+ trap "killall -q lora-gateway-bridge" INT QUIT TERM
112+
113+ # Update pid and wait for it
114+ pidof lora-gateway-bridge >&8
115+ wait
116+ ) &
117+ {{</highlight >}}
118+
119+ 5 . Make sure this file is executable:
120+ {{<highlight bash >}}
121+ chmod +x execute_lgb.sh
122+ {{</highlight >}}
123+
124+ 6 . Create the LoRa Gateway Bridge [ Monit] ( https://mmonit.com/monit/documentation/monit.html )
125+ configuration named ` /etc/monit.d/lora-gateway-bridge ` :
126+ {{<highlight text >}}
127+ check process lora-gateway-bridge pidfile /var/run/lora-gateway-bridge.pid
128+ start program = "/user/lora-gateway-bridge/execute_lgb.sh"
129+ stop program = "/usr/bin/killall -q lora-gateway-bridge"
130+ {{</highlight >}}
45131
46- {{<highlight xml >}}
47- <? xml version="1.0"?>
48- <manifest >
49- <app name="lora-gateway-bridge" appid="1" binary="start.sh" >
50- <start param="" autostart="y"/>
51- <stop kill="9"/>
52- </app>
53- </manifest >
54- {{< /highlight >}}
132+ 7 . Finally reload the Monit daemon and start the LoRa Gateway Bridge service:
133+ {{<highlight bash >}}
134+ monit reload
135+ monit start lora-gateway-bridge
136+ {{</highlight >}}
0 commit comments