mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 06:35:38 +01:00
Add healthcheck
This commit is contained in:
@@ -32,6 +32,7 @@ COPY --from=build-image $VENV_PATH $VENV_PATH
|
|||||||
ENV PATH="$VENV_PATH/bin:$PATH"
|
ENV PATH="$VENV_PATH/bin:$PATH"
|
||||||
|
|
||||||
COPY ./scripts/start_production.sh /root/
|
COPY ./scripts/start_production.sh /root/
|
||||||
|
COPY ./scripts/healthcheck.py /root/
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|||||||
11
scripts/healthcheck.py
Normal file
11
scripts/healthcheck.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
|
||||||
|
response = httpx.get(
|
||||||
|
"http://localhost:8080/api/v1/healthcheck",
|
||||||
|
headers={"Authorization": os.environ["API_KEY"]},
|
||||||
|
)
|
||||||
|
print(f"HEALTHCHECK STATUS: {response.status_code}")
|
||||||
|
exit(0 if response.status_code == 200 else 1)
|
||||||
@@ -108,3 +108,8 @@ async def update_cache(request: Request):
|
|||||||
await arq_pool.enqueue_job("check_books")
|
await arq_pool.enqueue_job("check_books")
|
||||||
|
|
||||||
return "Ok!"
|
return "Ok!"
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/healthcheck")
|
||||||
|
async def healthcheck():
|
||||||
|
return "Ok!"
|
||||||
|
|||||||
Reference in New Issue
Block a user