Commit 341a0ce3 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Fixing several configuration issues

parent 107089f8
......@@ -56,13 +56,18 @@ test:
- docker load -i image.tar
- >
docker run
-e REDIS_HOST=$REDIS_PORT_6379_TCP_ADDR
-e RABBITMQ_HOST=$RABBITMQ_PORT_5672_TCP_ADDR
$DOCKER_USER/$DOCKER_IMAGE_TAG
sh -c "celery worker -D -A fractalis:celery -l debug --concurrency=1
sh -c "
printf \"REDIS_HOST='$REDIS_PORT_6379_TCP_ADDR'\n
BROKER_URL='amqp://guest:guest@$RABBITMQ_PORT_5672_TCP_ADDR:5672//'\n
CELERY_RESULT_BACKEND='redis://$REDIS_PORT_6379_TCP_ADDR:6379'\"
> /config.py
&& export FRACTALIS_CONFIG=/config.py
&& celery worker -D -A fractalis:celery -l debug --concurrency=1
&& pip3 install -r requirements.txt
&& flake8
&& pytest tests"
&& pytest tests
"
dependencies:
- build:image
......
SECRET_KEY = 'OVERWRITE ME IN PRODUCTION!!!'
REDIS_HOST = 'redis'
BROKER_URL = 'amqp://guest:guest@rabbitmq:5672//'
CELERY_RESULT_BACKEND = 'redis://redis:6379'
version: '2'
services:
redis:
image: 'redis:3.2-alpine'
image: 'redis:alpine'
command: >
sh -c "redis-server
&& redis-cli CONFIG SET maxmemory 4gb
&& redis-cli CONFIG SET maxmemory-policy allkeys-lru"
rabbitmq:
image: 'rabbitmq:3.7-alpine'
image: 'rabbitmq:alpine'
app:
image: 'sherzinger/fractalis:0.3.0'
image: 'sherzinger/fractalis:0.3.6'
volumes:
- ./config/fractalis/config.py:/config.py
environment:
- FRACTALIS_CONFIG=${FRACTALIS_CONFIG}
- REDIS_HOST=redis
- RABBITMQ_HOST=rabbitmq
- FRACTALIS_CONFIG=/config.py
command: gunicorn -w 3 -b :5000 --log-file gunicorn.log fractalis:app
expose:
- '5000'
......@@ -17,17 +21,17 @@ services:
- redis
- rabbitmq
worker:
image: 'sherzinger/fractalis:0.3.0'
image: 'sherzinger/fractalis:0.3.6'
volumes:
- ./config/fractalis/config.py:/config.py
environment:
- FRACTALIS_CONFIG=${FRACTALIS_CONFIG}
- REDIS_HOST=redis
- RABBITMQ_HOST=rabbitmq
- FRACTALIS_CONFIG=/config.py
command: celery worker -A fractalis:celery -l info --autoscale 16,4
depends_on:
- redis
- rabbitmq
nginx:
image: 'nginx:1.13-alpine'
image: 'nginx:alpine'
volumes:
- ./config/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
- ./config/nginx/html:/usr/share/nginx/html
......
......@@ -15,11 +15,11 @@ app = Flask(__name__)
# Configure app with defaults
app.config.from_object('fractalis.config')
# Configure app with manually settings
default_config = True
try:
app.config.from_envvar('FRACTALIS_CONFIG')
default_config = False
except RuntimeError:
default_config = True
pass
# setup logging
......
......@@ -8,7 +8,7 @@ from datetime import timedelta
SECRET_KEY = 'OVERWRITE ME IN PRODUCTION!!!'
DEBUG = False
TESTING = False
REDIS_HOST = os.environ.get('REDIS_HOST') or '127.0.0.1'
REDIS_HOST = 'localhost'
REDIS_PORT = '6379'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = False
......@@ -16,12 +16,11 @@ SESSION_REFRESH_EACH_REQUEST = True
PERMANENT_SESSION_LIFETIME = timedelta(days=1)
# Celery
RABBITMQ_HOST = os.environ.get('RABBITMQ_HOST') or '127.0.0.1'
BROKER_URL = 'amqp://guest:guest@{}:5672//'.format(RABBITMQ_HOST)
CELERY_RESULT_BACKEND = 'redis://{}:{}'.format(REDIS_HOST, REDIS_PORT)
BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'redis://localhost:6379'
CELERYD_TASK_SOFT_TIME_LIMIT = 60 * 20
CELERYD_TASK_TIME_LIMIT = 60 * 30
CELERY_TASK_RESULT_EXPIRES = timedelta(hours=1)
CELERY_TASK_RESULT_EXPIRES = timedelta(days=10)
CELERYD_HIJACK_ROOT_LOGGER = False
# Fractalis
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment