Fetches ADS-B flight data from radar servers (ModeSMixer2 or Virtual Radar Server) and presents a chronological view of past flights with an interactive live map of position reports. Built with FastAPI
- Make sure you have Python 3 installed,
- Install the dependencies package with
pip3 install -r requirements.txt
The application can either be configured by enviroment variables or by a config file
- Copy the
config.json
from contrib/samples to the project root - Configure host/port of your radar server
- Choose whether you want to track military planes only
- Configure MongoDB as your database (see Database Configuration below)
See section below for details
- DATA_FOLDER
- SERVICE_URL
- SERVICE_TYPE
- MIL_ONLY
- DB_RETENTION_MIN
- UNKNOWN_AIRCRAFT_CRAWLING
- MONGODB_URI
- MONGODB_DB_NAME
The application uses MongoDB for data storage, with time-series collections for efficient position data storage:
Configure MongoDB in your config.json:
"database": {
"mongodb_uri": "mongodb://localhost:27017/",
"mongodb_db_name": "flightradar"
}
Or set these environment variables:
MONGODB_URI=mongodb://localhost:27017/
MONGODB_DB_NAME=flightradar
Option name | Optional | Default value | Description |
---|---|---|---|
serviceUrl |
no | The url to your radar service | |
type |
yes | vrs | The type of your radar service, eithr vrs for VirtualRadarServer, mm2 for ModeSMixer2 or dmp1090 for dump1090 |
dataFolder |
yes | resources | the absolute path to your resources folder |
militaryOnly |
yes | false | Whether everything other than military planes should be filtered (true or false) |
deleteAfterMinutes |
yes | 1440 | Determines how many minutes after the last signal was received should the the flight in the dababase be retained before it's deleted. Set to 0 to keep entries indefinitely |
logging |
yes | syslogHost The host to send logs tosyslogFormat The syslog log formatlogLevel [optional] Log level, See here for more infoslogToConsole [optional] If true, logs are logged to syslog and to console, if false only to syslog |
|
crawlUnknownAircraft |
yes | false | If true, aircraft not found in the database will be looked up in various data sources on the web. Since this method uses crawling which might not always be allowed, beware: This could potentially lead to blocking of your IP address |
googleMapsApiKey |
no | The map view needs an API key to render the map. You can get one here. |
Flightradar needs to initialize the MongoDB database schema before first use. When building a docker image, the database is initialized upon build time.
The app will create the required collections and indexes in the specified MongoDB database, including time-series collections for efficient position data storage.
Initialize schema:
python flightradar.py initschema
Running it with the development server (Not recommended for productive use). Don't forget to initialize the db (see above) before the first run:
uvicorn flightradar:app --reload
Running it with ASGI in production (recommended setup) (binds to all interfaces on port 8083):
uvicorn flightradar:app --host 0.0.0.0 --port 8083
Or using Gunicorn with Uvicorn workers:
gunicorn flightradar:app -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8083
When running the application on Windows, consider the following:
- Use
SET
instead ofexport
when using Windows