Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Integralist
Copy link
Collaborator

@Integralist Integralist commented Mar 7, 2023

Problem

Users running compute deploy or compute publish are immediately presented with a 'Service URL' which when clicked on by a user will typically return a 500 Internal Server error (as the user's application is still being deployed across Fastly's global network).

Solution

Ping the Service URL until an appropriate response is received.

Notes

The implementation checks for a non-500 response and if it gets one within the specified timeout it will show a 'green tick' to indicate the service URL will work when visited.

The reason we've chosen this approach, rather than checking for a 200 OK from the service URL, is that we don't control a user's service and so a 4xx status code for the root path / of a service might be a completely valid response!

Whereas we feel fairly confident that a 500 Internal Server error is unlikely to be expected behaviour for anyone's service.

We also ensure our messaging asks users to check their DNS if they have defined a custom domain, as some users will specify a custom domain and activate a service via the CLI and only then will setup the DNS to point to Fastly.

This is an interim solution until we have either an API or HTTP response header that helps us identify service availability.

Refer to the following 'example output' gif and see also the updated screenshots in the below thread.

output

@Integralist Integralist added the enhancement New feature or request label Mar 7, 2023
@Integralist
Copy link
Collaborator Author

Integralist commented Mar 8, 2023

Here are some updated screenshots showing updated remediation messaging and status code responses.

Success (404 Not Found)

In the following screenshot notice the additional INFO log output to help guide the user when a non-2xx response is received.

1  Success (notice 404 message)

Success (200 OK)

In the following screenshot notice there is no additional INFO log as we didn't get back a 4xx/5xx status.

3  Success (200 OK)

@Integralist
Copy link
Collaborator Author

Here's another screenshot demonstrating a timeout (notice the WARNING message)...
4  Timeout (notice the WARNING message)

@Integralist
Copy link
Collaborator Author

Here's another screenshot demonstrating the --status-check-off flag (for possible automation/CI scenarios)...
5  Success with no status check

@Integralist
Copy link
Collaborator Author

Integralist commented Mar 8, 2023

Here's another screenshot demonstrating the use of the --status-check-path flag which allows a user to configure a specific path to be checked (notice the 404 response status code, because the path I specified wasn't actually handled by the service)...

6  Success with check path flag

The following screenshot uses both --status-check-path and --status-check-code. The latter flag is to indicate a 404 (caused by --status-check-path) is what I expect to see from the endpoint being checked (so notice there is no INFO log printed)...

7  Success with check path and check code flags

@Integralist Integralist merged commit f634e09 into main Mar 8, 2023
@Integralist Integralist deleted the integralist/ping-service-availability branch March 8, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants