Skip to content

Commit 20e0048

Browse files
committed
deployment tweaks
Signed-off-by: Clemens Vasters <[email protected]>
1 parent d0e6d8c commit 20e0048

File tree

6 files changed

+575
-129
lines changed

6 files changed

+575
-129
lines changed

mode-s/Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
FROM python:3.11-slim
33

44
LABEL org.opencontainers.image.source = "https://github.com/clemensv/real-time-sources/tree/main/mode_s"
5-
LABEL org.opencontainers.image.title = "USGS Instantaneous Values Service bridge to Kafka endpoints"
6-
LABEL org.opencontainers.image.description = "This container is a bridge between USGS feeds and Kafka endpoints. It fetches entries from feeds and forwards them to the configured Kafka endpoints."
5+
LABEL org.opencontainers.image.title = "Mode-S Data Poller"
6+
LABEL org.opencontainers.image.description = "This container polls ADS-B data from dump1090 and sends it to Kafka endpoints."
77
LABEL org.opencontainers.image.documentation = "https://github.com/clemensv/real-time-sources/blob/main/mode_s/CONTAINER.md"
88
LABEL org.opencontainers.image.license = "MIT"
99

@@ -17,8 +17,18 @@ COPY . /app
1717
RUN pip install .
1818

1919
# Define environment variables (default values)
20+
ENV DUMP1090_HOST="localhost"
21+
ENV DUMP1090_PORT="30005"
22+
ENV REF_LAT="0"
23+
ENV REF_LON="0"
24+
ENV STATIONID="station1"
25+
ENV KAFKA_BOOTSTRAP_SERVERS=""
26+
ENV KAFKA_TOPIC=""
27+
ENV SASL_USERNAME=""
28+
ENV SASL_PASSWORD=""
2029
ENV CONNECTION_STRING=""
30+
ENV POLLING_INTERVAL="60"
2131
ENV LOG_LEVEL="INFO"
2232

2333
# Run the application
24-
CMD ["python", "-m", "mode_s", "feed"]
34+
CMD ["mode_s_kafka_bridge", "feed"]

mode-s/azure-template.json

Lines changed: 202 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,258 @@
11
{
2-
"parameters": {
3-
"logAnalyticsWorkspaceId": {
4-
"metadata": {
5-
"description": "The Id of the Log Analytics workspace. In the portal, you find this under Settings -> Agents -> Windows/Linux Servers -> Agent Instructions."
6-
},
7-
"type": "string"
8-
},
9-
"imageName": {
10-
"defaultValue": "ghcr.io/clemensv/real-time-sources-mode-s:latest",
11-
"metadata": {
12-
"description": "The name of the container image."
13-
},
14-
"type": "string"
15-
},
16-
"logAnalyticsWorkspaceKey": {
17-
"metadata": {
18-
"description": "The primary or secondary key of the Log Analytics workspace. In the portal, you find this under Settings -> Agents -> Windows/Linux Servers -> Agent Instructions."
19-
},
20-
"type": "securestring"
21-
},
22-
"connectionStringSecret": {
23-
"metadata": {
24-
"description": "The Microsoft Fabric Event Stream custom input endpoint or Azure Event Hubs connection string."
25-
},
26-
"type": "securestring"
27-
},
28-
"feedUrls": {
29-
"defaultValue": "",
30-
"metadata": {
31-
"description": "Comma-separated list of feed URLs (RSS or OPML)"
32-
},
33-
"type": "string"
34-
},
35-
"appName": {
36-
"defaultValue": "[if(empty(resourceGroup().name), 'mode-s', resourceGroup().name)]",
37-
"maxLength": 64,
38-
"metadata": {
39-
"description": "The name of the container instance."
40-
},
41-
"type": "string"
42-
}
43-
},
442
"variables": {
45-
"fileShareName": "fileshare",
46-
"storageAccountName": "[concat(replace(parameters('appName'), '-', ''), 'stg')]"
3+
"storageAccountName": "[concat(replace(parameters('appName'), '-', ''), 'stg')]",
4+
"fileShareName": "fileshare"
475
},
48-
"contentVersion": "1.0.0.0",
496
"resources": [
507
{
8+
"sku": {
9+
"name": "Standard_LRS"
10+
},
5111
"location": "[resourceGroup().location]",
52-
"type": "Microsoft.Storage/storageAccounts",
12+
"name": "[variables('storageAccountName')]",
13+
"kind": "StorageV2",
5314
"properties": {
5415
"accessTier": "Hot"
5516
},
56-
"kind": "StorageV2",
5717
"apiVersion": "2021-04-01",
58-
"name": "[variables('storageAccountName')]",
59-
"sku": {
60-
"name": "Standard_LRS"
61-
}
18+
"type": "Microsoft.Storage/storageAccounts"
6219
},
6320
{
6421
"location": "[resourceGroup().location]",
65-
"type": "Microsoft.Storage/storageAccounts/fileServices",
22+
"name": "[concat(variables('storageAccountName'), '/default/')]",
6623
"properties": {
6724
"protocolSettings": {
6825
"smb": {
6926
"enabled": true
7027
}
7128
}
7229
},
30+
"apiVersion": "2021-04-01",
7331
"dependsOn": [
7432
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
7533
],
76-
"apiVersion": "2021-04-01",
77-
"name": "[concat(variables('storageAccountName'), '/default/')]"
34+
"type": "Microsoft.Storage/storageAccounts/fileServices"
7835
},
7936
{
8037
"location": "[resourceGroup().location]",
81-
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
38+
"name": "[concat(variables('storageAccountName'), '/default/', variables('fileShareName'))]",
8239
"properties": {
8340
"shareQuota": 5120
8441
},
42+
"apiVersion": "2021-04-01",
8543
"dependsOn": [
8644
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]"
8745
],
88-
"apiVersion": "2021-04-01",
89-
"name": "[concat(variables('storageAccountName'), '/default/', variables('fileShareName'))]"
46+
"type": "Microsoft.Storage/storageAccounts/fileServices/shares"
9047
},
9148
{
92-
"name": "[parameters('appName')]",
49+
"apiVersion": "2021-09-01",
9350
"location": "[resourceGroup().location]",
9451
"properties": {
52+
"volumes": [
53+
{
54+
"azureFile": {
55+
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2019-06-01').keys[0].value]",
56+
"shareName": "[variables('fileShareName')]",
57+
"storageAccountName": "[variables('storageAccountName')]"
58+
},
59+
"name": "azurefilevolume"
60+
}
61+
],
62+
"restartPolicy": "Always",
63+
"osType": "Linux",
64+
"diagnostics": {
65+
"logAnalytics": {
66+
"workspaceId": "[parameters('logAnalyticsWorkspaceId')]",
67+
"workspaceKey": "[parameters('logAnalyticsWorkspaceKey')]"
68+
}
69+
},
9570
"containers": [
9671
{
97-
"name": "[parameters('appName')]",
9872
"properties": {
99-
"image": "[parameters('imageName')]",
73+
"resources": {
74+
"requests": {
75+
"memoryInGB": 1,
76+
"cpu": 0.5
77+
}
78+
},
10079
"volumeMounts": [
10180
{
102-
"name": "azurefilevolume",
103-
"mountPath": "/mnt/fileshare"
81+
"mountPath": "/mnt/fileshare",
82+
"name": "azurefilevolume"
10483
}
10584
],
85+
"image": "[parameters('imageName')]",
10686
"environmentVariables": [
10787
{
108-
"name": "CONNECTION_STRING",
109-
"secureValue": "[parameters('connectionStringSecret')]"
88+
"value": "[parameters('dump1090Host')]",
89+
"name": "DUMP1090_HOST"
11090
},
11191
{
112-
"name": "LOG_LEVEL",
113-
"value": "INFO"
92+
"value": "[parameters('dump1090Port')]",
93+
"name": "DUMP1090_PORT"
11494
},
11595
{
116-
"name": "USGS_LAST_POLLED_FILE",
117-
"value": "/mnt/fileshare/usgs_last_polled.json"
118-
}
119-
],
120-
"resources": {
121-
"requests": {
122-
"memoryInGB": 1,
123-
"cpu": 0.5
96+
"value": "[parameters('refLat')]",
97+
"name": "REF_LAT"
98+
},
99+
{
100+
"value": "[parameters('refLon')]",
101+
"name": "REF_LON"
102+
},
103+
{
104+
"value": "[parameters('stationId')]",
105+
"name": "STATIONID"
106+
},
107+
{
108+
"secureValue": "[parameters('connectionStringSecret')]",
109+
"name": "CONNECTION_STRING"
110+
},
111+
{
112+
"value": "[parameters('kafkaBootstrapServers')]",
113+
"name": "KAFKA_BOOTSTRAP_SERVERS"
114+
},
115+
{
116+
"value": "[parameters('kafkaTopic')]",
117+
"name": "KAFKA_TOPIC"
118+
},
119+
{
120+
"value": "[parameters('saslUsername')]",
121+
"name": "SASL_USERNAME"
122+
},
123+
{
124+
"secureValue": "[parameters('saslPassword')]",
125+
"name": "SASL_PASSWORD"
126+
},
127+
{
128+
"value": "[parameters('pollingInterval')]",
129+
"name": "POLLING_INTERVAL"
130+
},
131+
{
132+
"value": "[parameters('logLevel')]",
133+
"name": "LOG_LEVEL"
124134
}
125-
}
126-
}
127-
}
128-
],
129-
"restartPolicy": "Always",
130-
"diagnostics": {
131-
"logAnalytics": {
132-
"workspaceKey": "[parameters('logAnalyticsWorkspaceKey')]",
133-
"workspaceId": "[parameters('logAnalyticsWorkspaceId')]"
135+
]
136+
},
137+
"name": "[parameters('appName')]"
134138
}
135-
},
136-
"volumes": [
137-
{
138-
"name": "azurefilevolume",
139-
"azureFile": {
140-
"shareName": "[variables('fileShareName')]",
141-
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2019-06-01').keys[0].value]",
142-
"storageAccountName": "[variables('storageAccountName')]"
143-
}
144-
}
145-
],
146-
"osType": "Linux"
139+
]
147140
},
148141
"type": "Microsoft.ContainerInstance/containerGroups",
149-
"apiVersion": "2021-09-01"
142+
"name": "[parameters('appName')]"
150143
}
151144
],
152-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"
145+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
146+
"contentVersion": "1.0.0.0",
147+
"parameters": {
148+
"dump1090Port": {
149+
"metadata": {
150+
"description": "TCP port dump1090 listens on."
151+
},
152+
"type": "string",
153+
"defaultValue": "30005"
154+
},
155+
"stationId": {
156+
"metadata": {
157+
"description": "Station ID for event source attribution."
158+
},
159+
"type": "string",
160+
"defaultValue": "station1"
161+
},
162+
"dump1090Host": {
163+
"metadata": {
164+
"description": "Hostname or IP address of dump1090."
165+
},
166+
"type": "string",
167+
"defaultValue": "localhost"
168+
},
169+
"logAnalyticsWorkspaceId": {
170+
"metadata": {
171+
"description": "The Id of the Log Analytics workspace. In the portal, you find this under Settings -> Agents -> Windows/Linux Servers -> Agent Instructions."
172+
},
173+
"type": "string"
174+
},
175+
"saslPassword": {
176+
"metadata": {
177+
"description": "Password for SASL authentication."
178+
},
179+
"type": "securestring"
180+
},
181+
"connectionStringSecret": {
182+
"metadata": {
183+
"description": "The Microsoft Fabric Event Stream custom input endpoint or Azure Event Hubs connection string."
184+
},
185+
"type": "securestring"
186+
},
187+
"imageName": {
188+
"metadata": {
189+
"description": "The name of the container image."
190+
},
191+
"type": "string",
192+
"defaultValue": "ghcr.io/clemensv/real-time-sources-mode-s:latest"
193+
},
194+
"refLat": {
195+
"metadata": {
196+
"description": "Latitude of the receiving antenna."
197+
},
198+
"type": "string",
199+
"defaultValue": "0"
200+
},
201+
"refLon": {
202+
"metadata": {
203+
"description": "Longitude of the receiving antenna."
204+
},
205+
"type": "string",
206+
"defaultValue": "0"
207+
},
208+
"saslUsername": {
209+
"metadata": {
210+
"description": "Username for SASL authentication."
211+
},
212+
"type": "string",
213+
"defaultValue": ""
214+
},
215+
"logLevel": {
216+
"metadata": {
217+
"description": "Logging level."
218+
},
219+
"type": "string",
220+
"defaultValue": "INFO"
221+
},
222+
"logAnalyticsWorkspaceKey": {
223+
"metadata": {
224+
"description": "The primary or secondary key of the Log Analytics workspace. In the portal, you find this under Settings -> Agents -> Windows/Linux Servers -> Agent Instructions."
225+
},
226+
"type": "securestring"
227+
},
228+
"appName": {
229+
"metadata": {
230+
"description": "The name of the container instance."
231+
},
232+
"maxLength": 64,
233+
"type": "string",
234+
"defaultValue": "[if(empty(resourceGroup().name), 'mode-s', resourceGroup().name)]"
235+
},
236+
"pollingInterval": {
237+
"metadata": {
238+
"description": "Polling interval in seconds."
239+
},
240+
"type": "string",
241+
"defaultValue": "60"
242+
},
243+
"kafkaTopic": {
244+
"metadata": {
245+
"description": "Kafka topic to publish messages."
246+
},
247+
"type": "string",
248+
"defaultValue": ""
249+
},
250+
"kafkaBootstrapServers": {
251+
"metadata": {
252+
"description": "Kafka bootstrap servers."
253+
},
254+
"type": "string",
255+
"defaultValue": ""
256+
}
257+
}
153258
}

0 commit comments

Comments
 (0)