From c9547c43f6e1ee8ac2b74517d170e27bb4afc4f9 Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Wed, 11 Dec 2024 18:04:53 -0800 Subject: [PATCH] Make production ready --- README.md | 4 ++-- docker-compose.prod.yml | 13 +++++++------ docker-compose.yml | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 236d62c..43dee02 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Scheduling for TF2 - **Database:** [PostgreSQL 17.1](https://www.postgresql.org/docs/17/index.html) (production) / SQLite (development) -## Setup (dev) +## Setup (development, SQLite3) ```sh docker compose build @@ -28,7 +28,7 @@ DATABASE_URI=sqlite:///db.sqlite3 flask db upgrade App will run at port 8000. -## Setup (production) +## Setup (production, Postgres) Build the frontend app: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index f58ca31..9029384 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -20,7 +20,7 @@ services: # Flask service backend: - container_name: backend + container_name: backend-production command: ["gunicorn", "-w", "4", "app:app", "-b", "0.0.0.0:5000"] image: backend-flask-production ports: @@ -42,13 +42,13 @@ services: # ETL job (runs with the same source as the backend) celery-worker: - container_name: worker - command: celery -A make_celery.celery_app worker --loglevel=info --concurrency=1 + container_name: worker-production + command: celery -A make_celery.celery_app worker --loglevel=info --concurrency=1 -B + image: backend-flask-production environment: - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/0 - - DATABASE_URI=postgresql+psycopg://db:5432 - image: backend-flask-production + - DATABASE_URI=postgresql+psycopg://postgres:password@db:5432/availabilitf volumes: - ./backend-flask:/app networks: @@ -68,7 +68,8 @@ services: # Vue + Vite service frontend: - container_name: frontend + container_name: frontend-production + image: frontend-production build: context: ./availabili.tf dockerfile: Dockerfile.prod diff --git a/docker-compose.yml b/docker-compose.yml index 80418eb..5a8ec1c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: # ETL job (runs with the same source as the backend) celery-worker: container_name: worker - command: celery -A make_celery.celery_app worker --loglevel=info --concurrency=1 + command: celery -A make_celery.celery_app worker --loglevel=info --concurrency=1 -B environment: - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/0