We have a services which provides apis like host:port/cms/{documents/folders/health}. Because they way our infrastructure works local balancers (LB) are hitting host:port/cms/health to detect issues or auto-scale. When we add MG in-front of our service LB need an OAuth2 bearer token, and the token needs ot be periodically refreshed, this configuration is not easy to do in places such as AWS EBS or when using plain HA or nginx. Is there a way we can indicate that certain endpoint in our API does not require Ouath2 tokens? Right now it looks like an all or nothing for host:port/cms/
Solved! Go to Solution.
The issue with this approach is that we are not testing the health of the service, of which microEdge is part, but of a component of the service. If microEdge fails, my service is not reachable and teh LB needs to find this on the /health end porint
I think the best way is for the health check to hit the API endpoint directly (and bypass MG).
The issue with this approach is that we are not testing the health of the service, of which microEdge is part, but of a component of the service. If microEdge fails, my service is not reachable and teh LB needs to find this on the /health end porint
I haven't tried this, but there might be a way.
1: implement a custom plugin. A custom plugin is a node.js middleware. So you can write code there to verify the health of node.js itself and also the backend server (i.e., have node.js use the request module or something and call the backend). If all parameters are good, you can have the module return a 200 OK, 503 otherwise.
2: Make sure your custom plugin appears before the OAuth plugin. Plugins are executed in the order they are specified.
(This is edited here: ~/.edgemicro/{orgname}-{envname}-config.yaml
Ex:
logging: level: error dir: /var/tmp stats_log_interval: 60 rotate_interval: 24 plugins: sequence: - healthcheck - oauth
Thanks that makes sense.