From f35da406871f506eef549a2debabaac5343e283f Mon Sep 17 00:00:00 2001 From: Henning Jacobs Date: Fri, 6 Jan 2017 23:47:02 +0100 Subject: [PATCH] #49 REDIS_URL configuration --- README.rst | 4 +++- app.py | 4 ++-- deploy/deployment.yaml | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index aea8293..a7eed1c 100644 --- a/README.rst +++ b/README.rst @@ -106,12 +106,14 @@ The following environment variables are supported: Set to "true" for local development to reload code changes. ``MOCK`` Set to "true" to mock Kubernetes cluster data. +``REDIS_URL`` + Optional Redis server to use for pub/sub events and job locking when running more than one replica. Supported Browsers ================== -The UI uses WebGL and ECMAScript 6 features. +The UI uses WebGL, ECMAScript 6, and EventSource features. The following browsers are known to work: * Chrome/Chromium 53.0+ diff --git a/app.py b/app.py index 5f97c41..01201a1 100755 --- a/app.py +++ b/app.py @@ -24,6 +24,7 @@ from flask import Flask, redirect from flask_oauthlib.client import OAuth, OAuthRemoteApp from urllib.parse import urljoin +logging.basicConfig(level=logging.INFO) class MemoryStore: def __init__(self): @@ -54,7 +55,7 @@ class MemoryStore: class RedisStore: def __init__(self, url): - self._url = url + logging.info('Connecting to Redis on {}..'.format(url)) self._redis = redis.StrictRedis.from_url(url) self._redlock = Redlock([url]) @@ -375,7 +376,6 @@ def update(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO) http_server = gevent.wsgi.WSGIServer(('0.0.0.0', SERVER_PORT), app) gevent.spawn(update) logging.info('Listening on :{}..'.format(SERVER_PORT)) diff --git a/deploy/deployment.yaml b/deploy/deployment.yaml index ddd55b3..fb87f06 100644 --- a/deploy/deployment.yaml +++ b/deploy/deployment.yaml @@ -28,6 +28,9 @@ spec: port: 8080 initialDelaySeconds: 5 timeoutSeconds: 1 + env: + - name: REDIS_URL + value: kube-ops-view-redis:6379 resources: limits: cpu: 200m