Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web health check is failing due to valid endpoints #221

Open
minsis opened this issue Mar 4, 2021 · 0 comments
Open

Web health check is failing due to valid endpoints #221

minsis opened this issue Mar 4, 2021 · 0 comments

Comments

@minsis
Copy link
Contributor

minsis commented Mar 4, 2021

Describe the problem

st2web health check scripts are shutting down the containers due to false positives. This only applies to the 2nd half of the script and I'm not sure why this is only now presenting itself as an issue. I initially had this up and running for over a week without issues

API_STATUS=$(curl --write-out "%{http_code}\n" --silent --output /dev/null http://localhost/api/v1/)
if [ "${API_STATUS}" != "401" ]; then
echo "st2api nginx failure"; nginx -s stop;
fi

Returns a 200 with version details and the script is looking for a 401

root@a6a8fed46e07:/# curl -v http://localhost/api/v1/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /api/v1/ HTTP/1.1
> Host: localhost
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.18.0
< Date: Thu, 04 Mar 2021 16:17:22 GMT
< Content-Type: application/json
< Content-Length: 80
< Connection: keep-alive
< Access-Control-Allow-Origin: http://127.0.0.1:3000
< Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
< Access-Control-Allow-Headers: Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID
< Access-Control-Allow-Credentials: true
< Access-Control-Expose-Headers: Content-Type,X-Limit,X-Total-Count,X-Request-ID
< X-Request-Id: 60f0092a-ab28-4bea-a438-b3b6679971a5
< X-Content-Type-Options: nosniff
<
{
    "version": "3.4dev",
    "docs_url": "http://docs.stackstorm.com/latest"
* Connection #0 to host localhost left intact
}

STREAM_STATUS=$(curl --write-out "%{http_code}\n" --silent --output /dev/null http://localhost/stream/v1/stream)
if [ "${STREAM_STATUS}" != "401" ]; then
echo "st2stream nginx failure"; nginx -s stop;
fi

Stream also returns a 200 but doesn't even exit curl as its holding onto the session. The script is also looking for a 401 here.

root@a6a8fed46e07:/# curl -kv http://localhost/stream/v1/stream
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /stream/v1/stream HTTP/1.1
> Host: localhost
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.18.0
< Date: Thu, 04 Mar 2021 16:18:49 GMT
< Content-Type: text/event-stream; charset=UTF-8
< Connection: close
< Cache-Control: no-cache
< Access-Control-Allow-Origin: http://127.0.0.1:3000
< Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
< Access-Control-Allow-Headers: Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID
< Access-Control-Allow-Credentials: true
< Access-Control-Expose-Headers: Content-Type,X-Limit,X-Total-Count,X-Request-ID
< X-Request-Id: cd91cf97-d4b7-4db3-bc2a-c2638c918877
< X-Content-Type-Options: nosniff
<

^C

AUTH_STATUS=$(curl --write-out "%{http_code}\n" --silent --output /dev/null http://localhost/auth/v1/)
if [ "${AUTH_STATUS}" != "404" ]; then
echo "st2auth nginx failure"; nginx -s stop;
fi

Auth's URL endpoint seems incorrect? Should it be /v1/auth instead? Either way both returns a 404 and the script is looking for a 404. This is the only check that would be passing.

root@a6a8fed46e07:/# curl -kv http://localhost/auth/v1/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /auth/v1/ HTTP/1.1
> Host: localhost
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Server: nginx/1.18.0
< Date: Thu, 04 Mar 2021 16:37:47 GMT
< Content-Type: application/json
< Content-Length: 57
< Connection: keep-alive
< Access-Control-Allow-Origin: http://127.0.0.1:3000
< Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
< Access-Control-Allow-Headers: Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID
< Access-Control-Allow-Credentials: true
< Access-Control-Expose-Headers: Content-Type,X-Limit,X-Total-Count,X-Request-ID
< X-Request-Id: a92a3955-42bb-411c-9631-95b46ada3f98
<
{
    "faultstring": "The resource could not be found."
* Connection #0 to host localhost left intact
}

Versions

  • Host OS: Oracle 7
  • docker: Docker version 17.06.2-ol, build d02b7ab
  • docker-compose: [docker-compose version 1.18.0, build 8dd22a9
  • stackstorm version: st2 3.4.0dev, on Python 3.6.9.

To Reproduce
???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant