Skip to content

Commit 53adcb4

Browse files
committed
Add scripts for Kerlink iStation packaging.
Closes #168.
1 parent 72f0899 commit 53adcb4

File tree

7 files changed

+266
-8
lines changed

7 files changed

+266
-8
lines changed

docs/content/gateway/kerlink.md

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ for login instructions.
125125

126126
Find the latest package at https://artifacts.chirpstack.io/vendor/kerlink/ibts/
127127
and copy the URL to your clipboard. Then on the gateway use `wget` to download
128-
the package into a folder named `/user/.updates`. Example for `chirpstack-gateway-bridge_3.4.0-r1_klk_lpbs.ipk`:
128+
the package into a folder named `/user/.updates`. Example for `chirpstack-gateway-bridge_3.8.0-r1_klkgw.ipk`:
129129

130130
{{<highlight bash>}}
131131
mkdir -p /user/.updates
132132
cd /user/.updates
133-
wget https://artifacts.chirpstack.io/vendor/kerlink/ibts/chirpstack-gateway-bridge_3.4.0-r1_klk_lpbs.ipk
133+
wget https://artifacts.chirpstack.io/vendor/kerlink/ibts/chirpstack-gateway-bridge_3.8.0-r1_klkgw.ipk
134134
{{</highlight>}}
135135

136136
To trigger the iBTS gateway to install / update the package, run the following commands:
@@ -209,12 +209,12 @@ for login instructions.
209209

210210
Find the latest package at https://artifacts.chirpstack.io/vendor/kerlink/ifemtocell/
211211
and copy the URL to your clipboard. Then on the gateway use `wget` to download
212-
the package into a folder named `/user/.updates`. Example for `chirpstack-gateway-bridge_3.4.0-r1_klk_wifc.ipk`:
212+
the package into a folder named `/user/.updates`. Example for `chirpstack-gateway-bridge_3.8.0-r1_klkgw.ipk`:
213213

214214
{{<highlight bash>}}
215215
mkdir -p /user/.updates
216216
cd /user/.updates
217-
wget https://artifacts.chirpstack.io/vendor/kerlink/ifemtocell/chirpstack-gateway-bridge_3.4.0-r1_klk_wifc.ipk
217+
wget https://artifacts.chirpstack.io/vendor/kerlink/ifemtocell/chirpstack-gateway-bridge_3.8.0-r1_klkgw.ipk
218218
{{</highlight>}}
219219

