Skip to content

Commit ce8e2cc

Browse files
committed
Update Kerlink iBTS and iFemtoCell packaging.
1 parent 357968a commit ce8e2cc

File tree

11 files changed

+241
-107
lines changed

11 files changed

+241
-107
lines changed

docs/content/gateway/kerlink.md

Lines changed: 101 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,44 +54,49 @@ iptables -A INPUT -p tcp --sport 1883 -j ACCEPT
5454

5555
* [Product detail page: iBTS](https://www.kerlink.com/product/wirnet-ibts/)
5656

57+
**Note:** These steps have been tested using the _KerOS firmware v4.1.6_.
58+
Please make sure you have this version or later installed. You must also
59+
install the Kerlink Common Packet Forwarder.
60+
5761
### SSH into the gateway
5862

5963
The first step is to login into the gateway using ssh:
6064

6165
{{<highlight bash>}}
62-
sh root@GATEWAY-IP-ADDRESS
66+
ssh root@GATEWAY-IP-ADDRESS
6367
{{</highlight>}}
6468

65-
Please refer to the [Kerlink iBTS wiki](http://wikikerlink.fr/wirnet-ibts/)
69+
Please refer to the [Kerlink wiki](http://wikikerlink.fr/wirnet-productline)
6670
for login instructions.
6771

6872
### Install IPK package
6973

7074
Find the latest package at https://artifacts.loraserver.io/vendor/kerlink/ibts/
7175
and copy the URL to your clipboard. Then on the gateway use `wget` to download
72-
the package into a folder named `/user/.updates`. Example for `lora-gateway-bridge_3.0.1-r1_klk_lpbs.ipk`:
76+
the package into a folder named `/user/.updates`. Example for `lora-gateway-bridge_3.3.0-r2_klk_lpbs.ipk`:
7377

7478
{{<highlight bash>}}
7579
mkdir -p /user/.updates
7680
cd /user/.updates
77-
wget https://artifacts.loraserver.io/vendor/kerlink/ibts/lora-gateway-bridge_3.0.1-r1_klk_lpbs.ipk
81+
wget https://artifacts.loraserver.io/vendor/kerlink/ibts/lora-gateway-bridge_3.3.0-r2_klk_lpbs.ipk
7882
{{</highlight>}}
7983

8084
To trigger the iBTS gateway to install / update the package, run the following commands:
8185

8286
{{<highlight bash>}}
87+
sync
8388
kerosd -u
8489
reboot
8590
{{</highlight>}}
8691

87-
Please refer to the [Kerlink iBTS wiki](http://wikikerlink.fr/wirnet-ibts/)
92+
Please refer to the [Kerlink wiki](http://wikikerlink.fr/wirnet-productline)
8893
for more information about installing and updating packages.
8994

9095
### Edit the LoRa Gateway Bridge configuration
9196

9297
To connect the LoRa Gateway Bridge with your MQTT broker, you must update
9398
the LoRa Gateway Bridge configuration file, which is located at:
94-
`/user/lora-gateway-bridge/lora-gateway-bridge.toml`.
99+
`/user/etc/lora-gateway-bridge/lora-gateway-bridge.toml`.
95100

96101
### (Re)start and stop commands
97102

@@ -114,20 +119,101 @@ monit restart lora-gateway-bridge
114119
### Configure packet-forwarder
115120

116121
You must configure the packet-forwarder on the gateway to forward its data to
117-
`127.0.0.1` at port `1700`. The file `/user/spf2/etc/config.json` must contain the
118-
following lines:
122+
`127.0.0.1` at port `1700`. The file `/user/etc/lorafwd/lorafwd.toml` must contain the
123+
following lines under the `[ gwmp ]` section:
124+
125+
{{<highlight toml>}}
126+
node = "127.0.0.1"
127+
service.uplink = 1700
128+
service.downlink = 1700
129+
{{</highlight>}}
130+
131+
After updating this configuration file, make sure to restart the `lorafwd` service:
119132

120-
{{<highlight text>}}
121-
"server_address": "127.0.0.1",
122-
"serv_port_up": 1700,
123-
"serv_port_down": 1700,
133+
{{<highlight bash>}}
134+
monit restart lorafwd
124135
{{</highlight>}}
125136

126137
## Kerlink iFemtoCell
127138

128139
* [Product detail page](https://www.kerlink.com/product/wirnet-ifemtocell/)
129140

130-
The installation steps to install the LoRa Gateway Bridge component are exactly
131-
the same as for the iBTS gateway. The only difference is that the packages
132-
are located at https://artifacts.loraserver.io/vendor/kerlink/ifemtocell/.
141+
**Note:** These steps have been tested using the _KerOS firmware v4.1.6_.
142+
Please make sure you have this version or later installed. You must also
143+
install the Kerlink Common Packet Forwarder.
144+
145+
### SSH into the gateway
146+
147+
The first step is to login into the gateway using ssh:
148+
149+
{{<highlight bash>}}
150+
ssh root@GATEWAY-IP-ADDRESS
151+
{{</highlight>}}
152+
153+
Please refer to the [Kerlink wiki](http://wikikerlink.fr/wirnet-productline)
154+
for login instructions.
155+
156+
### Install IPK package
157+
158+
Find the latest package at https://artifacts.loraserver.io/vendor/kerlink/ifemtocell/
159+
and copy the URL to your clipboard. Then on the gateway use `wget` to download
160+
the package into a folder named `/user/.updates`. Example for `lora-gateway-bridge_3.3.0-r2_klk_wifc.ipk`:
161+
162+
{{<highlight bash>}}
163+
mkdir -p /user/.updates
164+
cd /user/.updates
165+
wget https://artifacts.loraserver.io/vendor/kerlink/ifemtocell/loraserver-gateway-bridge_3.3.0-r2_klk_wifc.ipk
166+
{{</highlight>}}
167+
168+
To trigger the iFemtoCell gateway to install / update the package, run the following commands:
133169

170+
{{<highlight bash>}}
171+
sync
172+
kerosd -u
173+
reboot
174+
{{</highlight>}}
175+
176+
Please refer to the [Kerlink wiki](http://wikikerlink.fr/wirnet-productline)
177+
for more information about installing and updating packages.
178+
179+
### Edit the LoRa Gateway Bridge configuration
180+
181+
To connect the LoRa Gateway Bridge with your MQTT broker, you must update
182+
the LoRa Gateway Bridge configuration file, which is located at:
183+
`/user/etc/lora-gateway-bridge/lora-gateway-bridge.toml`.
184+
185+
### (Re)start and stop commands
186+
187+
Use the following commands to (re)start and stop the LoRa Gateway Bridge Service:
188+
189+
{{<highlight bash>}}
190+
# status
191+
monit status lora-gateway-bridge
192+
193+
# start
194+
monit start lora-gateway-bridge
195+
196+
# stop
197+
monit stop lora-gateway-bridge
198+
199+
# restart
200+
monit restart lora-gateway-bridge
201+
{{</highlight>}}
202+
203+
### Configure packet-forwarder
204+
205+
You must configure the packet-forwarder on the gateway to forward its data to
206+
`127.0.0.1` at port `1700`. The file `/user/etc/lorafwd/lorafwd.toml` must contain the
207+
following lines under the `[ gwmp ]` section:
208+
209+
{{<highlight toml>}}
210+
node = "127.0.0.1"
211+
service.uplink = 1700
212+
service.downlink = 1700
213+
{{</highlight>}}
214+
215+
After updating this configuration file, make sure to restart the `lorafwd` service:
216+
217+
{{<highlight bash>}}
218+
monit restart lorafwd
219+
{{</highlight>}}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
3+
NAME="lora-gateway-bridge"
4+
DESC="LoRa Gateway Bridge"
5+
DAEMON_BIN=/opt/$NAME/$NAME
6+
DAEMON_CONF=/user/etc/$NAME/$NAME.toml
7+
DAEMON_PID=/var/run/$NAME.pid
8+
9+
function iptables_accept {
10+
[ -n "${1}" ] || exit 1
11+
local RULE="OUTPUT -t filter -p tcp --dport ${1} -j ACCEPT"
12+
iptables -C ${RULE} 2> /dev/null || iptables -I ${RULE}
13+
local RULE="INPUT -t filter -p tcp --sport ${1} -j ACCEPT"
14+
iptables -C ${RULE} 2> /dev/null || iptables -I ${RULE}
15+
}
16+
17+
function do_start {
18+
echo "Starting $NAME"
19+
iptables_accept 1883
20+
iptables_accept 8883
21+
22+
start-stop-daemon \
23+
--start \
24+
--background \
25+
--make-pidfile \
26+
--pidfile $DAEMON_PID \
27+
--exec $DAEMON_BIN -- --config $DAEMON_CONF
28+
}
29+
30+
function do_stop {
31+
echo "Stopping $NAME"
32+
start-stop-daemon \
33+
--stop \
34+
--oknodo \
35+
--quiet \
36+
--pidfile $DAEMON_PID
37+
}
38+
39+
case "$1" in
40+
"start")
41+
do_start
42+
;;
43+
"stop")
44+
do_stop
45+
;;
46+
"restart")
47+
do_stop
48+
do_start
49+
;;
50+
*)
51+
echo "Usage: $1 {start|stop|restart}"
52+
exit 1
53+
;;
54+
esac
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
check process lora-gateway-bridge pidfile /var/run/lora-gateway-bridge.pid
2-
start program = "/user/lora-gateway-bridge/start.sh"
3-
stop program = "/usr/bin/killall -q lora-gateway-bridge"
4-
2+
start program = "/etc/init.d/lora-gateway-bridge start"
3+
stop program = "/etc/init.d/lora-gateway-bridge stop"

packaging/vendor/kerlink/ibts/files/lora-gateway-bridge.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type="semtech_udp"
2828
# Payload marshaler.
2929
#
3030
# This defines how the MQTT payloads are encoded. Valid options are:
31-
# * protobuf: Protobuf encoding (this will become the LoRa Gateway Bridge v3 default)
31+
# * protobuf: Protobuf encoding
3232
# * json: JSON encoding (easier for debugging, but less compact than 'protobuf')
3333
marshaler="protobuf"
3434

packaging/vendor/kerlink/ibts/files/start.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

packaging/vendor/kerlink/ibts/package.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
PACKAGE_NAME="lora-gateway-bridge"
44
PACKAGE_VERSION=$1
5-
REV="r1"
5+
REV="r2"
66

77

88
PACKAGE_URL="https://artifacts.loraserver.io/downloads/lora-gateway-bridge/lora-gateway-bridge_${PACKAGE_VERSION}_linux_armv5.tar.gz"
99
DIR=`dirname $0`
1010
PACKAGE_DIR="${DIR}/package"
11-
PACKAGE_USER_DIR="${PACKAGE_DIR}/user/${PACKAGE_NAME}"
12-
PACKAGE_MONIT_DIR="${PACKAGE_DIR}/user/rootfs_rw/etc/monit.d"
1311

1412
# Cleanup
1513
rm -rf $PACKAGE_DIR
@@ -28,19 +26,21 @@ Description: LoRa Gateway Bridge
2826
EOF
2927

3028
cat > $PACKAGE_DIR/CONTROL/conffiles << EOF
31-
/user/lora-gateway-bridge/lora-gateway-bridge.toml
29+
/user/etc/$PACKAGE_NAME/$PACKAGE_NAME.toml
3230
EOF
3331

3432
# Files
35-
mkdir -p $PACKAGE_MONIT_DIR
36-
mkdir -p $PACKAGE_USER_DIR
37-
38-
cp files/$PACKAGE_NAME.toml $PACKAGE_USER_DIR
39-
cp files/$PACKAGE_NAME.monit $PACKAGE_MONIT_DIR/lora-gateway-bridge
40-
cp files/start.sh $PACKAGE_USER_DIR
41-
wget -P $PACKAGE_USER_DIR $PACKAGE_URL
42-
tar zxf $PACKAGE_USER_DIR/*.tar.gz -C $PACKAGE_USER_DIR
43-
rm $PACKAGE_USER_DIR/*.tar.gz
33+
mkdir -p $PACKAGE_DIR/opt/$PACKAGE_NAME
34+
mkdir -p $PACKAGE_DIR/user/etc/$PACKAGE_NAME
35+
mkdir -p $PACKAGE_DIR/etc/monit.d
36+
mkdir -p $PACKAGE_DIR/etc/init.d
37+
38+
cp files/$PACKAGE_NAME.toml $PACKAGE_DIR/user/etc/$PACKAGE_NAME/$PACKAGE_NAME.toml
39+
cp files/$PACKAGE_NAME.monit $PACKAGE_DIR/etc/monit.d/$PACKAGE_NAME
40+
cp files/$PACKAGE_NAME.init $PACKAGE_DIR/etc/init.d/$PACKAGE_NAME
41+
wget -P $PACKAGE_DIR/opt/$PACKAGE_NAME $PACKAGE_URL
42+
tar zxf $PACKAGE_DIR/opt/$PACKAGE_NAME/*.tar.gz -C $PACKAGE_DIR/opt/$PACKAGE_NAME
43+
rm $PACKAGE_DIR/opt/$PACKAGE_NAME/*.tar.gz
4444

4545
# Package
4646
opkg-build -o root -g root $PACKAGE_DIR
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
3+
NAME="lora-gateway-bridge"
4+
DESC="LoRa Gateway Bridge"
5+
DAEMON_BIN=/opt/$NAME/$NAME
6+
DAEMON_CONF=/user/etc/$NAME/$NAME.toml
7+
DAEMON_PID=/var/run/$NAME.pid
8+
9+
function iptables_accept {
10+
[ -n "${1}" ] || exit 1
11+
local RULE="OUTPUT -t filter -p tcp --dport ${1} -j ACCEPT"
12+
iptables -C ${RULE} 2> /dev/null || iptables -I ${RULE}
13+
local RULE="INPUT -t filter -p tcp --sport ${1} -j ACCEPT"
14+
iptables -C ${RULE} 2> /dev/null || iptables -I ${RULE}
15+
}
16+
17+
function do_start {
18+
echo "Starting $NAME"
19+
iptables_accept 1883
20+
iptables_accept 8883
21+
22+
start-stop-daemon \
23+
--start \
24+
--background \
25+
--make-pidfile \
26+
--pidfile $DAEMON_PID \
27+
--exec $DAEMON_BIN -- --config $DAEMON_CONF
28+
}
29+
30+
function do_stop {
31+
echo "Stopping $NAME"
32+
start-stop-daemon \
33+
--stop \
34+
--oknodo \
35+
--quiet \
36+
--pidfile $DAEMON_PID
37+
}
38+
39+
case "$1" in
40+
"start")
41+
do_start
42+
;;
43+
"stop")
44+
do_stop
45+
;;
46+
"restart")
47+
do_stop
48+
do_start
49+
;;
50+
*)
51+
echo "Usage: $1 {start|stop|restart}"
52+
exit 1
53+
;;
54+
esac
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
check process lora-gateway-bridge pidfile /var/run/lora-gateway-bridge.pid
2-
start program = "/user/lora-gateway-bridge/start.sh"
3-
stop program = "/usr/bin/killall -q lora-gateway-bridge"
4-
2+
start program = "/etc/init.d/lora-gateway-bridge start"
3+
stop program = "/etc/init.d/lora-gateway-bridge stop"

packaging/vendor/kerlink/ifemtocell/files/lora-gateway-bridge.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type="semtech_udp"
2828
# Payload marshaler.
2929
#
3030
# This defines how the MQTT payloads are encoded. Valid options are:
31-
# * protobuf: Protobuf encoding (this will become the LoRa Gateway Bridge v3 default)
31+
# * protobuf: Protobuf encoding
3232
# * json: JSON encoding (easier for debugging, but less compact than 'protobuf')
3333
marshaler="protobuf"
3434

0 commit comments

Comments
 (0)