Skip to content

Commit

Permalink
Adding healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
codebanesr committed Dec 8, 2023
1 parent 5a9bcde commit da07e45
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
19 changes: 12 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ services:
dockerfile: Dockerfile
target: ${TARGET}
image: codebanesr/llm-server:latest
# logging:
# driver: awslogs
# options:
# awslogs-group: opencopilot
# awslogs-region: us-east-1
# awslogs-stream: llm-server

healthcheck:
test: ["CMD", "python", "-c", "import requests; assert requests.get('http://llm-server:8002/healthcheck').status_code == 200"]
interval: 10s
timeout: 10s
retries: 5
start_period: 30s
volumes:
- ./llm-server:/app
- shared_data:/app/shared_data
Expand All @@ -31,6 +30,12 @@ services:
condition: service_started
mongodb:
condition: service_started
# logging:
# driver: awslogs
# options:
# awslogs-group: opencopilot
# awslogs-region: us-east-1
# awslogs-stream: llm-server

redis:
image: redis:latest
Expand Down
15 changes: 15 additions & 0 deletions llm-server/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from http import HTTPStatus
from dotenv import load_dotenv
from flask import Flask

Expand All @@ -13,6 +14,11 @@
from utils.config import Config
from utils.vector_store_setup import init_qdrant_collections
from shared.models.opencopilot_db import create_database_schema
from flask import jsonify
from utils.db import Database
# from routes.uploads.celery_service import celery
db_instance = Database()
mongo = db_instance.get_db()

load_dotenv()

Expand All @@ -32,6 +38,15 @@

app.config.from_object(Config)

@app.route('/healthcheck')
def health_check():
info = mongo.client
# c_info = celery.connection()

# print(c_info)
return jsonify(status='OK', servers={"mongo": info.options.pool_options.max_pool_size})


init_qdrant_collections()

if __name__ == "__main__":
Expand Down

0 comments on commit da07e45

Please sign in to comment.