add auth to mongodb connection

This commit is contained in:
Marvin Zhang
2019-06-12 21:23:22 +08:00
parent 19b217e88a
commit fa31a320d0
2 changed files with 8 additions and 6 deletions

View File

@@ -30,13 +30,13 @@ ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# install frontend
RUN npm install -g yarn --registry=https://registry.npm.taobao.org \
RUN npm install -g yarn \
&& cd /opt/crawlab/frontend \
&& yarn install --registry=https://registry.npm.taobao.org
&& yarn install
# install backend
RUN pip install -U setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple \
&& pip install -r /opt/crawlab/crawlab/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -U setuptools \
&& pip install -r /opt/crawlab/crawlab/requirements.txt
# start backend
EXPOSE 8080

View File

@@ -25,7 +25,10 @@ MONGO_DB = 'crawlab_test'
BROKER_URL = 'redis://127.0.0.1:6379/0'
# Celery后台URL
CELERY_RESULT_BACKEND = 'mongodb://127.0.0.1:27017/'
if MONGO_USERNAME is not None:
CELERY_RESULT_BACKEND = f'mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@{MONGO_HOST}:{MONGO_PORT}/'
else:
CELERY_RESULT_BACKEND = f'mongodb://{MONGO_HOST}:{MONGO_PORT}/'
# Celery MongoDB设置
CELERY_MONGODB_BACKEND_SETTINGS = {
@@ -42,7 +45,6 @@ CELERY_ENABLE_UTC = True
# flower variables
FLOWER_API_ENDPOINT = 'http://localhost:5555/api'
# Flask 变量
DEBUG = False
FLASK_HOST = '0.0.0.0'