Skip to content

Commit

Permalink
Merge branch 'master' into DT-4675
Browse files Browse the repository at this point in the history
  • Loading branch information
optionsome committed Sep 14, 2021
2 parents c3aab18 + 3b759bd commit b3b48cc
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 206 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx:1.18-alpine
FROM nginx:1.20-alpine
MAINTAINER Reittiopas version: 0.1
ENV INSTALL_DIR="/opt/nginx"

Expand Down
53 changes: 10 additions & 43 deletions common.conf
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,6 @@ location /map/v1/next- {
# add_header X-Cache-Status $upstream_cache_status;
}

location /map/v1/linjasto2021- {
rewrite /map/v1/linjasto2021-(.*) /map/v1/$1 break;
proxy_pass http://hsl-map-server-linjasto2021:8080;
# proxy_cache tiles;
# proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
# proxy_cache_revalidate on;
# proxy_cache_lock on;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
# add_header X-Cache-Status $upstream_cache_status;
}

location /map/v1/ {
proxy_pass http://hsl-map-server:8080;
proxy_cache tiles;
Expand Down Expand Up @@ -251,16 +237,6 @@ location /routing/v1/routers/next-waltti {
proxy_read_timeout 11500ms;
}

location /routing/v1/routers/linjasto2021-waltti {
rewrite /routing/v1/routers/linjasto2021-waltti(.*) /otp/routers/default$1 break;
proxy_pass http://opentripplanner-linjasto2021-waltti:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
proxy_read_timeout 11500ms;
}

location /routing-data/v2/hsl {
rewrite /routing-data/v2/hsl/(.*) /$1 break;
proxy_pass http://opentripplanner-data-con-hsl:8080/;
Expand Down Expand Up @@ -311,16 +287,6 @@ location /routing-data/v2/next-waltti {
include cors.conf;
}

location /routing-data/v2/linjasto2021-waltti {
rewrite /routing-data/v2/linjasto2021-waltti/(.*) /$1 break;
proxy_pass http://opentripplanner-data-con-linjasto2021-waltti:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
include cors.conf;
}

location /routing-data/v2/next-finland {
rewrite /routing-data/v2/next-finland/(.*) /$1 break;
proxy_pass http://opentripplanner-data-con-finland:8080/;
Expand Down Expand Up @@ -376,15 +342,6 @@ location /ui/v1/waltti-next/ {
# proxy_set_header X-Forwarded-Host $host;
}

location /ui/v1/linjasto2021/ {
rewrite /ui/v1/linjasto2021/(.*) /$1 break;
proxy_pass http://digitransit-ui-linjasto2021:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
}

location /timetables/v1/hsl/ {
rewrite /timetables/v1/hsl/(.*) /hsl/$1 break;
proxy_pass http://hsl-timetable-container:8080;
Expand All @@ -404,3 +361,13 @@ location /fonts/ {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
}

location /matka-fonts/ {
rewrite /matka-fonts/(.*) /$1 break;
proxy_pass https://matkafonts.blob.core.windows.net;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Host $host;
include cors.conf;
}
117 changes: 33 additions & 84 deletions external.conf
Original file line number Diff line number Diff line change
Expand Up @@ -173,90 +173,6 @@ location /out/en-admin.sharingos.com/ {
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
}

#Matkahuolto kainuu gtfs (https://minfoapi.matkahuolto.fi/gtfs/kainuu-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/kainuu-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/kainuu-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_KAINUU_BASIC_AUTH;
}

#Matkahuolto savo gtfs (https://minfoapi.matkahuolto.fi/gtfs/savo-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/savo-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/savo-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_SAVO_BASIC_AUTH;
}

#Matkahuolto kanta gtfs (https://minfoapi.matkahuolto.fi/gtfs/kanta-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/kanta-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/kanta-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_KANTA_BASIC_AUTH;
}

#Matkahuolto karjala gtfs (https://minfoapi.matkahuolto.fi/gtfs/karjala-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/karjala-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/karjala-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_KARJALA_BASIC_AUTH;
}

#Matkahuolto keski gtfs (https://minfoapi.matkahuolto.fi/gtfs/keski-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/keski-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/keski-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_KESKI_BASIC_AUTH;
}

#Matkahuolto kyme gtfs (https://minfoapi.matkahuolto.fi/gtfs/kyme-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/kyme-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/kyme-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_KYME_BASIC_AUTH;
}

#Matkahuolto lappi gtfs (https://minfoapi.matkahuolto.fi/gtfs/lappi-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/lappi-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/lappi-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_LAPPI_BASIC_AUTH;
}

#Matkahuolto pohjanmaa gtfs (https://minfoapi.matkahuolto.fi/gtfs/pohjanmaa-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/pohjanmaa-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/pohjanmaa-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_POHJANMAA_BASIC_AUTH;
}

#Matkahuolto satakunta gtfs (https://minfoapi.matkahuolto.fi/gtfs/satakunta-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/satakunta-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/satakunta-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_SATAKUNTA_BASIC_AUTH;
}

