pfclient automatic setup

TheBiggerGuy

New Member
Hi all,

I have a docker script that sets up a 'pfclient-config.json' file with the correct setting before running the 'pfclient'. However I always have to go via the 'setup' process via the web UI before pfclient will start fully. Is there a magic setting that is required?

Bash:
ping -c 1 dump1090
PING dump1090 (172.18.0.2) 56(84) bytes of data.
64 bytes from docker-ads-b_dump1090_1.dockeradsb_default (172.18.0.2): icmp_seq=1 ttl=64 time=0.456 ms

cat /etc/pfclient/pfclient-config.json
{
  "connection_type": "1",
  "data_format": "1",
  "tcp_address": "dump1090",
  "tcp_port": "30005",

  "data_upload_interval": "10",
  "aircraft_timeout": "30",
  "select_timeout": "10",

  "sharecode": "5X2X2X2X9XaX3",
  "latitude": "XX.XXXXXX",
  "longitude": "-X.XXXXXX"
}

pfclient --config_path=/etc/pfclient/pfclient-config.json --log_path=/var/log
 
I have a share code and it is in the config file however I still get the setup process. Note I have X'ed out parts of the latitude, longitude and sharecode above for sharing here.
 
From memory the path is actually just /etc/pfclient-config.json

You can confirm by running through the setup and see if it creates the file there.

BTW - You can only use a share code on one device. If you use it on more than one it will get blocked.
 
I have specified the config file via the '--config_path' arg. I have also run strace to confirm it is correctly reading that right file.

I have the above config file with the above command line running. I still require to go through the setup process. All the boxes are correctly filled in except the latitude and latitude suggesting it has correctly read the config file but had issue with the long/lat. There is no error with the lon/lat via the we UI and I have tried using the map based pin version to enter the lon/lat also. Post re-going through the web setup every time the config file is identical but with the lon/lat set to "0.000000". So I am assuming the issue is to do with the longitude latitude.
 
I am generating new codes (currently only one) on a desktop and then passing them down into the docker instances via environment variables. I am aware the sharecodes are only valid per instance. My primary use of Docker here is isolation not clustering.

ps. I am also getting seg faults occasionally. Do you want the core dumps?

pps. Thanks for looking into this
 
Yeah core dumps best uploaded to dropbox and then post a link in here. What architecture is it?

Is the config path actually writeable? Also we use the "-z" option in our init scripts not that should make much difference.
 
Also what version of the client are you using? 4.1.1 is the latest. I think the segfault could be something to do with something not being writable potentially as we don't really support this sort of install!
 
It is closed source yes.

Probably best you allow it to generate a config file so you can see the format. But yes decimal only there
 
Here is the quick overview of the setup. With the PLANEFINDER_* vars been passed in.

Docker
Code:
FROM debian:buster-slim

ARG PFCLIENT_VERSION=3.7.40
ARG PFCLIENT_HASH=064a908dfcacfea008810aa6684d0340

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates iputils-ping && \
    wget -O pfclient.tar.gz "http://client.planefinder.net/pfclient_${PFCLIENT_VERSION}_armhf.tar.gz" && \
    md5sum pfclient.tar.gz && echo "${PFCLIENT_HASH}  pfclient.tar.gz" | md5sum -c && \
    tar -xvf pfclient.tar.gz && \
    mv pfclient /usr/local/bin/pfclient && \
    rm pfclient.tar.gz && \
    ln -s /lib/ld-linux.so.3 /lib/ld-linux-armhf.so.3 && \
    mkdir /etc/pfclient && \
    apt-get remove -y wget && \
    rm -rf /var/lib/apt/lists/*

COPY pfclient-runner.sh /usr/local/bin/pfclient-runner
COPY pfclient-config.json /etc/pfclient/pfclient-config.json

EXPOSE 30053

ENTRYPOINT ["pfclient-runner"]

pfclient-runner
Bash:
sed -i "s/PLANEFINDER_SHARECODE/${PLANEFINDER_SHARECODE}/" /etc/pfclient/pfclient-config.json
sed -i "s/PLANEFINDER_LATITUDE/${PLANEFINDER_LATITUDE}/" /etc/pfclient/pfclient-config.json
sed -i "s/PLANEFINDER_LONGITUDE/${PLANEFINDER_LONGITUDE}/" /etc/pfclient/pfclient-config.json
pfclient --config_path=/etc/pfclient/pfclient-config.json --log_path=/var/log

pfclient-config.json
JSON:
{
  "connection_type": "1",
  "data_format": "1",
  "tcp_address": "dump1090",
  "tcp_port": "30005",

  "data_upload_interval": "10",
  "aircraft_timeout": "30",
  "select_timeout": "10",

  "sharecode": "PLANEFINDER_SHARECODE",
  "latitude": "PLANEFINDER_LATITUDE",
  "longitude": "PLANEFINDER_LONGITUDE"
}
 
I did generate a config to base it on but it seems not to like my location and I now have extra logging to confirm it "2018-06-20 13:06:58.130218 [V] An invalid user location is set in pfclient-config.json and will be ignored"

What is wrong with "56.412574" x "-3.035684"? It doesn't work with the web UI or by config file.
 
Nothing is wrong with those. I'm afraid I'm at a loss as to why it doesn't work. I think it's down to it not being able to read the config file correctly somehow. Does it work if you use a config file that has not been "generated" at all?

Also I would use the latest client 4.1.1 as that has a more modern linker used.

Your Segfaults might be caused by the manual linking of the armhf shared libs, is this a normal i386 Linux install as we have an i386 version.
 
Going via the web UI causes the collector thread to start bu then fail with the "bad" long/lat. "[!] Data upload failed with error: 'Please enter valid coordinates for your receiver in the config'"

Do you know why it doesn't like the above coordinates? I have tried others around the same area with the same outcome (I don't want to submit data with a location too far away from the real location). Also does the web UI do any sanity checking of the location?
 
The config file is read+write and strace shows it is read. The web UI fills in the sharecode and tcp host/port and when I set different settings the file is overwritten. I think it is the lon/lat.

Bash:
root@41866da05756:/# whoami
root

root@41866da05756:/# ls -ahls /etc/pfclient/pfclient-config.json
4.0K -rw-r--r-- 1 root root 309 Jun 17 20:39 /etc/pfclient/pfclient-config.json

root@41866da05756:/# ls -ahls /usr/local/bin/pfclient
3.7M -rwxr-xr-x 1 root root 3.7M Jan  8 14:02 /usr/local/bin/pfclient
 
Ok, I'm afraid I'm going to have to stop there as we don't really support this sort of config and it's getting a little 'custom'. Sorry!

Most people just install it fresh on a Pi direct, I know a few people have got it working fine in docker though. Perhaps if it's Debian just let it install using the .deb in your DOCKERFILE?

I personally would try the .deb approach, set it up manually as per our WebUI and that way you can be sure it works and then unpick and automate it from there.

Also isn't one client enough in one location?
 
OK ver 4.1.1 seems to accept my long/lat. Do you know what would of changed that from 3.7.40? I am going to rebuild and test when it is not running under GDB and let you know what happens. Thanks for the support you have provided.
 
OK the reason ver 4.1.1 works is it takes the the long/lat and converts it to "-1.000000" without showing an error. Going back via the web UI and changing the long/lat always gets back to -1. Changing any over values works fine.

Are you able to see how many users are reporting locations of -1.000000/-1.000000 as this is a silent error and more users may have issues. My best guess is some float issue.
 
Back
Top