aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile7
-rw-r--r--app/__init__.py2
-rw-r--r--docker-compose.yml6
-rw-r--r--requirements.txt1
-rwxr-xr-xutils/run.sh11
-rwxr-xr-xutils/rundebug.sh3
-rwxr-xr-xutils/runprod.sh3
-rw-r--r--utils/runprodguni.sh3
8 files changed, 18 insertions, 18 deletions
diff --git a/Dockerfile b/Dockerfile
index 73b620d..09b1272 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,13 +5,8 @@ WORKDIR /home/cdb
COPY requirements.txt requirements.txt
RUN pip install -r ./requirements.txt
RUN pip install gunicorn
-RUN pip install psycopg2
-COPY runprodguni.sh ./
-COPY rundebug.sh ./
-RUN chmod +x runprodguni.sh
-
-COPY setup.py ./setup.py
+COPY utils utils
COPY app app
COPY migrations migrations
COPY config.cfg ./config.cfg
diff --git a/app/__init__.py b/app/__init__.py
index 2768fb0..c5d8000 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -48,7 +48,7 @@ gravatar = Gravatar(app,
use_ssl=True,
base_url=None)
-if not app.debug:
+if not app.debug and app.config["MAIL_UTILS_ERROR_SEND_TO"]:
from .maillogger import register_mail_error_handler
register_mail_error_handler(app, mail)
diff --git a/docker-compose.yml b/docker-compose.yml
index be02d76..10731fb 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,7 +15,9 @@ services:
app:
build: .
- command: ./rundebug.sh
+ command: ./utils/run.sh
+ env_file:
+ - config.env
ports:
- 5123:5123
volumes:
@@ -28,7 +30,7 @@ services:
worker:
build: .
- command: celery -A app.tasks.celery worker
+ command: FLASK_CONFIG=../config.cfg celery -A app.tasks.celery worker
env_file:
- config.env
volumes:
diff --git a/requirements.txt b/requirements.txt
index 7f19020..4067ca0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,3 +19,4 @@ lxml~=4.2
pillow~=5.3
pyScss~=1.3
redis==2.10.6
+psycopg2~=2.7
diff --git a/utils/run.sh b/utils/run.sh
new file mode 100755
index 0000000..3d19d84
--- /dev/null
+++ b/utils/run.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Debug
+# FLASK_APP=app/__init__.py FLASK_CONFIG=../config.cfg FLASK_DEBUG=1 python3 -m flask run -h 0.0.0.0 -p 5123
+
+if [ -z "$FLASK_DEBUG" ]; then
+ echo "FLASK_DEBUG is required in config.env"
+ exit 1
+fi
+
+gunicorn -w 4 -b :5123 -e FLASK_APP=app/__init__.py -e FLASK_CONFIG=../config.cfg -e FLASK_DEBUG=$FLASK_DEBUG app:app
diff --git a/utils/rundebug.sh b/utils/rundebug.sh
deleted file mode 100755
index 31e9137..0000000
--- a/utils/rundebug.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-FLASK_APP=app/__init__.py FLASK_CONFIG=../config.cfg FLASK_DEBUG=1 python3 -m flask run -h 0.0.0.0 -p 5123
diff --git a/utils/runprod.sh b/utils/runprod.sh
deleted file mode 100755
index c64450c..0000000
--- a/utils/runprod.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-FLASK_APP=app/__init__.py FLASK_CONFIG=../config.cfg FLASK_DEBUG=0 python3 -m flask run -h 0.0.0.0 -p 5123
diff --git a/utils/runprodguni.sh b/utils/runprodguni.sh
deleted file mode 100644
index 68c6962..0000000
--- a/utils/runprodguni.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-gunicorn -w 4 -b :5123 -e FLASK_APP=app/__init__.py -e FLASK_CONFIG=../config.cfg -e FLASK_DEBUG=0 app:app