Skip to content

Commit 8e2783a

Browse files
authored
chore(s6-overlay): use s6-overlay v3, use the new way to handles services etc for it (#73)
1 parent 1236dc1 commit 8e2783a

File tree

64 files changed

+225
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+225
-174
lines changed

Dockerfile

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ RUN ./sensible-build.sh ${DEBIAN_VERSION} && \
7171
# THTTPD
7272
FROM alpine:3.13.2 AS thttpd
7373

74-
ARG THTTPD_VERSION=2.29
74+
ENV THTTPD_VERSION=2.29
7575

7676
# Install all dependencies required for compiling thttpd
7777
RUN apk add gcc musl-dev make
@@ -95,14 +95,15 @@ ENV FR24FEED_AMD64_VERSION 1.0.25-3
9595
# force version 1.0.25-3 for armhf and armel because of broken version for these architectures
9696
ENV FR24FEED_ARMHF_VERSION 1.0.25-3
9797
ENV FR24FEED_ARMEL_VERSION 1.0.25-3
98-
ENV S6_OVERLAY_VERSION v2.1.0.2
98+
ENV S6_OVERLAY_VERSION 3.0.0.2-2
9999

100100
LABEL maintainer="maugin.thomas@gmail.com"
101101

102102
RUN apt-get update && \
103103
# rtl-sdr
104104
apt-get install -y \
105105
wget \
106+
xz-utils \
106107
devscripts \
107108
libusb-1.0-0-dev \
108109
pkg-config \
@@ -125,11 +126,10 @@ RUN apt-get update && \
125126
pkg-config \
126127
libncurses5-dev \
127128
libbladerf-dev && \
128-
rm -rf /var/lib/apt/lists/*
129-
130-
# RTL-SDR
131-
WORKDIR /tmp
132-
RUN mkdir -p /etc/modprobe.d && \
129+
rm -rf /var/lib/apt/lists/* && \
130+
# RTL-SDR
131+
cd /tmp && \
132+
mkdir -p /etc/modprobe.d && \
133133
echo 'blacklist r820t' >> /etc/modprobe.d/raspi-blacklist.conf && \
134134
echo 'blacklist rtl2832' >> /etc/modprobe.d/raspi-blacklist.conf && \
135135
echo 'blacklist rtl2830' >> /etc/modprobe.d/raspi-blacklist.conf && \
@@ -141,20 +141,18 @@ RUN mkdir -p /etc/modprobe.d && \
141141
make && \
142142
make install && \
143143
ldconfig && \
144-
rm -rf /tmp/rtl-sdr
145-
146-
# Build & Install dependency tcl-tls from source code.
147-
# Install dependencies
148-
RUN apt-get update && \
144+
rm -rf /tmp/rtl-sdr && \
145+
# Build & Install dependency tcl-tls from source code.
146+
# Install dependencies
147+
apt-get update && \
149148
apt-get install -y \
150149
libssl-dev \
151150
tcl-dev \
152151
chrpath \
153152
netcat && \
154-
rm -rf /var/lib/apt/lists/*
155-
156-
## Clone source code, build & Install tcl-tls
157-
RUN cd /tmp && \
153+
rm -rf /var/lib/apt/lists/* && \
154+
# Clone source code, build & Install tcl-tls
155+
cd /tmp && \
158156
git clone --depth 1 http://github.com/flightaware/tcltls-rebuild.git && \
159157
cd tcltls-rebuild && \
160158
./prepare-build.sh ${DEBIAN_VERSION} && \
@@ -164,39 +162,38 @@ RUN cd /tmp && \
164162
dpkg -i tcl-tls_*.deb && \
165163
rm -rf /tmp/tcltls-rebuild
166164

167-
# DUMP1090
168-
RUN mkdir -p /usr/lib/fr24/public_html/data
165+
# COPY ALL
169166
COPY --from=dump1090 /tmp/dump1090/dump1090 /usr/lib/fr24/
170167
COPY --from=dump1090 /tmp/dump1090/public_html_merged /usr/lib/fr24/public_html
171-
RUN rm /usr/lib/fr24/public_html/config.js && \
172-
rm /usr/lib/fr24/public_html/layers.js
168+
COPY --from=piaware /tmp/piaware_builder /tmp/piaware_builder
169+
COPY --from=thttpd /thttpd/thttpd /
170+
ADD build /build
171+
ADD confd/confd.tar.gz /opt/confd/
173172

173+
174+
# DUMP1090
175+
RUN mkdir -p /usr/lib/fr24/public_html/data && \
176+
rm /usr/lib/fr24/public_html/config.js && \
177+
rm /usr/lib/fr24/public_html/layers.js && \
174178
# PIAWARE
175-
COPY --from=piaware /tmp/piaware_builder /tmp/piaware_builder
176-
RUN cd /tmp/piaware_builder && \
179+
cd /tmp/piaware_builder && \
177180
dpkg -i piaware_*_*.deb && \
178181
rm /etc/piaware.conf && \
179-
rm -rf /tmp/piaware_builder
180-
182+
rm -rf /tmp/piaware_builder && \
181183
# THTTPD
182-
COPY --from=thttpd /thttpd/thttpd /
183-
RUN find /usr/lib/fr24/public_html -type d -print0 | xargs -0 chmod 0755 && \
184-
find /usr/lib/fr24/public_html -type f -print0 | xargs -0 chmod 0644
185-
186-
ADD build /build
187-
184+
find /usr/lib/fr24/public_html -type d -print0 | xargs -0 chmod 0755 && \
185+
find /usr/lib/fr24/public_html -type f -print0 | xargs -0 chmod 0644 && \
188186
# FR24FEED
189-
RUN /build/fr24feed.sh
190-
187+
/build/fr24feed.sh && \
191188
# CONFD
192-
ADD confd/confd.tar.gz /opt/confd/
193-
RUN ARCH=$(dpkg --print-architecture) && \
189+
ARCH=$(dpkg --print-architecture) && \
194190
cp "/opt/confd/bin/confd-$ARCH" /opt/confd/bin/confd && \
195191
chmod +x /opt/confd/bin/confd && \
196-
rm /opt/confd/bin/confd-*
197-
192+
rm /opt/confd/bin/confd-* && \
198193
# S6 OVERLAY
199-
RUN /build/s6-overlay.sh
194+
/build/s6-overlay.sh && \
195+
# CLEAN
196+
rm -rf /build
200197

201198
COPY /root /
202199

build/s6-overlay.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@ arch=$(dpkg --print-architecture)
33

44
case $arch in
55
armhf)
6-
url=https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-armhf.tar.gz
6+
url=https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-armhf-${S6_OVERLAY_VERSION}.tar.xz
77
;;
88
arm64)
9-
url=https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-aarch64.tar.gz
9+
url=https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-aarch64-${S6_OVERLAY_VERSION}.tar.xz
1010
;;
1111
armel)
12-
url=https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-arm.tar.gz
12+
url=https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-arm-${S6_OVERLAY_VERSION}.tar.xz
1313
;;
1414
amd64)
15-
url=https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-amd64.tar.gz
15+
url=https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64-${S6_OVERLAY_VERSION}.tar.xz
1616
;;
1717
*)
1818
exit 1
1919
;;
2020
esac
2121

22+
wget -O /tmp/s6-overlay-noarch.tar.gz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch-${S6_OVERLAY_VERSION}.tar.xz /tmp
23+
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.gz && rm /tmp/s6-overlay-noarch.tar.gz
2224
wget -O /tmp/s6-overlay.tar.gz $url && \
23-
tar xzf /tmp/s6-overlay.tar.gz -C / && rm /tmp/s6-overlay.tar.gz
25+
tar -C / -Jxpf /tmp/s6-overlay.tar.gz && rm /tmp/s6-overlay.tar.gz
2426

root/etc/confd/layers/templates/layers.js.tmpl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,16 @@ function createBaseLayers() {
149149
}
150150
}
151151

152+
var nexrad_bottomLeft = ol.proj.fromLonLat([-171.0,9.0]);
153+
var nexrad_topRight = ol.proj.fromLonLat([-51.0,69.0]);
154+
var nexrad_extent = [nexrad_bottomLeft[0], nexrad_bottomLeft[1], nexrad_topRight[0], nexrad_topRight[1]];
152155
var nexrad = new ol.layer.Tile({
153156
name: 'nexrad',
154157
title: 'NEXRAD',
155158
type: 'overlay',
156159
opacity: 0.5,
157-
visible: false
160+
visible: false,
161+
extent: nexrad_extent,
158162
});
159163
us.push(nexrad);
160164

@@ -210,6 +214,9 @@ function createBaseLayers() {
210214
});
211215
};
212216

217+
var dwd_bottomLeft = ol.proj.fromLonLat([1.9,46.2]);
218+
var dwd_topRight = ol.proj.fromLonLat([16.0,55.0]);
219+
var dwd_extent = [dwd_bottomLeft[0], dwd_bottomLeft[1], dwd_topRight[0], dwd_topRight[1]];
213220
var dwd = new ol.layer.Tile({
214221
source: new ol.source.TileWMS({
215222
url: 'https://maps.dwd.de/geoserver/wms',
@@ -224,6 +231,7 @@ function createBaseLayers() {
224231
visible: false,
225232
zIndex: 99,
226233
maxZoom: 14,
234+
exent: dwd_extent,
227235
});
228236

229237
var refreshDwd = function () {

root/etc/cont-init.d/01-confd-fr24feed

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

root/etc/cont-init.d/02-confd-piaware

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

root/etc/cont-init.d/03-confd-html

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

root/etc/cont-init.d/04-confd-layers

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

root/etc/cont-init.d/05-upintheair

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/command/with-contenv bash
2+
3+
if [ "$SERVICE_ENABLE_FR24FEED" != "false" ]; then
4+
default_value() {
5+
key=${1//\-/_DASH_}
6+
key=FR24FEED_${key^^}
7+
eval "value=\${$key:-\$2}"
8+
printf -v $key -- "$value"
9+
export $key
10+
}
11+
12+
default_value "receiver" "beast-tcp"
13+
default_value "fr24key" "YOUR_KEY_HERE"
14+
default_value "host" "127.0.0.1:30005"
15+
default_value "bs" "no"
16+
default_value "raw" "no"
17+
default_value "logmode" "1"
18+
default_value "logpath" "/tmp"
19+
default_value "mlat" "yes"
20+
default_value "mlat-without-gps" "yes"
21+
22+
if [ ! -f /etc/fr24feed.ini ]; then
23+
/opt/confd/bin/confd -onetime -confdir "/etc/confd/fr24feed" -prefix "fr24feed" -backend env
24+
fi
25+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/confd-fr24feed/script
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/command/with-contenv bash
2+
3+
if [ "$SERVICE_ENABLE_HTTP" != "false" ]; then
4+
default_value() {
5+
key=${1//\-/_DASH_}
6+
key=HTML_${key^^}
7+
eval "value=\${$key:-\$2}"
8+
printf -v $key -- "$value"
9+
export $key
10+
}
11+
12+
default_value "site_lat" "45.0"
13+
default_value "site_lon" "9.0"
14+
default_value "site_name" "My Radar Site"
15+
default_value "default_tracker" "FlightAware"
16+
default_value "receiver_stats_page_flightaware" ""
17+
default_value "receiver_stats_page_flightradar24" ""
18+
default_value "fr24_feeder_status_page" ""
19+
20+
if [ ! -f /usr/lib/fr24/public_html/config.js ]; then
21+
/opt/confd/bin/confd -onetime -confdir "/etc/confd/html" -prefix "html" -backend env
22+
fi
23+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/confd-html/script
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/command/with-contenv bash
2+
3+
if [ "$SERVICE_ENABLE_HTTP" != "false" ]; then
4+
if [ ! -f /usr/lib/fr24/public_html/layers.js ]; then
5+
/opt/confd/bin/confd -onetime -confdir "/etc/confd/layers" -prefix "layers" -backend env
6+
fi
7+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/confd-layers/script
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/command/with-contenv bash
2+
3+
if [ "$SERVICE_ENABLE_PIAWARE" != "false" ]; then
4+
default_value() {
5+
key=${1//\-/_DASH_}
6+
key=PIAWARE_${key^^}
7+
eval "value=\${$key:-\$2}"
8+
printf -v $key -- "$value"
9+
export $key
10+
}
11+
12+
default_value "feeder-id" "YOUR_FEEDER_ID"
13+
default_value "receiver-type" "other"
14+
default_value "receiver-host" "127.0.0.1"
15+
default_value "receiver-port" "30005"
16+
17+
if [ ! -f /etc/piaware.conf ]; then
18+
/opt/confd/bin/confd -onetime -confdir "/etc/confd/piaware" -prefix "piaware" -backend env
19+
fi
20+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/confd-piaware/script

0 commit comments

Comments
 (0)