From 57ef8989ecdc893eb4f5ab02071ba0df3e0c0209 Mon Sep 17 00:00:00 2001 From: iritmaximus Date: Sat, 4 Feb 2023 17:50:05 +0200 Subject: [PATCH] feat: communication between flask and postgres and fly.io --- docker-compose.yml | 20 ++++++++++++++++++-- fly.toml | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3bf3d49..b0829af 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: flask: # adding this ****ing little **** took at least 3 hours of debugging - command: sh -c "gunicorn -w 4 flaskr:app -b 0.0.0.0:5000" + command: sh -c "gunicorn -w 4 flaskr:app -b 0.0.0.0:5000 --access-logfile '-' --error-logfile '-'" build: context: . dockerfile: Dockerfile @@ -9,6 +9,13 @@ services: - "5000:5000" volumes: - .:/app + env_file: .env + environment: + - POSTGRES_DB + - POSTGRES_USER + - POSTGRES_PASSWORD + - POSTGRES_URL + - ENVIRONMENT=production depends_on: db: condition: service_healthy @@ -18,7 +25,7 @@ services: db: image: postgres:bullseye volumes: - - ./data/db:/var/lib/postgresql/data + - postgres_db:/var/lib/postgresql/data env_file: .env environment: - POSTGRES_DB @@ -30,3 +37,12 @@ services: interval: 3s timeout: 2s retries: 30 + + adminer: + image: adminer + restart: always + ports: + - 8080:8080 + +volumes: + postgres_db: diff --git a/fly.toml b/fly.toml index 9f01324..508cb92 100644 --- a/fly.toml +++ b/fly.toml @@ -10,6 +10,10 @@ processes = [] [experimental] auto_rollback = true +[mounts] +source="tsoha_postgres_volume" +destination="/var/lib/postgresql/data" + [[services]] http_checks = [] internal_port = 5000