add healthchecks
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-11-19 01:28:21 +01:00
parent 68cfa1b349
commit c67bcc8db1
4 changed files with 31 additions and 2 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
from .require_decorators import json_required, multipart_required
from .error_handlers import register_all_error_handlers
from .storage import storage, ensure_buckets
from .storage import storage, ensure_buckets
from .healthckecks import health_database_status

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python3
from model import db
"""
Healthchek functions
"""
__author__ = "@tormakris"
__copyright__ = "Copyright 2020, Birbnetes Team"
__module_name__ = "healthchecks"
__version__text__ = "1"
def health_database_status():
is_database_working = True
output = 'database is ok'
try:
db.session.execute('SELECT 1')
except Exception as e:
output = str(e)
is_database_working = False
return is_database_working, output