Skip to content

Commit

Permalink
Auto configure VirtualRadar with recivers and location
Browse files Browse the repository at this point in the history
This also downloads the route DB but does not currently get it working.

Work for: #8
  • Loading branch information
TheBiggerGuy committed May 2, 2019
1 parent 43264d9 commit b5f3944
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 10 deletions.
3 changes: 3 additions & 0 deletions variables-virtualradar.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

VIRTUALRADAR_DEFAULT_ADMIN_USER=admin
VIRTUALRADAR_DEFAULT_ADMIN_PASSWORD=admin

VIRTUALRADAR_LATITUDE=0.0
VIRTUALRADAR_LONGITUDE=0.0
197 changes: 197 additions & 0 deletions virtualradar/Configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<DataVersion>9</DataVersion>
<BaseStationSettings>
<ConnectionType>TCP</ConnectionType>
<AutoReconnectAtStartup>false</AutoReconnectAtStartup>
<Address>127.0.0.1</Address>
<Port>30003</Port>
<BaudRate>115200</BaudRate>
<DataBits>8</DataBits>
<StopBits>One</StopBits>
<Parity>None</Parity>
<Handshake>None</Handshake>
<StartupText>#43-02\r</StartupText>
<ShutdownText>#43-00\r</ShutdownText>
<DatabaseFileName>/tmp/StandingData.sqb</DatabaseFileName>
<SearchPictureSubFolders>false</SearchPictureSubFolders>
<DisplayTimeoutSeconds>30</DisplayTimeoutSeconds>
<TrackingTimeoutSeconds>600</TrackingTimeoutSeconds>
<SatcomDisplayTimeoutMinutes>60</SatcomDisplayTimeoutMinutes>
<SatcomTrackingTimeoutMinutes>120</SatcomTrackingTimeoutMinutes>
<IgnoreBadMessages>true</IgnoreBadMessages>
<MinimiseToSystemTray>false</MinimiseToSystemTray>
<AutoSavePolarPlotsMinutes>60</AutoSavePolarPlotsMinutes>
<LookupAircraftDetailsOnline>true</LookupAircraftDetailsOnline>
<DownloadGlobalAirPressureReadings>true</DownloadGlobalAirPressureReadings>
</BaseStationSettings>
<FlightRouteSettings>
<AutoUpdateEnabled>true</AutoUpdateEnabled>
</FlightRouteSettings>
<WebServerSettings>
<AuthenticationScheme>Anonymous</AuthenticationScheme>
<ConvertedUser>false</ConvertedUser>
<BasicAuthenticationUserIds />
<AdministratorUserIds>
<string>1</string>
<string>1</string>
</AdministratorUserIds>
<EnableUPnp>false</EnableUPnp>
<UPnpPort>80</UPnpPort>
<IsOnlyInternetServerOnLan>true</IsOnlyInternetServerOnLan>
<AutoStartUPnP>false</AutoStartUPnP>
</WebServerSettings>
<GoogleMapSettings>
<MapProvider>Leaflet</MapProvider>
<InitialMapLatitude>51.47</InitialMapLatitude>
<InitialMapLongitude>-0.6</InitialMapLongitude>
<InitialMapType>ROADMAP</InitialMapType>
<InitialMapZoom>11</InitialMapZoom>
<InitialRefreshSeconds>1</InitialRefreshSeconds>
<MinimumRefreshSeconds>1</MinimumRefreshSeconds>
<ShortTrailLengthSeconds>30</ShortTrailLengthSeconds>
<InitialDistanceUnit>NauticalMiles</InitialDistanceUnit>
<InitialHeightUnit>Feet</InitialHeightUnit>
<InitialSpeedUnit>Knots</InitialSpeedUnit>
<PreferIataAirportCodes>true</PreferIataAirportCodes>
<EnableBundling>true</EnableBundling>
<EnableMinifying>true</EnableMinifying>
<EnableCompression>true</EnableCompression>
<WebSiteReceiverId>3</WebSiteReceiverId>
<ClosestAircraftReceiverId>3</ClosestAircraftReceiverId>
<FlightSimulatorXReceiverId>3</FlightSimulatorXReceiverId>
<ProxyType>Unknown</ProxyType>
<EnableCorsSupport>false</EnableCorsSupport>
<UseGoogleMapsAPIKeyWithLocalRequests>false</UseGoogleMapsAPIKeyWithLocalRequests>
<TileServerSettingName>OpenStreetMap</TileServerSettingName>
</GoogleMapSettings>
<VersionCheckSettings>
<CheckAutomatically>true</CheckAutomatically>
<CheckPeriodDays>1</CheckPeriodDays>
</VersionCheckSettings>
<InternetClientSettings>
<CanRunReports>false</CanRunReports>
<CanShowPinText>false</CanShowPinText>
<CanPlayAudio>false</CanPlayAudio>
<CanShowPictures>false</CanShowPictures>
<TimeoutMinutes>20</TimeoutMinutes>
<AllowInternetProximityGadgets>false</AllowInternetProximityGadgets>
<CanSubmitRoutes>false</CanSubmitRoutes>
<CanShowPolarPlots>false</CanShowPolarPlots>
</InternetClientSettings>
<AudioSettings>
<Enabled>true</Enabled>
<VoiceRate>0</VoiceRate>
</AudioSettings>
<RawDecodingSettings>
<ReceiverLocationId>0</ReceiverLocationId>
<ReceiverRange>650</ReceiverRange>
<IgnoreMilitaryExtendedSquitter>false</IgnoreMilitaryExtendedSquitter>
<SuppressReceiverRangeCheck>true</SuppressReceiverRangeCheck>
<UseLocalDecodeForInitialPosition>false</UseLocalDecodeForInitialPosition>
<AirborneGlobalPositionLimit>10</AirborneGlobalPositionLimit>
<FastSurfaceGlobalPositionLimit>25</FastSurfaceGlobalPositionLimit>
<SlowSurfaceGlobalPositionLimit>50</SlowSurfaceGlobalPositionLimit>
<AcceptableAirborneSpeed>15</AcceptableAirborneSpeed>
<AcceptableAirSurfaceTransitionSpeed>5</AcceptableAirSurfaceTransitionSpeed>
<AcceptableSurfaceSpeed>3</AcceptableSurfaceSpeed>
<IgnoreCallsignsInBds20>false</IgnoreCallsignsInBds20>
<AcceptIcaoInPI0Count>1</AcceptIcaoInPI0Count>
<AcceptIcaoInPI0Seconds>1</AcceptIcaoInPI0Seconds>
<AcceptIcaoInNonPICount>0</AcceptIcaoInNonPICount>
<AcceptIcaoInNonPISeconds>5</AcceptIcaoInNonPISeconds>
<SuppressIcao0>true</SuppressIcao0>
<IgnoreInvalidCodeBlockInParityMessages>false</IgnoreInvalidCodeBlockInParityMessages>
<IgnoreInvalidCodeBlockInOtherMessages>true</IgnoreInvalidCodeBlockInOtherMessages>
<SuppressTisbDecoding>false</SuppressTisbDecoding>
</RawDecodingSettings>
<MonoSettings>
<UseMarkerLabels>true</UseMarkerLabels>
</MonoSettings>
<Receivers>
<Receiver>
<Enabled>true</Enabled>
<UniqueId>1</UniqueId>
<Name>dump1090</Name>
<DataSource>Beast</DataSource>
<ConnectionType>TCP</ConnectionType>
<AutoReconnectAtStartup>true</AutoReconnectAtStartup>
<IsSatcomFeed>false</IsSatcomFeed>
<IsPassive>false</IsPassive>
<Access>
<DefaultAccess>Unrestricted</DefaultAccess>
<Addresses />
</Access>
<Address>DUMP1090_SERVER</Address>
<Port>DUMP1090_PORT</Port>
<UseKeepAlive>true</UseKeepAlive>
<IdleTimeoutMilliseconds>60000</IdleTimeoutMilliseconds>
<BaudRate>115200</BaudRate>
<DataBits>8</DataBits>
<StopBits>One</StopBits>
<Parity>None</Parity>
<Handshake>None</Handshake>
<StartupText>#43-02\r</StartupText>
<ShutdownText>#43-00\r</ShutdownText>
<ReceiverLocationId>1</ReceiverLocationId>
<ReceiverUsage>Normal</ReceiverUsage>
</Receiver>
<Receiver>
<Enabled>true</Enabled>
<UniqueId>2</UniqueId>
<Name>adsbexchange-mlat</Name>
<DataSource>Beast</DataSource>
<ConnectionType>TCP</ConnectionType>
<AutoReconnectAtStartup>true</AutoReconnectAtStartup>
<IsSatcomFeed>false</IsSatcomFeed>
<IsPassive>false</IsPassive>
<Access>
<DefaultAccess>Unrestricted</DefaultAccess>
<Addresses />
</Access>
<Address>ADSBEXCHANGE_MLAT_SERVER</Address>
<Port>ADSBEXCHANGE_MLAT_PORT</Port>
<UseKeepAlive>true</UseKeepAlive>
<IdleTimeoutMilliseconds>60000</IdleTimeoutMilliseconds>
<BaudRate>115200</BaudRate>
<DataBits>8</DataBits>
<StopBits>One</StopBits>
<Parity>None</Parity>
<Handshake>None</Handshake>
<StartupText>#43-02\r</StartupText>
<ShutdownText>#43-00\r</ShutdownText>
<ReceiverLocationId>1</ReceiverLocationId>
<ReceiverUsage>Normal</ReceiverUsage>
</Receiver>
</Receivers>
<MergedFeeds>
<MergedFeed>
<Enabled>true</Enabled>
<UniqueId>3</UniqueId>
<Name>Merged Feed</Name>
<ReceiverIds>
<int>1</int>
<int>2</int>
</ReceiverIds>
<ReceiverFlags>
<MergedFeedReceiver>
<UniqueId>2</UniqueId>
<IsMlatFeed>true</IsMlatFeed>
</MergedFeedReceiver>
</ReceiverFlags>
<IcaoTimeout>3000</IcaoTimeout>
<IgnoreAircraftWithNoPosition>false</IgnoreAircraftWithNoPosition>
<ReceiverUsage>Normal</ReceiverUsage>
</MergedFeed>
</MergedFeeds>
<ReceiverLocations>
<ReceiverLocation>
<UniqueId>1</UniqueId>
<Name>Receiver Location</Name>
<Latitude>VIRTUALRADAR_LATITUDE</Latitude>
<Longitude>VIRTUALRADAR_LONGITUDE</Longitude>
<IsBaseStationLocation>false</IsBaseStationLocation>
</ReceiverLocation>
</ReceiverLocations>
<RebroadcastSettings />
</Configuration>
1 change: 1 addition & 0 deletions virtualradar/Dockerfile-virtualradar
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ FROM base
COPY --from=builder /vrs /opt/vrs

COPY InstallerConfiguration.xml /root/.local/share/VirtualRadar/InstallerConfiguration.xml
COPY Configuration.xml /root/.local/share/VirtualRadar/Configuration.xml
COPY vrs-runner.sh /usr/local/bin/vrs-runner

EXPOSE 30053
Expand Down
61 changes: 51 additions & 10 deletions virtualradar/vrs-runner.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,68 @@
#!/bin/sh
#!/bin/bash

set -o errexit # Exit on most errors (see the manual)
#set -o errtrace # Make sure any error trap is inherited
set -o errtrace # Make sure any error trap is inherited
set -o nounset # Disallow expansion of unset variables
#set -o pipefail # Use last non-zero exit code in a pipeline
set -o xtrace # Trace the execution of the script (debug)
set -o pipefail # Use last non-zero exit code in a pipeline
#set -o xtrace # Trace the execution of the script (debug)

function start_secion_spacer {
echo '=============================='
echo "======== ${1}"
echo '=============================='
}

function end_secion_spacer {
echo '=============================='
echo
}

DUMP1090_SERVER='dump1090'
DUMP1090_PORT='30005'
ADSBEXCHANGE_MLAT_SERVER='adsbexchange-mlat'
ADSBEXCHANGE_MLAT_PORT='30104'

