setup database checks for health page

mm-logging
lza_menace 4 years ago
parent 784105ddf0
commit f245272796

@ -2,13 +2,17 @@ version: '3'
services:
db:
image: postgres:9.6.15-alpine
container_name: db
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: ${DB_PASS}
POSTGRES_USER: ${DB_USER}
POSTGRES_DB: ${DB_NAME}
redis:
volumes:
- ./data:/var/lib/postgresql/data
cache:
image: redis:latest
container_name: cache
ports:
- 6379:6379

@ -29,6 +29,13 @@ SESSION_PERMANENT = True
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
# Database
DB_HOST = 'localhost'
DB_PORT = 5432
DB_NAME = 'wowstash'
DB_USER = 'wowstash'
DB_PASS = 'zzzzzzzzz'
# Development
TEMPLATES_AUTO_RELOAD = True
@ -36,5 +43,6 @@ TEMPLATES_AUTO_RELOAD = True
SOCIAL = {
'envelope': 'mailto:admin@domain.co',
'twitter': 'https://twitter.com/your_twitter_handle',
'comment-dots': 'https://webchat.freenode.net/?room=#wownero'
'comment': 'https://webchat.freenode.net/?room=#wownero',
'reddit': 'https://reddit.com/r/wownero'
}

@ -4,6 +4,7 @@ from datetime import timedelta, datetime
from redis import Redis
from wowstash.library.jsonrpc import daemon
from wowstash.library.info import info
from wowstash.library.db import Database
from wowstash import config
# from wowstash.blueprints.account import account_bp
# from wowstash.blueprints.authentication import authentication_bp
@ -30,10 +31,9 @@ def index():
@app.route('/health')
def health():
print(dir(info.redis))
return make_response(jsonify({
'cache': info.redis.ping(),
'db': False
'db': Database().connected
}), 200)

Loading…
Cancel
Save