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

feat(docker-jans-link): add healthcheck support #5777

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions charts/janssen/charts/link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ Kubernetes: `>=v1.21.0-0`
| image.repository | string | `"ghcr.io/janssenproject/jans/link"` | Image to use for deploying. |
| image.tag | string | `"1.0.17_dev"` | Image tag to use for deploying. |
| lifecycle | object | `{}` | |
| livenessProbe | object | `{"httpGet":{"path":"/jans-link/api/v1/health/live","port":9091},"initialDelaySeconds":30,"periodSeconds":30,"timeoutSeconds":5}` | Configure the liveness healthcheck for the auth server if needed. |
| livenessProbe.httpGet | object | `{"path":"/jans-link/api/v1/health/live","port":9091}` | Executes the python3 healthcheck. |
| livenessProbe | object | `{"exec":{"command":["python3","/app/scripts/healthcheck.py"]},"initialDelaySeconds":30,"periodSeconds":30,"timeoutSeconds":5}` | Configure the liveness healthcheck for the link if needed. |
| livenessProbe.exec | object | `{"command":["python3","/app/scripts/healthcheck.py"]}` | Executes the python3 healthcheck. |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| readinessProbe | object | `{"httpGet":{"path":"/jans-link/api/v1/health/ready","port":9091},"initialDelaySeconds":25,"periodSeconds":25,"timeoutSeconds":5}` | Configure the readiness healthcheck for the auth server if needed. |
| readinessProbe | object | `{"exec":{"command":["python3","/app/scripts/healthcheck.py"]},"initialDelaySeconds":25,"periodSeconds":25,"timeoutSeconds":5}` | Configure the readiness healthcheck for the link if needed. |
| replicas | int | `1` | Service replica number. |
| resources | object | `{"limits":{"cpu":"500m","memory":"1000Mi"},"requests":{"cpu":"500m","memory":"1000Mi"}}` | Resource specs. |
| resources.limits.cpu | string | `"500m"` | CPU limit. |
Expand Down
18 changes: 10 additions & 8 deletions charts/janssen/charts/link/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@ service:
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
# -- Configure the liveness healthcheck for the auth server if needed.
# -- Configure the liveness healthcheck for the link if needed.
livenessProbe:
# -- Executes the python3 healthcheck.
httpGet:
path: /jans-link/api/v1/health/live
port: 9091
exec:
command:
- python3
- /app/scripts/healthcheck.py
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
# -- Configure the readiness healthcheck for the auth server if needed.
# -- Configure the readiness healthcheck for the link if needed.
readinessProbe:
httpGet:
path: /jans-link/api/v1/health/ready
port: 9091
exec:
command:
- python3
- /app/scripts/healthcheck.py
initialDelaySeconds: 25
periodSeconds: 25
timeoutSeconds: 5
Expand Down
4 changes: 2 additions & 2 deletions docker-jans-link/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ RUN wget -q https://maven.jans.io/maven/io/jans/jython-installer/${JYTHON_VERSIO
# ====

ENV CN_VERSION=1.0.17-SNAPSHOT
ENV CN_BUILD_DATE='2023-07-13'
ENV CN_SOURCE_URL=https://jenkins.jans.io/maven/io/jans/jans-link/${CN_VERSION}/jans-link-${CN_VERSION}.war
ENV CN_BUILD_DATE='2023-08-03 16:58'
ENV CN_SOURCE_URL=https://jenkins.jans.io/maven/io/jans/jans-link-server/${CN_VERSION}/jans-link-server-${CN_VERSION}.war

RUN mkdir -p ${JETTY_BASE}/jans-link/webapps \
&& wget -q ${CN_SOURCE_URL} -O /tmp/jans-link.war \
Expand Down
20 changes: 20 additions & 0 deletions docker-jans-link/scripts/healthcheck.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys

import requests


def main():
req = requests.get("http://0.0.0.0:9091/jans-link/sys/health-check")
if not req.ok:
sys.exit(1)

data = req.json()
if data["status"] == "running" and data["db_status"] == "online":
sys.exit(0)

# any other value will be considered as unhealthy
sys.exit(1)


if __name__ == "__main__":
main()