Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:2-slim

ENV PYTHONUNBUFFERED 1

RUN apt-get update && apt-get install -y git

RUN git clone https://github.com/mrname/tasktiger-admin.git

WORKDIR tasktiger-admin

RUN python setup.py install

EXPOSE 5000

CMD ["tasktiger-admin", "-i", "0.0.0.0"]
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
],
install_requires=[
'click',
'dsnparse',
'flask-admin',
'redis',
'structlog',
Expand Down
11 changes: 10 additions & 1 deletion tasktiger_admin/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import os

import click
import dsnparse
from flask import Flask
from flask_admin import Admin
import redis
Expand All @@ -15,9 +18,15 @@
@click.option('-i', '--interface', help='Admin interface to listen on',
default='127.0.0.1')
def run_admin(host, port, db, password, listen, interface):
environ_dsn = os.environ.get('REDIS_URL', None)
if environ_dsn:
dsn_parsed = dsnparse.parse(environ_dsn)
host = host or dsn_parsed.host
port = port or dsn_parsed.port
password = dsn_parsed.password
conn = redis.Redis(host, int(port or 6379), int(db or 0), password)
tiger = TaskTiger(setup_structlog=True, connection=conn)
app = Flask(__name__)
admin = Admin(app, url='/')
admin.add_view(TaskTigerView(tiger, name='TaskTiger', endpoint='tasktiger'))
app.run(debug=True, port=int(listen or 5000), host=interface)
app.run(debug=False, port=int(listen or 5000), host=interface)