220220
To trigger the iFemtoCell gateway to install / update the package, run the following commands:
@@ -269,3 +269,85 @@ After updating this configuration file, make sure to restart the `lorafwd` servi
269269
{{<highlight bash>}}
270270
monit restart lorafwd
271271
{{</highlight>}}
272+
273+
## Kerlink iStation
274+
275+
* [Product detail page](https://www.kerlink.com/product/wirnet-istation/)
276+
277+
**Note:** You must also install the Kerlink Common Packet Forwarder.
278+
279+
### SSH into the gateway
280+
281+
The first step is to login into the gateway using ssh:
282+
283+
{{<highlight bash>}}
284+
ssh root@GATEWAY-IP-ADDRESS
285+
{{</highlight>}}
286+
287+
Please refer to the [Kerlink wiki](http://wikikerlink.fr/wirnet-productline)
288+
for login instructions.
289+
290+
### Install IPK package
291+
292+
Find the latest package at https://artifacts.chirpstack.io/vendor/kerlink/istation/
293+
and copy the URL to your clipboard. Then on the gateway use `wget` to download
294+
the package into a folder named `/user/.updates`. Example for `chirpstack-gateway-bridge_3.8.0-r1_klkgw.ipk`:
295+
296+
{{<highlight bash>}}
297+
mkdir -p /user/.updates
298+
cd /user/.updates
299+
wget https://artifacts.chirpstack.io/vendor/kerlink/ifemtocell/chirpstack-gateway-bridge_3.8.0-r1_klkgw.ipk
300+
{{</highlight>}}
301+
302+
To trigger the iStation gateway to install / update the package, run the following commands:
303+
304+
{{<highlight bash>}}
305+
sync
306+
kerosd -u
307+
reboot
308+
{{</highlight>}}
309+
310+
Please refer to the [Kerlink wiki](http://wikikerlink.fr/wirnet-productline)
311+
for more information about installing and updating packages.
312+
313+
### Edit the ChirpStack Gateway Bridge configuration
314+
315+
To connect the ChirpStack Gateway Bridge with your MQTT broker, you must update
316+
the ChirpStack Gateway Bridge configuration file, which is located at:
317+
`/user/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml`.
318+
319+
### (Re)start and stop commands
320+
321+
Use the following commands to (re)start and stop the ChirpStack Gateway Bridge Service:
322+
323+
{{<highlight bash>}}
324+
# status
325+
monit status chirpstack-gateway-bridge
326+
327+
# start
328+
monit start chirpstack-gateway-bridge
329+
330+
# stop
331+
monit stop chirpstack-gateway-bridge
332+
333+
# restart
334+
monit restart chirpstack-gateway-bridge
335+
{{</highlight>}}
336+
337+
### Configure packet-forwarder
338+
339+
You must configure the packet-forwarder on the gateway to forward its data to
340+
`127.0.0.1` at port `1700`. The file `/user/etc/lorafwd/lorafwd.toml` must contain the
341+
following lines under the `[ gwmp ]` section:
342+
343+
{{<highlight toml>}}
344+
node = "127.0.0.1"
345+
service.uplink = 1700
346+
service.downlink = 1700
347+
{{</highlight>}}
348+
349+
After updating this configuration file, make sure to restart the `lorafwd` service:
350+
351+
{{<highlight bash>}}
352+
monit restart lorafwd
353+
{{</highlight>}}

packaging/vendor/kerlink/ibts/package.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PACKAGE_VERSION=$1
55
REV="r2"
66

77

8-
PACKAGE_URL="https://artifacts.chirpstack.io/downloads/chirpstack-gateway-bridge/chirpstack-gateway-bridge_${PACKAGE_VERSION}_linux_armv5.tar.gz"
8+
PACKAGE_URL="https://artifacts.chirpstack.io/downloads/chirpstack-gateway-bridge/chirpstack-gateway-bridge_${PACKAGE_VERSION}_linux_armv7.tar.gz"
99
DIR=`dirname $0`
1010
PACKAGE_DIR="${DIR}/package"
1111

@@ -17,7 +17,7 @@ mkdir -p $PACKAGE_DIR/CONTROL
1717
cat > $PACKAGE_DIR/CONTROL/control << EOF
1818
Package: $PACKAGE_NAME
1919
Version: $PACKAGE_VERSION-$REV
20-
Architecture: klk_lpbs
20+
Architecture: klkgw
2121
Maintainer: Orne Brocaar <[email protected]>
2222
Priority: optional
2323
Section: network

packaging/vendor/kerlink/ifemtocell/package.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PACKAGE_VERSION=$1
55
REV="r2"
66

77

8-
PACKAGE_URL="https://artifacts.chirpstack.io/downloads/chirpstack-gateway-bridge/chirpstack-gateway-bridge_${PACKAGE_VERSION}_linux_armv5.tar.gz"
8+
PACKAGE_URL="https://artifacts.chirpstack.io/downloads/chirpstack-gateway-bridge/chirpstack-gateway-bridge_${PACKAGE_VERSION}_linux_armv7.tar.gz"
99
DIR=`dirname $0`
1010
PACKAGE_DIR="${DIR}/package"
1111

@@ -17,7 +17,7 @@ mkdir -p $PACKAGE_DIR/CONTROL
1717
cat > $PACKAGE_DIR/CONTROL/control << EOF
1818
Package: $PACKAGE_NAME
1919
Version: $PACKAGE_VERSION-$REV
20-
Architecture: klk_wifc
20+
Architecture: klkgw
2121
Maintainer: Orne Brocaar <[email protected]>
2222
Priority: optional
2323
Section: network
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="chirpstack-gateway-bridge"
4+
DESC="ChirpStack 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
check process chirpstack-gateway-bridge pidfile /var/run/chirpstack-gateway-bridge.pid
2+
start program = "/etc/init.d/chirpstack-gateway-bridge start"
3+
stop program = "/etc/init.d/chirpstack-gateway-bridge stop"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# This configuration provides a Semtech UDP packet-forwarder backend and
2+
# integrates with a MQTT broker. Many options and defaults have been omitted
3+
# for simplicity.
4+
#
5+
# See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
6+
# configuration example and documentation.
7+
8+
9+
[general]
10+
# debug=5, info=4, warning=3, error=2, fatal=1, panic=0
11+
log_level=4
12+
13+
# Log to syslog.
14+
#
15+
# When set to true, log messages are being written to syslog.
16+
log_to_syslog=true
17+
18+
19+
# Gateway backend configuration.
20+
[backend]
21+
# Backend type.
22+
type="semtech_udp"
23+
24+
# Semtech UDP packet-forwarder backend.
25+
[backend.semtech_udp]
26+
27+
# ip:port to bind the UDP listener to
28+
#
29+
# Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
30+
# This is the listener to which the packet-forwarder forwards its data
31+
# so make sure the 'serv_port_up' and 'serv_port_down' from your
32+
# packet-forwarder matches this port.
33+
udp_bind = "0.0.0.0:1700"
34+
35+
36+
# Integration configuration.
37+
[integration]
38+
# Payload marshaler.
39+
#
40+
# This defines how the MQTT payloads are encoded. Valid options are:
41+
# * protobuf: Protobuf encoding
42+
# * json: JSON encoding (easier for debugging, but less compact than 'protobuf')
43+
marshaler="protobuf"
44+
45+
# MQTT integration configuration.
46+
[integration.mqtt]
47+
# Event topic template.
48+
event_topic_template="gateway/{{ .GatewayID }}/event/{{ .EventType }}"
49+
50+
# Command topic template.
51+
command_topic_template="gateway/{{ .GatewayID }}/command/#"
52+
53+
# MQTT authentication.
54+
[integration.mqtt.auth]
55+
# Type defines the MQTT authentication type to use.
56+
#
57+
# Set this to the name of one of the sections below.
58+
type="generic"
59+
60+
# Generic MQTT authentication.
61+
[integration.mqtt.auth.generic]
62+
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
63+
server="tcp://127.0.0.1:1883"
64+
65+
# Connect with the given username (optional)
66+
username=""
67+
68+
# Connect with the given password (optional)
69+
password=""
70+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/env bash
2+
3+
PACKAGE_NAME="chirpstack-gateway-bridge"
4+
PACKAGE_VERSION=$1
5+
REV="r1"
6+
7+
8+
PACKAGE_URL="https://artifacts.chirpstack.io/downloads/chirpstack-gateway-bridge/chirpstack-gateway-bridge_${PACKAGE_VERSION}_linux_armv7.tar.gz"
9+
DIR=`dirname $0`
10+
PACKAGE_DIR="${DIR}/package"
11+
12+
# Cleanup
13+
rm -rf $PACKAGE_DIR
14+
15+
# CONTROL
16+
mkdir -p $PACKAGE_DIR/CONTROL
17+
cat > $PACKAGE_DIR/CONTROL/control << EOF
18+
Package: $PACKAGE_NAME
19+
Version: $PACKAGE_VERSION-$REV
20+
Architecture: klkgw
21+
Maintainer: Orne Brocaar <[email protected]>
22+
Priority: optional
23+
Section: network
24+
Source: N/A
25+
Description: ChirpStack Gateway Bridge
26+
EOF
27+
28+
cat > $PACKAGE_DIR/CONTROL/conffiles << EOF
29+
/user/etc/$PACKAGE_NAME/$PACKAGE_NAME.toml
30+
EOF
31+
32+
# Files
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
44+
45+
# Package
46+
opkg-build -o root -g root $PACKAGE_DIR
47+
48+
# Cleanup
49+
rm -rf $PACKAGE_DIR

0 commit comments

Comments
 (0)