start_secion_spacer "Running with"
echo " - DUMP1090_SERVER=${DUMP1090_SERVER}"
echo " - DUMP1090_PORT=${DUMP1090_PORT}"
echo " - ADSBEXCHANGE_MLAT_SERVER=${ADSBEXCHANGE_MLAT_SERVER}"
echo " - ADSBEXCHANGE_MLAT_PORT=${ADSBEXCHANGE_MLAT_PORT}"
echo " - VIRTUALRADAR_LATITUDE =${VIRTUALRADAR_LATITUDE}"
echo " - VIRTUALRADAR_LONGITUDE=${VIRTUALRADAR_LONGITUDE}"
end_secion_spacer

echo "Waiting for dump1090 to start up"

start_secion_spacer "Waiting for ${DUMP1090_SERVER} to start up"
sleep 5s
end_secion_spacer

echo "Ping test to dump1090"
start_secion_spacer "Ping test to ${DUMP1090_SERVER}"
ping -c 3 "${DUMP1090_SERVER}"
end_secion_spacer

start_secion_spacer "Downloading route DB"
curl --output '/tmp/StandingData.sqb.gz' 'http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz'
zcat '/tmp/StandingData.sqb.gz' > '/tmp/StandingData.sqb'
rm '/tmp/StandingData.sqb.gz'
end_secion_spacer

