Announcement

Collapse
No announcement yet.

Two instances of FR24feed on the same linux box?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • abcd567
    replied
    Finally, almost like Windows Feeder / RPi Feeder / Linux i386 .deb package setup...

    Found a way to make linux binary's configuration & setup almost like Windows Feeder / RPi Feeder / Linux i386 .deb package setup

    Note:
    The steps below are for Feeder-1.
    For Feeder-2, replace fr24feed-1 by fr24feed-2, and fr24-1 by fr24-2, wherever these occur in code below.

    STEP-1: Prepare config file "fr24feed.ini"
    Code:
    sudo touch /etc/fr24feed-1.ini
    sudo chmod a+rw /etc/fr24feed-1.ini
    sudo nano /etc/fr24feed-1.ini
    Copy-paste following into /etc/fr24feed-1.ini
    Code:
    receiver="beast-tcp"
    fr24key="xxxxxxxxxxxxxxxx"
    host="127.0.0.1:30005"
    
    bs="no"
    raw="no"
    logmode="1"
    logpath="/var/log/fr24-1"
    mpx="no"
    mlat="yes"
    mlat-without-gps="yes"
    use-http="yes"
    http-timeout="20"

    STEP-2: Prepare service file "fr24feed-1.service"
    Code:
    sudo nano /lib/systemd/system/fr24feed-1.service

    Copy-paste following into /lib/systemd/system/fr24feed-1.service
    Code:
    [Unit]
    Description=Flightradar24 Feeder
    After=network-online.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    RuntimeDirectory=fr24feed
    RuntimeDirectoryMode=0755
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1
    ExecStart=/usr/bin/fr24feed  --config-file=/etc/fr24feed-1.ini  
    User=fr24
    PermissionsStartOnly=true
    StandardOutput=null
    
    [Install]
    WantedBy=multi-user.target

    STEP-3: Enable service, and start fr24feed-1
    Code:
    sudo systemctl enable fr24feed-1
    sudo systemctl restart fr24feed-1

    STEP-4: Check status
    Code:
    abcd@debian:~$ sudo systemctl status fr24feed-1
    
    ● fr24feed-1.service - Flightradar24 Feeder
       Loaded: loaded (/lib/systemd/system/fr24feed-1.service; enabled; vendor preset: enabled)
       Active: active (running) since Fri 2019-04-19 17:34:42 EDT; 6s ago
      Process: 4345 ExecStartPre=/bin/chown fr24 /var/log/fr24-1 (code=exited, status=0/SUCCESS)
      Process: 4342 ExecStartPre=/bin/mkdir -p /var/log/fr24-1 (code=exited, status=0/SUCCESS)
     Main PID: 4348 (fr24feed)
        Tasks: 9 (limit: 4915)
       CGroup: /system.slice/fr24feed-1.service
               └─4348 /usr/bin/fr24feed --config-file=/etc/fr24feed-1.ini
    
    Apr 19 17:34:42 debian systemd[1]: Starting Flightradar24 Feeder...
    Apr 19 17:34:42 debian systemd[1]: Started Flightradar24 Feeder.


    STEP-5: Check logs
    Scroll down to see full log
    Code:
    abcd@debian:~$ cat /var/log/fr24-1/fr24feed.log 
    
    2019-04-19 17:34:42 | [main][i]FR24 Feeder/Decoder
    2019-04-19 17:34:42 | [main][i]Version: 1.0.18-5/generic
    2019-04-19 17:34:42 | [main][i]Built on Mar  4 2016 16:26:55 (devel-d11ca48.git/Linux/x86_64)
    2019-04-19 17:34:42 | [main][i]Copyright 2012-2016 Flightradar24 AB
    2019-04-19 17:34:42 | [main][i]http://flightradar24.com
    2019-04-19 17:34:43 | [main][i]DNS mode: LIBC
    2019-04-19 17:34:43 | [main][i]Automatic updates are DISABLED
    2019-04-19 17:34:43 | [main][i]Reader thread started
    2019-04-19 17:34:43 | [main][i]MLAT data feed started
    2019-04-19 17:34:43 | [reader][i]Initializing reader
    2019-04-19 17:34:43 | [reader][i]Connecting to Beast receiver via (tcp://127.0.0.1:30005)
    2019-04-19 17:34:43 | [mlat][i]Waiting for MLAT configuration
    2019-04-19 17:34:43 | [master][i]Starting processing thread
    2019-04-19 17:34:43 | [e]bind function failed, errno: 98
    2019-04-19 17:34:43 | [httpd][d]Master thread terminated
    2019-04-19 17:34:43 | [reader][i]Connected to the receiver, configuring
    2019-04-19 17:34:43 | [reader][i]Configured, processing messages
    2019-04-19 17:34:43 | [reader][w]Setting new UTC offset: 0!
    2019-04-19 17:34:44 | [time][i]Synchronizing time via NTP
    2019-04-19 17:34:46 | [time][i]Time synchronized correctly, offset +0.0005 seconds
    2019-04-19 17:34:46 | [main][i]Feed Network client started
    2019-04-19 17:34:46 | [feed][i]Downloading configuration
    2019-04-19 17:34:47 | [feed][c]Interval: 5s
    2019-04-19 17:34:47 | [feed][c]Latitude: 43.xxxx
    2019-04-19 17:34:47 | [feed][c]Longitude: -79.xxxx
    2019-04-19 17:34:47 | [feed][c]GND: YES
    2019-04-19 17:34:47 | [feed][c]NonADSB: YES
    2019-04-19 17:34:47 | [feed][c]Timestamps: optional
    2019-04-19 17:34:47 | [feed][c]Max range AIR: 350.0nm
    2019-04-19 17:34:47 | [feed][c]Max range GND: 100.0nm
    2019-04-19 17:34:47 | [feed][i]defined 4 servers
    2019-04-19 17:34:47 | [feed][n]CYYZ52@185.218.24.22:8099/UDP
    2019-04-19 17:34:47 | [feed][n]connecting
    2019-04-19 17:34:47 | [stats][i]Stats thread started
    2019-04-19 17:34:47 | [feed][n]connected via UDP (fd 8)
    2019-04-19 17:34:47 | [feed][n]working
    2019-04-19 17:34:48 | [feed][i]sent 11, filtered 0 AC in 1 packet
    2019-04-19 17:34:48 | [mlat][i]MLAT configuration received, service ENABLED
    2019-04-19 17:34:48 | [mlat][i]Starting MLAT with preconfigured position: 43.xx,-79.xx,450.0
    2019-04-19 17:34:48 | [mlat][i]MLAT bandwidth reduction active, level 1
    2019-04-19 17:34:48 | [mlat][i]Configuring UDP connection udp://usa-2.fr24.com:19788
    2019-04-19 17:34:48 | [mlat][i]Registering MLAT station
    2019-04-19 17:34:48 | [mlat][i]Registering MLAT station: SUCCESS
    2019-04-19 17:34:53 | [feed][i]sent 26, filtered 0 AC in 1 packet
    2019-04-19 17:34:54 | [mlat][i]Received ADS-B time references AC:
    2019-04-19 17:34:54 | [mlat][i] A082AC
    2019-04-19 17:34:54 | [mlat][i] A2A7B5
    2019-04-19 17:34:54 | [mlat][i] A73E6D
    2019-04-19 17:34:54 | [mlat][i] A7C849
    2019-04-19 17:34:54 | [mlat][i] AADF08
    2019-04-19 17:34:54 | [mlat][i] ACB0B9
    2019-04-19 17:34:54 | [mlat][i] ADCD6D
    2019-04-19 17:34:54 | [mlat][i] C0193B
    2019-04-19 17:34:54 | [mlat][i] C0225E
    2019-04-19 17:34:54 | [mlat][i] C04D0A
    2019-04-19 17:34:54 | [mlat][i] C05F0E
    2019-04-19 17:34:54 | [mlat][i] C07F2F
    2019-04-19 17:34:54 | [mlat][i] C07F37
    2019-04-19 17:34:58 | [feed][i]sent 29, filtered 0 AC in 1 packet
    2019-04-19 17:35:03 | [feed][i]sent 36, filtered 0 AC in 1 packet
    2019-04-19 17:35:04 | [mlat][i]Pinging the server
    2019-04-19 17:35:04 | [mlat][i]Stats 92759/92759
    2019-04-19 17:35:08 | [feed][i]sent 34, filtered 0 AC in 1 packet
    2019-04-19 17:35:13 | [feed][i]sent 34, filtered 0 AC in 1 packet
    2019-04-19 17:35:18 | [feed][i]sent 29, filtered 0 AC in 1 packet
    2019-04-19 17:35:24 | [feed][i]sent 34, filtered 0 AC in 1 packet
    2019-04-19 17:35:29 | [feed][i]sent 32, filtered 0 AC in 1 packet
    2019-04-19 17:35:34 | [feed][i]sent 30, filtered 0 AC in 1 packet
    Last edited by abcd567; 2019-04-20, 21:53.

    Leave a comment:


  • wiedehopf
    replied
    I mean if someone does this he should be able to do the settings without the webinterface.
    No big loss imho.

    Anyway the number of people using this will likely be limited to the single digits.

    Also you should set the MLAT to no in your secondary feed:
    Code:
    MLAT="--mlat=no --mlat-without-gps=no"

    Leave a comment:


  • abcd567
    replied
    Originally posted by Oblivian View Post
    From experience its hard coded. No way around
    Oh boy!

    Leave a comment:


  • Oblivian
    replied
    From experience its hard coded. No way around

    Sent from my EML-L09 using Tapatalk

    Leave a comment:


  • abcd567
    replied
    @Khan
    @Oblivian

    By default fr24feed (arm & i386) serves status & settings page in browser at port 8754.

    If I want to change this to another port number, what is the process argument to be passed to fr24feed binary?

    As an example, dump1090 by default serves map in browser at port 8080. This can be customized to another port, for example 8787 by passing following process arguments to dump1090
    --net-http-port 8787

    Leave a comment:


  • abcd567
    replied
    I thought of another slightly different format of fr24feed ini file.

    Code:
    sudo nano /etc/fr24feed-1.ini

    Copy-paste following code in above file
    Code:
    CONFIG=" \
     --receiver=beast-tcp" \
     --fr24key=xxxxxxxxxxxxxxxx \
     --host=127.0.0.1:30005 \
     --bs=no \
     --raw=no \
     --logmode=1 \
     --logpath=/var/log/fr24-1 \
     --mlat=yes \
     --mlat-without-gps=yes \
     --use-http=yes \
     --http-timeout=20 "
    IMPORTANT:
    If you type the above code, make sure there is no blank space after back-slah \ .

    Better copy-paste from above instead of typing

    Code:
    [Unit] 
    Description=Flightradar24 Feeder 
    After=network-online.target 
    
    [Service] 
    Type=simple 
    Restart=always 
    LimitCORE=infinity 
    EnvironmentFile=/etc/fr24feed-1.ini 
    RuntimeDirectory=fr24feed 
    RuntimeDirectoryMode=0755 
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1 
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1 
    ExecStart=/usr/bin/fr24feed $CONFIG 
    User=fr24 
    PermissionsStartOnly=true 
    StandardOutput=null 
    
    [Install] 
    WantedBy=multi-user.target
    Last edited by abcd567; 2019-04-19, 05:50.

    Leave a comment:


  • abcd567
    replied
    OK, if you dont want to edit the service file every time you want to change parameters, then create a .ini file, and add some code in service file to get data from the .ini file

    STEP-1:
    Prepare fr24feed-1.ini and fr24feed-2.ini files

    1.1 - Feeder-1

    Code:
    sudo touch /etc/fr24feed-1.ini
    sudo chmod a+rw /etc/fr24feed-1.ini
    sudo nano /etc/fr24feed-1.ini
    Copy-paste following code, then save file (Ctrl+o) and (Ctrl+x)

    Code:
    RECEIVER="--receiver=beast-tcp"
    KEY="--fr24key=xxxxxxxxxxxxxxxx"
    HOST="--host=127.0.0.1:30005"
    OUTPUT="--bs=no --raw=no"
    LOG="--logmode=1 --logpath=/var/log/fr24-1"
    MLAT="--mlat=yes --mlat-without-gps=yes"
    CONNECTION="--use-http=yes  --http-timeout=20"

    1.2 - Feeder-2

    Code:
    sudo touch /etc/fr24feed-2.ini
    sudo chmod a+rw /etc/fr24feed-2.ini
    sudo nano /etc/fr24feed-2.ini
    Copy-paste following code

    Code:
    RECEIVER="--receiver=beast-tcp"
    KEY="--fr24key=yyyyyyyyyyyyyyyy"
    HOST="--host=127.0.0.1:31005"
    OUTPUT="--bs=no --raw=no"
    LOG="--logmode=1 --logpath=/var/log/fr24-2"
    MLAT="--mlat=yes --mlat-without-gps=yes"
    CONNECTION="--use-http=yes  --http-timeout=20"
    Save file (Ctrl+o) and (Ctrl+x)






    STEP-2:
    Change fr24feed-1.service and fr24feed-2.service files to become like this. (changes shown in red)

    1.1 Feeder-1
    Code:
    sudo nano /lib/systemd/system/fr24feed-1.service
    Code:
    [Unit]
    Description=Flightradar24 Feeder
    After=network-online.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    EnvironmentFile=/etc/fr24feed-1.ini
    RuntimeDirectory=fr24feed
    RuntimeDirectoryMode=0755
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1
    ExecStart=/usr/bin/fr24feed  $RECEIVER $KEY $HOST $OUTPUT $LOG $MLAT $CONNECTION
    User=fr24
    PermissionsStartOnly=true
    StandardOutput=null
    
    [Install]
    WantedBy=multi-user.target
    Save file (Ctrl+o) then (Ctrl+x)


    1.2 Feeder-2
    Code:
    sudo nano /lib/systemd/system/fr24feed-2.service
    Code:
    [Unit]
    Description=Flightradar24 Feeder
    After=network-online.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    EnvironmentFile=/etc/fr24feed-2.ini
    RuntimeDirectory=fr24feed
    RuntimeDirectoryMode=0755
    ExecStartPre=/bin/mkdir -p /var/log/fr24-2
    ExecStartPre=/bin/chown fr24 /var/log/fr24-2
    ExecStart=/usr/bin/fr24feed  $RECEIVER $KEY $HOST $OUTPUT $LOG $MLAT $CONNECTION
    User=fr24
    PermissionsStartOnly=true
    StandardOutput=null
    
    [Install]
    WantedBy=multi-user.target
    Save file (Ctrl+o) then (Ctrl+x)

    STEP-3:
    Implement the changes made in .service files

    Code:
    sudo systemctl daemon-reload 
    sudo systemctl restart fr24feed-1
    sudo systemctl restart fr24feed-1
    Last edited by abcd567; 2019-04-19, 05:54.

    Leave a comment:


  • abcd567
    replied
    Originally posted by wiedehopf View Post
    Do you just delete the /etc/fr24feed.ini when you give the parameters on the command line?

    Or do the command line parameters take precedence anyway?
    The binary does not create the fr24feed.ini, but searches for it if vital parameters (fr24key, receiver, host & port) are not added to start command as arguments, and if does not find the vital parameters, finally fails

    For single instance use, I create the file fr24feed.ini manually by touch command, then do chmod a+rw on it.

    If installation is done by .deb package, the .deb package creates the fr24feed.ini
    Last edited by abcd567; 2019-04-16, 19:39.

    Leave a comment:


  • abcd567
    replied
    Originally posted by wiedehopf View Post
    Or you can use the -p option for mkdir so it doesn't report an error if the directory already exists.
    Thanks for the tip.
    Added -p with mkdir command

    Leave a comment:


  • wiedehopf
    replied
    That might fail because mkdir reports an error.
    You can use a minus sign before the command to ignore the return code of the command.

    Or you can use the -p option for mkdir so it doesn't report an error if the directory already exists.

    Otherwise the whole service might show an error.
    (On first run it will work as the directory doesn't exist yet)

    Also it's not necessary to run these commands on every start because the directories will remain with their permissions.
    (In case of dump1090-mutability using touch and chown that's different because the file needs to be overwritten on each start. In the directories though as soon as they are owned by fr24, the program can do whatever it wants inside of these directories)

    Leave a comment:


  • abcd567
    replied
    UPDATED POST #7
    Log file functionally added by modifying service files

    Added code in red
    Code:
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1
    ExecStart=/usr/bin/fr24feed --fr24key=xxxxxxxxxxxxxxxx --receiver=beast-tcp --host=127.0.0.1:30005 --logmode=1 --logpath=/var/log/fr24-1/
    Last edited by abcd567; 2019-04-16, 18:41.

    Leave a comment:


  • wiedehopf
    replied
    For troubleshooting it might not hurt to specify:
    Code:
    --logmode=1 --logpath=/var/log/fr24-1
    and
    --logmode=1 --logpath=/var/log/fr24-2
    after creating both directories:
    sudo mkdir /var/log/fr24-1
    sudo mkdir /var/log/fr24-2
    sudo chown fr24 /var/log/fr24-1
    sudo chown fr24 /var/log/fr24-2
    That way you can check the logs in both directories to make sure both instances are running correctly.

    Leave a comment:


  • wiedehopf
    replied
    I just tried running a second instance on the command line for testing.

    It seems you should disable MLAT on one receiver because the ports are probably hard coded and the two UDP connections get in each others way.

    Adding --mlat=no to one of the command lines should be sufficient.

    Leave a comment:


  • wiedehopf
    replied
    Do you just delete the /etc/fr24feed.ini when you give the parameters on the command line?

    Or do the command line parameters take precedence anyway?

    Also maybe you should mention that you can get a second feed key by using:
    Code:
    sudo fr24feed --signup
    It will put the share key into /etc/fr24feed.ini, so you need to note down your key before doing that.

    You can look up the feed keys you already have on the fr24 website:
    https://www.flightradar24.com/account/data-sharing
    Last edited by wiedehopf; 2019-04-16, 10:16.

    Leave a comment:


  • abcd567
    replied
    OBJECTIVE
    On one Linux machine, we have to setup two feeders with two feeder id
    fr24feed-1 with fr24key=xxxxxxxxxxxxxxxx
    fr24feed-2 with fr24key=yyyyyyyyyyyyyyyy

    STEP-1
    Follow the steps in this post

    One Pi, Two Dongles, Two Maps


    This will install dump1090-mutability with following two instances running simutaneosly (requires 2 dvb-t dongles)
    • dump1090-mutability, uses dongle 0. outputs Beast format data on port 30005
    • dump1090-mut-2, uses dongle 1. outputs Beast format data on port 31005



    STEP-2
    Follow steps given below to install two instances of FR24 FEEDER
    • fr24feed-1, uses fr24key=xxxxxxxxxxxxxxxx, gets data from dump1090-mutability on port 30005
    • fr24feed-2, uses fr24key=yyyyyyyyyyyyyyyy, gets data from dump1090-mutability-2 on port 31005


    2.1 - Download, extract, and install fr24feed binary

    Code:
    sudo wget https://repo-feed.flightradar24.com/linux_x86_64_binaries/fr24feed_1.0.18-5_amd64.tgz 
    sudo tar -xzf fr24feed_1.0.18-5_amd64.tgz
    cd fr24feed_amd64
    sudo install fr24feed /usr/bin/

    2.2 - Add system user fr24 to run the binary through fr24feed.service
    Code:
    sudo useradd --system fr24

    2.3 - Create fr24feed-1 service
    2.3.1 - Create a blank file fr24feed-1.service
    Code:
    sudo nano /lib/systemd/system/fr24feed-1.service
    2.3.2 - Copy-paste following code in blank file fr24feed-1.service
    Save file (Ctrl+o) and close file (Ctrl+x)
    Code:
    [Unit]
    Description=Flightradar24 Feeder
    After=network-online.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    RuntimeDirectory=fr24feed
    RuntimeDirectoryMode=0755
    ExecStartPre=/bin/mkdir -p /var/log/fr24-1
    ExecStartPre=/bin/chown fr24 /var/log/fr24-1
    ExecStart=/usr/bin/fr24feed --fr24key=xxxxxxxxxxxxxxxx --receiver=beast-tcp --host=127.0.0.1:30005 --logmode=1 --logpath=/var/log/fr24-1/
    User=fr24
    PermissionsStartOnly=true
    StandardOutput=null
    
    [Install]
    WantedBy=multi-user.target
    2.3.3 - Enable fr24feed-1 service
    Code:
    sudo systemctl enable fr24feed-1


    2.4 - Create fr24feed-2 service
    2.4.1 - Create a blank file fr24feed-2.service
    Code:
    sudo nano /lib/systemd/system/fr24feed-2.service
    2.4.2 - Copy-paste following code in blank file fr24feed-2.service
    Save file (Ctrl+o) and close file (Ctrl+x)

    Code:
    [Unit]
    Description=Flightradar24 Feeder
    After=network-online.target
    
    [Service]
    Type=simple
    Restart=always
    LimitCORE=infinity
    RuntimeDirectory=fr24feed
    RuntimeDirectoryMode=0755
    ExecStartPre=/bin/mkdir -p /var/log/fr24-2
    ExecStartPre=/bin/chown fr24 /var/log/fr24-2
    ExecStart=/usr/bin/fr24feed --fr24key=yyyyyyyyyyyyyyyy --receiver=beast-tcp --host=127.0.0.1:31005 --logmode=1 --logpath=/var/log/fr24-2/
    User=fr24
    PermissionsStartOnly=true
    StandardOutput=null
    
    [Install]
    WantedBy=multi-user.target
    2.4.3 - Enable fr24feed-2 service
    Code:
    sudo systemctl enable fr24feed-2

    2.5 - Start feeders. (these two feeders will automatically start at boot)
    Code:
    sudo systemctl restart fr24feed-1  
    sudo systemctl restart fr24feed-2

    2.6 - Check status

    Feeder-1
    Code:
    abcd@debian:~$ sudo systemctl status fr24feed-1
    ● fr24feedA.service - Flightradar24 Feeder
       Loaded: loaded (/lib/systemd/system/fr24feed-1.service; enabled; vendor preset: enabled)
       Active: active (running) since Tue 2019-04-16 03:33:06 EDT; 1h 22min ago
     Main PID: 9871 (fr24feed)
        Tasks: 9 (limit: 4915)
       CGroup: /system.slice/fr24feed-1.service
               └─9871 /usr/bin/fr24feed --fr24key=yyyyyyyyyyyyyyyy --receiver=beast-tcp --host=127.0.0.1:30005
    
    Apr 16 03:33:06 debian systemd[1]: Started Flightradar24 Feeder.

    Feeder-2
    Code:
    abcd@debian:~$ sudo systemctl status fr24feed-2
    ● fr24feedB.service - Flightradar24 Feeder
       Loaded: loaded (/lib/systemd/system/fr24feed-2.service; enabled; vendor preset: enabled)
       Active: active (running) since Tue 2019-04-16 03:33:27 EDT; 1h 19min ago
     Main PID: 9897 (fr24feed)
        Tasks: 8 (limit: 4915)
       CGroup: /system.slice/fr24feed-2.service
               └─9897 /usr/bin/fr24feed --fr24key=xxxxxxxxxxxxxxxx --receiver=beast-tcp --host=127.0.0.1:31005
    
    Apr 16 03:33:27 debian systemd[1]: Started Flightradar24 Feeder.
    2.7 - Check Log files

    Code:
    cat /var/log/fr24-1/fr24feed.log
    
    cat /var/log/fr24-2/fr24feed.log
    PENDING:
    Log file. (Done on 16/04/2019 by modifying .service files)
    Resolve conflict between two instances for web page "localhost:8754"

    .
    Last edited by abcd567; 2019-04-16, 23:31.

    Leave a comment:

Working...
X