diff --git a/camdetect.py b/camdetect.py index d89f480..e1d11bf 100755 --- a/camdetect.py +++ b/camdetect.py @@ -483,6 +483,16 @@ async def stream_wrapper(request): @app.route("/readyz") async def ready_check(request): + # Check if S3 is accessible + session = aioboto3.Session() + async with session.resource("s3", + aws_access_key_id=AWS_ACCESS_KEY_ID, + aws_secret_access_key=AWS_SECRET_ACCESS_KEY, + endpoint_url=S3_ENDPOINT_URL) as s3: + bucket = await s3.Bucket(S3_BUCKET_NAME) + await bucket.upload_fileobj(io.BytesIO(b"test"), "test") + + # Check if Mongo is accessible try: async for i in app.ctx.coll.find().limit(1): break