#49 REDIS_URL configuration

This commit is contained in:
Henning Jacobs
2017-01-06 23:47:02 +01:00
parent d8ef751f66
commit f35da40687
3 changed files with 8 additions and 3 deletions

View File

@@ -106,12 +106,14 @@ The following environment variables are supported:
Set to "true" for local development to reload code changes. Set to "true" for local development to reload code changes.
``MOCK`` ``MOCK``
Set to "true" to mock Kubernetes cluster data. 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 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: The following browsers are known to work:
* Chrome/Chromium 53.0+ * Chrome/Chromium 53.0+

4
app.py
View File

@@ -24,6 +24,7 @@ from flask import Flask, redirect
from flask_oauthlib.client import OAuth, OAuthRemoteApp from flask_oauthlib.client import OAuth, OAuthRemoteApp
from urllib.parse import urljoin from urllib.parse import urljoin
logging.basicConfig(level=logging.INFO)
class MemoryStore: class MemoryStore:
def __init__(self): def __init__(self):
@@ -54,7 +55,7 @@ class MemoryStore:
class RedisStore: class RedisStore:
def __init__(self, url): def __init__(self, url):
self._url = url logging.info('Connecting to Redis on {}..'.format(url))
self._redis = redis.StrictRedis.from_url(url) self._redis = redis.StrictRedis.from_url(url)
self._redlock = Redlock([url]) self._redlock = Redlock([url])
@@ -375,7 +376,6 @@ def update():
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
http_server = gevent.wsgi.WSGIServer(('0.0.0.0', SERVER_PORT), app) http_server = gevent.wsgi.WSGIServer(('0.0.0.0', SERVER_PORT), app)
gevent.spawn(update) gevent.spawn(update)
logging.info('Listening on :{}..'.format(SERVER_PORT)) logging.info('Listening on :{}..'.format(SERVER_PORT))

View File

@@ -28,6 +28,9 @@ spec:
port: 8080 port: 8080
initialDelaySeconds: 5 initialDelaySeconds: 5
timeoutSeconds: 1 timeoutSeconds: 1
env:
- name: REDIS_URL
value: kube-ops-view-redis:6379
resources: resources:
limits: limits:
cpu: 200m cpu: 200m