From 736a1fb9fca4ba11612e2bd38a290f95ae8002b6 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 17 Nov 2019 01:58:33 +0300 Subject: initial commit --- README.md | 47 +++++++++++++++++ docker-compose.yml | 33 ++++++++++++ dump1090/Dockerfile | 40 +++++++++++++++ dump1090/config.js | 125 ++++++++++++++++++++++++++++++++++++++++++++++ dump1090/supervisord.conf | 16 ++++++ fr24feed/Dockerfile | 28 +++++++++++ fr24feed/fr24feed.ini | 6 +++ 7 files changed, 295 insertions(+) create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 dump1090/Dockerfile create mode 100644 dump1090/config.js create mode 100644 dump1090/supervisord.conf create mode 100644 fr24feed/Dockerfile create mode 100644 fr24feed/fr24feed.ini diff --git a/README.md b/README.md new file mode 100644 index 0000000..2059142 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +fr24feed in Docker +================== + +I'm tired of keeping track of all the hacks I needed to introduce to my Arch +Linux installation on my Raspberry Pi to get fr24feed running, so here's a +Docker configuration. + +Usage +----- + +* Type in your sharing key in fr24feed/fr24feed.ini. + + fr24key="0123456789abcdef" + +* Optionally, edit dump1090/config.js to set the correct coordinates of the +receiver. + + DefaultCenterLat = 66.5; + DefaultCenterLon = 25.19; + + SiteShow = true; + SiteLat = 66.5; + SiteLon = 25.19; + SiteName = "My receiver"; + +* Optionally, edit dump1090/supervisord.conf to set the correct coordinates of +the receiver in dump1090-fa's arguments (`--lat` and `--lon`). + + command=/usr/bin/dump1090-fa ... --lat 66.5 --lon 25.19 ... + +Start the containers using + + docker-compose up -d + +You can now access the interactive map at http://0.0.0.0:8080/dump1090-fa/ and +the fr24feed web interface at http://0.0.0.0:8754/. + +Stop the containers using + + docker-compose down -v + +Development +----------- + +Build the images using + + docker-compose build --force-rm diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1e7bd91 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +version: '3' +services: + dump1090: + build: ./dump1090 + devices: + - /dev/bus/usb + expose: + - 80 + - 30001 + - 30002 + - 30003 + - 30004 + - 30005 + - 30104 + image: egortensin/dump1090 + ports: + - 8080:80 + restart: always + volumes: + - './dump1090/config.js:/usr/share/dump1090-fa/html/config.js:ro' + - './dump1090/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro' + fr24feed: + build: ./fr24feed + depends_on: + - dump1090 + expose: + - 8754 + image: egortensin/fr24feed + ports: + - 8754:8754 + restart: always + volumes: + - './fr24feed/fr24feed.ini:/etc/fr24feed.ini:ro' diff --git a/dump1090/Dockerfile b/dump1090/Dockerfile new file mode 100644 index 0000000..490e5ef --- /dev/null +++ b/dump1090/Dockerfile @@ -0,0 +1,40 @@ +FROM debian:stretch + +LABEL maintainer="Egor Tensin " + +# Don't prompt: +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update -yq && apt-get dist-upgrade -yq + +# Install dependencies (from README at https://github.com/flightaware/dump1090): +RUN apt-get install -yq build-essential debhelper librtlsdr-dev pkg-config dh-systemd libncurses5-dev libbladerf-dev + +# Install Supervisor to run both lighttpd and dump1090: +RUN apt-get install -yq supervisor + +# Build and install the dump1090-fa package: +WORKDIR /tmp + +# Variables: +ARG DUMP1090_VERSION=3.7.2 +ARG DUMP1090_ARCH=armhf + +ADD ["https://github.com/flightaware/dump1090/archive/v${DUMP1090_VERSION}.tar.gz", "./dump1090-${DUMP1090_VERSION}.tar.gz"] + +RUN tar xzf dump1090-${DUMP1090_VERSION}.tar.gz && \ + cd dump1090-${DUMP1090_VERSION} && \ + dpkg-buildpackage -b && \ + dpkg-buildpackage -Tclean && \ + apt-get install -yq ../dump1090-fa_${DUMP1090_VERSION}_${DUMP1090_ARCH}.deb + +# Create the /run/dump1090-fa directory, typically created by systemd: +RUN mkdir --mode=0755 /run/dump1090-fa + +# Config files: +COPY ["config.js", "/usr/share/dump1090-fa/html/"] +COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] + +EXPOSE 80 30001 30002 30003 30004 30005 30104 + +CMD ["/usr/bin/supervisord", "--configuration=/etc/supervisor/conf.d/supervisord.conf"] diff --git a/dump1090/config.js b/dump1090/config.js new file mode 100644 index 0000000..b9be157 --- /dev/null +++ b/dump1090/config.js @@ -0,0 +1,125 @@ +// -------------------------------------------------------- +// +// This file is to configure the configurable settings. +// Load this file before script.js file at gmap.html. +// +// -------------------------------------------------------- + +// -- Title Settings -------------------------------------- +// Show number of aircraft and/or messages per second in the page title +PlaneCountInTitle = true; +MessageRateInTitle = false; + +// -- Output Settings ------------------------------------- +// The DisplayUnits setting controls whether nautical (ft, NM, knots), +// metric (m, km, km/h) or imperial (ft, mi, mph) units are used in the +// plane table and in the detailed plane info. Valid values are +// "nautical", "metric", or "imperial". +DisplayUnits = "nautical"; + +// -- Map settings ---------------------------------------- +// These settings are overridden by any position information +// provided by dump1090 itself. All positions are in decimal +// degrees. + +// Default center of the map. +DefaultCenterLat = 45.0; +DefaultCenterLon = 9.0; +// The google maps zoom level, 0 - 16, lower is further out +DefaultZoomLvl = 7; + +// Center marker. If dump1090 provides a receiver location, +// that location is used and these settings are ignored. + +SiteShow = false; // true to show a center marker +SiteLat = 45.0; // position of the marker +SiteLon = 9.0; +SiteName = "My Radar Site"; // tooltip of the marker + +// -- Marker settings ------------------------------------- + +// These settings control the coloring of aircraft by altitude. +// All color values are given as Hue (0-359) / Saturation (0-100) / Lightness (0-100) +ColorByAlt = { + // HSL for planes with unknown altitude: + unknown : { h: 0, s: 0, l: 40 }, + + // HSL for planes that are on the ground: + ground : { h: 15, s: 80, l: 20 }, + + air : { + // These define altitude-to-hue mappings + // at particular altitudes; the hue + // for intermediate altitudes that lie + // between the provided altitudes is linearly + // interpolated. + // + // Mappings must be provided in increasing + // order of altitude. + // + // Altitudes below the first entry use the + // hue of the first entry; altitudes above + // the last entry use the hue of the last + // entry. + h: [ { alt: 2000, val: 20 }, // orange + { alt: 10000, val: 140 }, // light green + { alt: 40000, val: 300 } ], // magenta + s: 85, + l: 50, + }, + + // Changes added to the color of the currently selected plane + selected : { h: 0, s: -10, l: +20 }, + + // Changes added to the color of planes that have stale position info + stale : { h: 0, s: -10, l: +30 }, + + // Changes added to the color of planes that have positions from mlat + mlat : { h: 0, s: -10, l: -10 } +}; + +// For a monochrome display try this: +// ColorByAlt = { +// unknown : { h: 0, s: 0, l: 40 }, +// ground : { h: 0, s: 0, l: 30 }, +// air : { h: [ { alt: 0, val: 0 } ], s: 0, l: 50 }, +// selected : { h: 0, s: 0, l: +30 }, +// stale : { h: 0, s: 0, l: +30 }, +// mlat : { h: 0, s: 0, l: -10 } +// }; + +// Outline color for aircraft icons with an ADS-B position +OutlineADSBColor = '#000000'; + +// Outline color for aircraft icons with a mlat position +OutlineMlatColor = '#4040FF'; + +SiteCircles = true; // true to show circles (only shown if the center marker is shown) +// In miles, nautical miles, or km (depending settings value 'DisplayUnits') +SiteCirclesDistances = new Array(100,150,200); + +// Controls page title, righthand pane when nothing is selected +PageName = "PiAware SkyAware"; + +// Show country flags by ICAO addresses? +ShowFlags = true; + +// Path to country flags (can be a relative or absolute URL; include a trailing /) +FlagPath = "flags-tiny/"; + +// Set to true to enable the ChartBundle base layers (US coverage only) +ChartBundleLayers = false; + +// Provide a Bing Maps API key here to enable the Bing imagery layer. +// You can obtain a free key (with usage limits) at +// https://www.bingmapsportal.com/ (you need a "basic key") +// +// Be sure to quote your key: +// BingMapsAPIKey = "your key here"; +// +BingMapsAPIKey = null; + +// Turn on display of extra Mode S EHS / ADS-B v1/v2 data +// This is not polished yet (and so is disabled by default), +// currently it's just a data dump of the new fields with no UX work. +ExtendedData = false; diff --git a/dump1090/supervisord.conf b/dump1090/supervisord.conf new file mode 100644 index 0000000..f375df6 --- /dev/null +++ b/dump1090/supervisord.conf @@ -0,0 +1,16 @@ +[supervisord] +nodaemon=true + +[program:lighttpd] +command=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 + +[program:dump1090] +command=/usr/bin/dump1090-fa --gain -10 --net --lat 45.0 --lon 9.0 --fix --write-json /run/dump1090-fa --json-location-accuracy 1 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 diff --git a/fr24feed/Dockerfile b/fr24feed/Dockerfile new file mode 100644 index 0000000..57a355c --- /dev/null +++ b/fr24feed/Dockerfile @@ -0,0 +1,28 @@ +FROM debian:stretch + +LABEL maintainer="Egor Tensin " + +# Don't prompt: +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update -yq && apt-get dist-upgrade -yq + +# Install fr24feed dependencies: +RUN apt-get install -yq ca-certificates procps + +# Variables: +ARG FR24FEED_VERSION=1.0.24-7 +ARG FR24FEED_ARCH=armhf + +# Download fr24feed: +WORKDIR /tmp +ADD ["https://repo-feed.flightradar24.com/rpi_binaries/fr24feed_${FR24FEED_VERSION}_${FR24FEED_ARCH}.tgz", "./"] +RUN tar xzf fr24feed_${FR24FEED_VERSION}_${FR24FEED_ARCH}.tgz + +# fr24feed config: +COPY ["fr24feed.ini", "/etc/"] + +EXPOSE 8754 + +WORKDIR fr24feed_${FR24FEED_ARCH} +CMD ["./fr24feed"] diff --git a/fr24feed/fr24feed.ini b/fr24feed/fr24feed.ini new file mode 100644 index 0000000..0ec1892 --- /dev/null +++ b/fr24feed/fr24feed.ini @@ -0,0 +1,6 @@ +fr24key="YOUR_SHARING_KEY" +receiver="avr-tcp" +host="dump1090:30002" +bs="no" +mlat="yes" +mlat-without-gps="yes" -- cgit v1.2.3