#Matkahuolto vakka gtfs (https://minfoapi.matkahuolto.fi/gtfs/vakka-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/vakka-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/vakka-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_VAKKA_BASIC_AUTH;
}

#Matkahuolto vantaa gtfs (https://minfoapi.matkahuolto.fi/gtfs/vantaa-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/vantaa-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/vantaa-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_VANTAA_BASIC_AUTH;
}

#Matkahuolto varsinais gtfs (https://minfoapi.matkahuolto.fi/gtfs/varsinais-fi/gtfs.zip )
location /out/minfoapi.matkahuolto.fi/gtfs/varsinais-fi/ {
proxy_pass https://minfoapi.matkahuolto.fi/gtfs/varsinais-fi/;
include allowed-ips.conf;
proxy_set_header Authorization MATKAHUOLTO_VARSINAIS_BASIC_AUTH;
}

#Oulu bike stations (https://poland.nextbike.net/maps/nextbike-official.json?domains=fo)
location /out/poland.nextbike.net/ {
proxy_pass https://poland.nextbike.net/;
Expand Down Expand Up @@ -331,3 +247,36 @@ location /out/lifti.mattersoft.fi/ {
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_set_header Authorization VAASA_BASIC_AUTH;
}

#salo gtfs rt (https://paikku.mattersoft.fi/api/gtfsrealtime/v1.0/feed/tripupdate, servicealert and vehicleposition)
location /out/paikku.mattersoft.fi/ {
proxy_pass https://paikku.mattersoft.fi/;
include allowed-ips.conf;
proxy_cache ext_cache;
proxy_cache_valid 200 30s;
proxy_cache_lock on;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_set_header Authorization SALO_BASIC_AUTH;
}

#kouvola gtfs rt (https://koutsi.mattersoft.fi/api/gtfsrealtime/v1.0/feed/tripupdate, servicealert and vehicleposition)
location /out/koutsi.mattersoft.fi/ {
proxy_pass https://koutsi.mattersoft.fi/;
include allowed-ips.conf;
proxy_cache ext_cache;
proxy_cache_valid 200 30s;
proxy_cache_lock on;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_set_header Authorization KOUVOLA_BASIC_AUTH;
}

#perille gtfs
location /out/gtfs.perille.fi/ {
proxy_pass https://gtfs.perille.fi/;
include allowed-ips.conf;
proxy_set_header Authorization PERILLE_BASIC_AUTH;
}
78 changes: 27 additions & 51 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ http {
# hide server version from response
server_tokens off;

# to get rid of a warning about server_names_hash building
server_names_hash_bucket_size 128;

# API endpoints
# These domains handle only api calls, not UI
# a-,b-,c- prefixes are ment to be used with map raster image multidomain support
Expand Down Expand Up @@ -149,6 +152,12 @@ http {
# Add HTTP Strict Transport Security for good measure.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";

error_page 500 502 503 504 /502.html;
location = /502.html {
proxy_pass https://errorpages.blob.core.windows.net/html/digitransit-error-page.html;
internal;
}

location = /sw.js {
proxy_pass http://digitransit-ui-default:8080;
proxy_redirect off;
Expand Down Expand Up @@ -177,19 +186,11 @@ http {
server_name beta.matka.fi;
listen 8080;

return 301 https://www.liikennevirasto.fi/uutinen/-/asset_publisher/SHHdKcU2jahL/content/matka-fi-osoite-muuttuu;
return 301 https://dev.digitransit.fi;
}

server {
server_name dev-hameenlinna.digitransit.fi hameenlinna.digitransit.fi reittiopas.hameenlinna.fi
dev-joensuu.digitransit.fi joensuu.digitransit.fi
dev-kotka.digitransit.fi kotka.digitransit.fi
dev-lahti.digitransit.fi lahti.digitransit.fi
dev-lappeenranta.digitransit.fi lappeenranta.digitransit.fi
dev-oulu.digitransit.fi oulu.digitransit.fi
dev-kouvola.digitransit.fi kouvola.digitransit.fi
dev-rovaniemi.digitransit.fi rovaniemi.digitransit.fi
dev-opas.waltti.fi opas.waltti.fi;
server_name dev-rovaniemi.digitransit.fi rovaniemi.digitransit.fi;
listen 8080;

if ($http_x_forwarded_proto != "https") {
Expand Down Expand Up @@ -227,52 +228,27 @@ http {
server_name dev-linjasto2021.digitransit.fi linjasto2021.digitransit.fi;
listen 8080;

if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}

# Add HTTP Strict Transport Security for good measure.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";

location = /sw.js {
proxy_pass http://digitransit-ui-linjasto2021:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_cache sw;
proxy_cache_valid 200 30s;
proxy_cache_lock on;
proxy_cache_key "$host$request_uri";
add_header X-Proxy-Cache $upstream_cache_status;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
}

location / {
proxy_pass http://digitransit-ui-linjasto2021:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
return 301 https://reittiopas.tampere.fi;
}
}

server {
server_name next-dev-hameenlinna.digitransit.fi
next-dev-joensuu.digitransit.fi
server_name next-dev-hameenlinna.digitransit.fi dev-hameenlinna.digitransit.fi hameenlinna.digitransit.fi reittiopas.hameenlinna.fi
next-dev-joensuu.digitransit.fi dev-joensuu.digitransit.fi joensuu.digitransit.fi
next-dev-jyvaskyla.digitransit.fi dev-jyvaskyla.digitransit.fi jyvaskyla.digitransit.fi
next-dev-kotka.digitransit.fi
next-dev-kotka.digitransit.fi dev-kotka.digitransit.fi kotka.digitransit.fi
next-dev-kuopio.digitransit.fi dev-kuopio.digitransit.fi kuopio.digitransit.fi
next-dev-lahti.digitransit.fi
next-dev-lappeenranta.digitransit.fi
next-dev-lahti.digitransit.fi dev-lahti.digitransit.fi lahti.digitransit.fi
next-dev-lappeenranta.digitransit.fi dev-lappeenranta.digitransit.fi lappeenranta.digitransit.fi
next-dev-mikkeli.digitransit.fi dev-mikkeli.digitransit.fi mikkeli.digitransit.fi
next-dev-oulu.digitransit.fi
next-dev-oulu.digitransit.fi dev-oulu.digitransit.fi oulu.digitransit.fi
next-dev-turku.digitransit.fi dev-turku.digitransit.fi turku.digitransit.fi reittiopas.foli.fi
next-dev-tampere.digitransit.fi dev-tampere.digitransit.fi tampere.digitransit.fi repa.tampere.fi reittiopas.tampere.fi
next-dev-kouvola.digitransit.fi
next-dev-kouvola.digitransit.fi dev-kouvola.digitransit.fi kouvola.digitransit.fi
next-dev-rovaniemi.digitransit.fi
next-dev-opas.waltti.fi;
next-dev-opas.waltti.fi dev-opas.waltti.fi opas.waltti.fi
next-dev-vaasa.digitransit.fi dev-vaasa.digitransit.fi vaasa.digitransit.fi;
listen 8080;

if ($http_x_forwarded_proto != "https") {
Expand All @@ -282,6 +258,12 @@ http {
# Add HTTP Strict Transport Security for good measure.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";

error_page 500 502 503 504 /502.html;
location = /502.html {
proxy_pass https://errorpages.blob.core.windows.net/html/digitransit-error-page.html;
internal;
}

location = /sw.js {
proxy_pass http://digitransit-ui-waltti-next:8080;
proxy_redirect off;
Expand Down Expand Up @@ -391,12 +373,6 @@ http {
# Add HTTP Strict Transport Security for good measure.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;";

error_page 500 502 503 504 /502.html;
location = /502.html {
proxy_pass https://errorpages.blob.core.windows.net/html/error_page.html;
internal;
}

location / {
proxy_pass http://digitransit-site:8080;
proxy_redirect off;
Expand Down
15 changes: 3 additions & 12 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,14 @@ sed -i "s/LINKKI_BASIC_AUTH/${LINKKI_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/NEW_LISSU_BASIC_AUTH/${NEW_LISSU_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/transitdatadev/${HSL_RT_STORAGE_NAME}/" /etc/nginx/common.conf
sed -i "s/LAHTI_BASIC_AUTH/${LAHTI_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_KAINUU_BASIC_AUTH/${MATKAHUOLTO_KAINUU_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_SAVO_BASIC_AUTH/${MATKAHUOLTO_SAVO_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_KANTA_BASIC_AUTH/${MATKAHUOLTO_KANTA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_KARJALA_BASIC_AUTH/${MATKAHUOLTO_KARJALA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_KESKI_BASIC_AUTH/${MATKAHUOLTO_KESKI_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_KYME_BASIC_AUTH/${MATKAHUOLTO_KYME_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_LAPPI_BASIC_AUTH/${MATKAHUOLTO_LAPPI_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_POHJANMAA_BASIC_AUTH/${MATKAHUOLTO_POHJANMAA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_SATAKUNTA_BASIC_AUTH/${MATKAHUOLTO_SATAKUNTA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_VAKKA_BASIC_AUTH/${MATKAHUOLTO_VAKKA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_VANTAA_BASIC_AUTH/${MATKAHUOLTO_VANTAA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MATKAHUOLTO_VARSINAIS_BASIC_AUTH/${MATKAHUOLTO_VARSINAIS_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/HAMEENLINNA_BASIC_AUTH/${HAMEENLINNA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/dev.hslfi.hsldev.com/${NEW_HSL_FI_URL}/" /etc/nginx/nginx.conf
sed -i "s/LMJ_BASIC_AUTH/${LMJ_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/MIKKELI_BASIC_AUTH/${MIKKELI_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/VAASA_BASIC_AUTH/${VAASA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/SALO_BASIC_AUTH/${SALO_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/KOUVOLA_BASIC_AUTH/${KOUVOLA_BASIC_AUTH}/" /etc/nginx/external.conf
sed -i "s/PERILLE_BASIC_AUTH/${PERILLE_BASIC_AUTH}/" /etc/nginx/external.conf

#start nginx
nginx
Loading

0 comments on commit b3b48cc

Please sign in to comment.