@@ -3,12 +3,13 @@ services: | |||
web: | |||
build: ./web | |||
container_name: python | |||
ports: | |||
- "5000:5000" | |||
volumes: | |||
- ./web:/code | |||
expose: | |||
- 5000 | |||
env_file: | |||
- ./.env.prod | |||
depends_on: | |||
- db | |||
command: gunicorn --workers=3 --bind 0.0.0.0:5000 "app:create_app()" | |||
db: | |||
image: mariadb:latest | |||
@@ -17,5 +18,19 @@ services: | |||
env_file: | |||
- ./.env.prod | |||
volumes: | |||
dbdata:/var/lib/mysql | |||
- dbdata:/var/lib/mysql | |||
command: '--default-authentication-plugin=mysql_native_password' | |||
nginx: | |||
image: nginx:latest | |||
container_name: nginx | |||
restart: unless-stopped | |||
ports: | |||
- "1337:80" | |||
volumes: | |||
- ./nginx-conf:/etc/nginx/conf.d | |||
depends_on: | |||
- web | |||
volumes: | |||
dbdata: |
@@ -0,0 +1,16 @@ | |||
upstream toolkit { | |||
server web:5000; | |||
} | |||
server { | |||
listen 80; | |||
location / { | |||
proxy_pass http://toolkit; | |||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |||
proxy_set_header Host $host; | |||
proxy_redirect off; | |||
} | |||
} |
@@ -26,6 +26,7 @@ def create_app(): | |||
# get config variables from OS environment variables: set in env file passed through Docker Compose | |||
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY') | |||
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') | |||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = 'False' | |||
db.init_app(app) | |||
@@ -2,3 +2,4 @@ flask | |||
flask-sqlalchemy | |||
flask-login | |||
flask-moment | |||
gunicorn |