Skip to content

Commit

Permalink
Add health check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
optionsome committed Sep 26, 2024
1 parent 63fa1d3 commit 6fb69f5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions common.conf
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ location = /routing/v2/finland/gtfs/v1 {
proxy_read_timeout 29500ms;
}

location = /routing/v2/finland/health {
rewrite /routing/v2/finland/(.*) /otp/actuators/$1 break;
proxy_pass http://opentripplanner-finland-v2:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location = /routing/v2/routers/waltti/index/graphql {
rewrite /routing/v2/(.*) /otp/$1 break;
proxy_pass http://opentripplanner-waltti-v2:8080/;
Expand All @@ -274,6 +282,14 @@ location = /routing/v2/waltti/gtfs/v1 {
proxy_read_timeout 11500ms;
}

location = /routing/v2/waltti/health {
rewrite /routing/v2/waltti/(.*) /otp/actuators/$1 break;
proxy_pass http://opentripplanner-waltti-v2:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location = /routing/v2/routers/waltti-alt/index/graphql {
rewrite /routing/v2/(.*) /otp/$1 break;
proxy_pass http://opentripplanner-waltti-alt-v2:8080/;
Expand All @@ -293,6 +309,14 @@ location = /routing/v2/waltti-alt/gtfs/v1 {
proxy_read_timeout 11500ms;
}

location = /routing/v2/waltti-alt/health {
rewrite /routing/v2/waltti-alt/(.*) /otp/actuators/$1 break;
proxy_pass http://opentripplanner-waltti-alt-v2:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location = /routing/v2/routers/varely/index/graphql {
rewrite /routing/v2/(.*) /otp/$1 break;
proxy_pass http://opentripplanner-varely-v2:8080/;
Expand All @@ -312,6 +336,14 @@ location = /routing/v2/varely/gtfs/v1 {
proxy_read_timeout 11500ms;
}

location = /routing/v2/varely/health {
rewrite /routing/v2/varely/(.*) /otp/actuators/$1 break;
proxy_pass http://opentripplanner-varely-v2:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location = /routing/v2-kela/routers/kela/index/graphql {
rewrite /routing/v2-kela/(.*) /otp/$1 break;
proxy_pass http://opentripplanner-kela-v2:8080/;
Expand All @@ -331,6 +363,14 @@ location = /routing/v2-kela/kela/gtfs/v1 {
proxy_read_timeout 29500ms;
}

location = /routing/v2-kela/kela/health {
rewrite /routing/v2-kela/kela/(.*) /otp/actuators/$1 break;
proxy_pass http://opentripplanner-kela-v2:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location = /routing/v2/routers/hsl/index/graphql {
rewrite /routing/v2/(.*) /otp/$1 break;
proxy_pass http://opentripplanner-hsl-v2:8080/;
Expand All @@ -350,6 +390,14 @@ location = /routing/v2/hsl/gtfs/v1 {
proxy_read_timeout 11500ms;
}

location = /routing/v2/hsl/health {
rewrite /routing/v2/hsl/(.*) /otp/actuators/$1 break;
proxy_pass http://opentripplanner-hsl-v2:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /routing-data/v2/hsl {
rewrite /routing-data/v2/hsl/(.*) /$1 break;
proxy_pass http://opentripplanner-data-server-hsl:8080/;
Expand Down
1 change: 1 addition & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ describe('api.digitransit.fi', function() {
v2routers.forEach(function(router) {
testProxying('api.digitransit.fi',`/routing/v2/routers/${router}/index/graphql`, `opentripplanner-${router}-v2:8080`);
testProxying('api.digitransit.fi',`/routing/v2/${router}/gtfs/v1`, `opentripplanner-${router}-v2:8080`);
testProxying('api.digitransit.fi',`/routing/v2/${router}/health`, `opentripplanner-${router}-v2:8080`);
testResponseHeader('api.digitransit.fi',`/routing-data/v3/${router}/router-config.json`, 'access-control-allow-origin', '*');
testProxying('api.digitransit.fi',`/routing-data/v3/${router}/router-config.json`,`opentripplanner-data-server-${router}-v3:8080`);
testProxying('api.digitransit.fi',`/map/v3/${router}/en/rental-stations/`, `opentripplanner-${router}-v2:8080`);
Expand Down

0 comments on commit 6fb69f5

Please sign in to comment.