Skip to content

Commit

Permalink
Deployment tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
Kahn committed Sep 30, 2021
1 parent 807987e commit 965e2ed
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 31 deletions.
2 changes: 1 addition & 1 deletion client.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function getOSMAerodromeData (areaName) {
cache.set(areaName, data, 86400);
}
},
{ overpassUrl: config.get('data.osm.overpassUrl') }
{ overpassUrl: config.get('data.osm.overpassUrl'), userAgent: `${config.get('app.name')}/${config.get('app.version')}` }
);

}catch(err){
Expand Down
18 changes: 9 additions & 9 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
"sectors": {
"standard": [
"BN-ARA_CTR",
"BN-DOS_CTR",
"BN-ISA_CTR",
"BN-MDE_CTR",
"BN-TBP_CTR",
"BN-KEN_CTR",
"BN-INL_CTR",
"BN-ARM_CTR",
"BN-TRT_CTR",
"ML-ASP_CTR",
"ML-BKE_CTR",
"ML-ESP_CTR",
"ML-ORE_CTR",
"ML-SNO_CTR",
"ML-ARM_CTR",
"ML-OLW_CTR",
"ML-PIY_CTR",
"ML-TBD_CTR",
"ML-TAS_CTR",
"ML-WOL_CTR"
"ML-ELW_CTR",
"ML-BIK_CTR"
]
}
},
Expand All @@ -50,7 +50,7 @@
"coloursUrl": "https://raw.githubusercontent.com/vatSys/australia-dataset/master/Colours.xml"
},
"osm": {
"overpassUrl": "https://localhost/api/interpreter",
"overpassUrl": "https://lz4.overpass-api.de/api/interpreter",
"aerodromesArea": "New South Wales"
}
}
Expand Down
56 changes: 56 additions & 0 deletions config/production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"app": {
"name": "vatsim-map",
"version": "0.0.1",
"url": "https://github.com/Kahn/vatsim-map",
"log_level": 30,
"http": {
"host": "0.0.0.0",
"port": 8080
}
},
"map": {
"firs" : [
"AGGG",
"ANAU",
"AYPM",
"BRISBANE_FIR",
"MELBOURNE_FIR",
"NFFF-A",
"NFFF-B"
],
"sectors": {
"standard": [
"BN-ARA_CTR",
"BN-ISA_CTR",
"BN-MDE_CTR",
"BN-TBP_CTR",
"BN-TRT_CTR",
"ML-ASP_CTR",
"ML-BKE_CTR",
"ML-ESP_CTR",
"ML-ORE_CTR",
"ML-SNO_CTR",
"ML-TBD_CTR",
"ML-TAS_CTR",
"ML-WOL_CTR"
]
}
},
"data": {
"vatsim": {
"dataUrl": "https://data.vatsim.net/v3/vatsim-data.json"
},
"vatsys": {
"fir_boundariesUrl": "https://raw.githubusercontent.com/vatSys/australia-dataset/master/Maps/FIR_BOUNDARIES.xml",
"volumesUrl": "https://raw.githubusercontent.com/vatSys/australia-dataset/master/Volumes.xml",
"sectorsUrl": "https://raw.githubusercontent.com/vatSys/australia-dataset/master/Sectors.xml",
"coastlineUrl": "https://raw.githubusercontent.com/vatSys/australia-dataset/master/Maps/COAST_ALL.xml",
"coloursUrl": "https://raw.githubusercontent.com/vatSys/australia-dataset/master/Colours.xml"
},
"osm": {
"overpassUrl": "https://lz4.overpass-api.de/api/interpreter",
"aerodromesArea": "New South Wales"
}
}
}
20 changes: 0 additions & 20 deletions config/test.json

This file was deleted.

26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3.9'
services:
express:
container_name: express
build:
context: .
dockerfile: Dockerfile
command: node server.js
volumes:
- .:/usr/app/
- /usr/app/node_modules
ports:
- "8080:8080"
restart: unless-stopped
environment:
- NODE_ENV=production
webserver:
image: nginx:mainline-alpine
container_name: webserver
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./nginx-conf/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- express
30 changes: 30 additions & 0 deletions nginx-conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
events {
worker_connections 1024;
}
http {
proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.html index.htm;
location / {
proxy_pass http://express:8080;
proxy_set_header Host $host;
proxy_buffering on;
proxy_cache STATIC;
proxy_cache_valid 200 1h;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
}
location /v1/ {
proxy_pass http://express:8080;
proxy_set_header Host $host;
proxy_buffering on;
proxy_cache STATIC;
proxy_cache_valid 200 15s;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"express": "^4.17.1",
"node-cache": "^5.1.2",
"node-fetch": "^2.6.1",
"query-overpass": "^1.5.5",
"query-overpass": "https://github.com/Kahn/query-overpass.git",
"rgb2hex": "^0.2.5",
"xml-js": "^1.6.11"
},
Expand Down

0 comments on commit 965e2ed

Please sign in to comment.