Open Infrastructure Map, a view of infrastructure data in OpenStreetMap
Web router container
Russ Garretta0257ad2f9b9
diff --git a/.github/workflows/web-router.yml b/.github/workflows/web-router.ymlnew file mode 100644index 0000000..9d2fb9d--- /dev/null+++ b/.github/workflows/web-router.yml@@ -0,0 +1,33 @@+name: Build web router container++on:+ push:+ branches:+ - main+ paths:+ - 'web-router/**'+ - '.github/workflows/web-router.yml'++jobs:+ login:+ env:+ IMAGE: ghcr.io/openinframap/openinframap-web-router+ runs-on: ubuntu-latest+ steps:+ - name: Checkout+ uses: actions/checkout@v4+ - name: Login to GitHub Container Registry+ uses: docker/login-action@v3+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}+ - name: Build and push+ id: docker_build+ uses: docker/build-push-action@v6+ with:+ context: ./web-router+ file: ./web-router/Dockerfile+ push: true+ tags: |+ ${{ env.IMAGE }}:${{ github.sha }}-${{ github.run_number }}diff --git a/web-router/Dockerfile b/web-router/Dockerfilenew file mode 100644index 0000000..4604016--- /dev/null+++ b/web-router/Dockerfile@@ -0,0 +1,3 @@+FROM nginx:1.26-alpine++COPY ./nginx.conf /etc/nginx/nginx.conf\ No newline at end of filediff --git a/web-router/README.md b/web-router/README.mdnew file mode 100644index 0000000..40c2cf8--- /dev/null+++ b/web-router/README.md@@ -0,0 +1,3 @@+# OpenInfraMap Web Router Container++This is used in production to route endpoints to the backend, frontend, or tileserver.\ No newline at end of filediff --git a/web-router/nginx.conf b/web-router/nginx.confnew file mode 100644index 0000000..a973b36--- /dev/null+++ b/web-router/nginx.conf@@ -0,0 +1,98 @@+worker_processes 2;++events {+ worker_connections 1024;+}++http {+ include mime.types;+ default_type application/octet-stream;+ sendfile on;++ keepalive_timeout 65;++ gzip on;+ gzip_proxied any;+ gzip_types application/vnd.mapbox-vector-tile application/x-protobuf application/json application/javascript;++ server {+ listen 80;+ server_name openinframap.org;++ proxy_set_header Host $http_host;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;+ proxy_set_header X-Forwarded-Proto https;++ location /tiles {+ if ($uri ~ "/tiles/[0-3]/") {+ expires 48h;+ }+ if ($uri ~ "/tiles/[4-6]/") {+ expires 4h;+ }+ if ($uri ~ "/tiles/[7-9]/") {+ expires 1h;+ }+ if ($uri ~ "/tiles/(10|11|12|13|14|15|16)/") {+ expires 10m;+ }+ proxy_pass http://oim-tileserver/maps/openinframap;+ }++ location ~ ^/map/([a-z_]+)/([0-6])/([0-9]+)/([0-9]+).pbf$ {+ expires 4h;+ proxy_pass http://oim-tileserver/maps/$1/$2/$3/$4.pbf;+ }++ location ~ ^/map/([a-z_]+)/([7-9])/([0-9]+)/([0-9]+).pbf$ {+ expires 1h;+ proxy_pass http://oim-tileserver/maps/$1/$2/$3/$4.pbf;+ }++ location ~ ^/map/([a-z_]+)/([0-9]+)/([0-9]+)/([0-9]+).pbf$ {+ expires 5m;+ proxy_pass http://oim-tileserver/maps/$1/$2/$3/$4.pbf;+ }++ location /heatmap.json {+ proxy_pass http://oim-web-backend;+ }++ location /heatmap {+ expires 12h;+ proxy_pass http://oim-tileserver/maps/solar_heatmap;+ }++ location /wikidata {+ proxy_pass http://oim-web-backend;+ }++ location /stats {+ proxy_pass http://oim-web-backend;+ }++ location /static {+ proxy_pass http://oim-web-backend;+ }++ location /copyright {+ proxy_pass http://oim-web-backend;+ }++ location /about.html {+ return 301 https://openinframap.org/about;+ }++ location /about {+ proxy_pass http://oim-web-backend;+ }++ location /sitemap.xml {+ proxy_pass http://oim-web-backend;+ }++ location / {+ proxy_pass http://oim-web;+ }+ }+}\ No newline at end of file