start_secion_spacer 'customising config'
sed -i "s/DUMP1090_SERVER/${DUMP1090_SERVER}/" /root/.local/share/VirtualRadar/Configuration.xml
sed -i "s/DUMP1090_PORT/${DUMP1090_PORT}/" /root/.local/share/VirtualRadar/Configuration.xml
sed -i "s/ADSBEXCHANGE_MLAT_SERVER/${ADSBEXCHANGE_MLAT_SERVER}/" /root/.local/share/VirtualRadar/Configuration.xml
sed -i "s/ADSBEXCHANGE_MLAT_PORT/${ADSBEXCHANGE_MLAT_PORT}/" /root/.local/share/VirtualRadar/Configuration.xml
sed -i "s/VIRTUALRADAR_LATITUDE/${VIRTUALRADAR_LATITUDE}/" /root/.local/share/VirtualRadar/Configuration.xml
sed -i "s/VIRTUALRADAR_LONGITUDE/${VIRTUALRADAR_LONGITUDE}/" /root/.local/share/VirtualRadar/Configuration.xml
end_secion_spacer


export MONO_PATH="/opt/vrs:${MONO_PATH:=}"

# https://www.mono-project.com/docs/advanced/runtime/logging-runtime-events/
export MONO_LOG_LEVEL='info'
export MONO_LOG_MASK='dll,cfg'
#export MONO_LOG_LEVEL='info'
#export MONO_LOG_MASK='dll,cfg'

mono /opt/vrs/VirtualRadar.exe -nogui -"createAdmin:${VIRTUALRADAR_DEFAULT_ADMIN_USER}" -"password:${VIRTUALRADAR_DEFAULT_ADMIN_PASSWORD}"
start_secion_spacer 'Starting VirtualRadar'
mono /opt/vrs/VirtualRadar.exe -nogui -"createAdmin:${VIRTUALRADAR_DEFAULT_ADMIN_USER}" -"password:${VIRTUALRADAR_DEFAULT_ADMIN_PASSWORD}" || true
mono /opt/vrs/VirtualRadar.exe -nogui

end_secion_spacer

0 comments on commit b5f3944

Please sign in to comment.