Skip to content

Commit

Permalink
Merge pull request #1 from SidingsMedia/computroniks/features/remove-…
Browse files Browse the repository at this point in the history
…stats-and-add-healthchecks

Computroniks/features/remove stats and add healthchecks
  • Loading branch information
Computroniks authored Apr 10, 2024
2 parents 4222ab0 + af82255 commit c3494d6
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 39 deletions.
10 changes: 10 additions & 0 deletions components/responses/HealthCheckFail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2024 Sidings Media
# SPDX-License-Identifier: MIT

description: Service is unhealthy
content:
text/plain:
schema:
type: string
example:
unhealthy
10 changes: 10 additions & 0 deletions components/responses/HealthCheckOK.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2024 Sidings Media
# SPDX-License-Identifier: MIT

description: Service is healthy
content:
text/plain:
schema:
type: string
example:
healthy
9 changes: 2 additions & 7 deletions conf/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 Sidings Media
# SPDX-FileCopyrightText: 2023-2024 Sidings Media
# SPDX-License-Identifier: CC0-1.0

server {
Expand All @@ -16,12 +16,7 @@ server {
alias /usr/share/nginx/html/openapi.json;
}

location = /docs {
default_type "text/html";
alias /usr/share/nginx/html/openapi.html;
}

location /health {
location /openapi/health {
return 200 "healthy\n";
default_type "text/plain";
}
Expand Down
19 changes: 12 additions & 7 deletions openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 Sidings Media
# SPDX-FileCopyrightText: 2023-2024 Sidings Media
# SPDX-License-Identifier: MIT

openapi: 3.0.3
Expand Down Expand Up @@ -26,12 +26,12 @@ info:
| Path Base | Service Name | Repository |
|---|---|---|
| `/messaging` | `messaging` | https://github.com/SidingsMedia/messaging.git |
| `/stats` | `stats` | https://github.com/SidingsMedia/stats.git |
| `/terms` | `static` | https://github.com/SidingsMedia/static.git |
| `/openapi` | `openapi` | https://github.com/SidingsMedia/openapi.git |
| `/openapi.json` | `openapi` | https://github.com/SidingsMedia/openapi.git |
Each service will expose a health check endpoint that will return a
plaintext `200 OK` response when called. This is documented by the
plaintext `200 OK` response when called. This is documented by this
specification.
## Operation
Expand All @@ -53,7 +53,7 @@ info:
that do implement a rate limit, you will receive a http `429`
response with the `retry-after` header set indicating after how many
seconds you should restart making requests.
version: 0.2.1
version: 0.3.0

servers:
- url: https://api.sidingsmedia.com/
Expand All @@ -74,9 +74,14 @@ tags:
paths:
/messaging/contact:
$ref: paths/messaging/contact.yaml

/stats/views:
$ref: paths/stats/views.yaml
/messaging/health:
$ref: paths/messaging/health.yaml

/openapi/health:
$ref: paths/openapi/health.yaml

/static/health:
$ref: paths/static/health.yaml

/terms:
$ref: paths/terms.yaml
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openapi",
"version": "0.1.0",
"version": "0.3.0",
"description": "API documentation for the Sidings Media API",
"main": "index.js",
"scripts": {
Expand Down
15 changes: 15 additions & 0 deletions paths/messaging/health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2024 Sidings Media
# SPDX-License-Identifier: MIT

get:
description: Messaging service health check
summary: Health check
tags:
- messaging
responses:
'200':
$ref: ../../components/responses/HealthCheckOK.yaml
'429':
$ref: ../../components/responses/TooManyRequests.yaml
5XX:
$ref: ../../components/responses/HealthCheckFail.yaml
15 changes: 15 additions & 0 deletions paths/openapi/health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2024 Sidings Media
# SPDX-License-Identifier: MIT

get:
description: Static service health check
summary: Health check
tags:
- static
responses:
'200':
$ref: ../../components/responses/HealthCheckOK.yaml
'429':
$ref: ../../components/responses/TooManyRequests.yaml
5XX:
$ref: ../../components/responses/HealthCheckFail.yaml
15 changes: 15 additions & 0 deletions paths/static/health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2024 Sidings Media
# SPDX-License-Identifier: MIT

get:
description: OpenAPI service health check
summary: Health check
tags:
- openapi
responses:
'200':
$ref: ../../components/responses/HealthCheckOK.yaml
'429':
$ref: ../../components/responses/TooManyRequests.yaml
5XX:
$ref: ../../components/responses/HealthCheckFail.yaml
23 changes: 0 additions & 23 deletions paths/stats/views.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion paths/terms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ get:
description: API terms of use
summary: Get API terms of use
tags:
- docs
- static
responses:
'200':
description: Terms
Expand Down

0 comments on commit c3494d6

Please sign in to comment.