Make production ready
							parent
							
								
									1d6dce5088
								
							
						
					
					
						commit
						c9547c43f6
					
				| 
						 | 
					@ -18,7 +18,7 @@ Scheduling for TF2
 | 
				
			||||||
- **Database:** [PostgreSQL 17.1](https://www.postgresql.org/docs/17/index.html)
 | 
					- **Database:** [PostgreSQL 17.1](https://www.postgresql.org/docs/17/index.html)
 | 
				
			||||||
  (production) / SQLite (development)
 | 
					  (production) / SQLite (development)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Setup (dev)
 | 
					## Setup (development, SQLite3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```sh
 | 
					```sh
 | 
				
			||||||
docker compose build
 | 
					docker compose build
 | 
				
			||||||
| 
						 | 
					@ -28,7 +28,7 @@ DATABASE_URI=sqlite:///db.sqlite3 flask db upgrade
 | 
				
			||||||
 | 
					
 | 
				
			||||||
App will run at port 8000.
 | 
					App will run at port 8000.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Setup (production)
 | 
					## Setup (production, Postgres)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Build the frontend app:
 | 
					Build the frontend app:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ services:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Flask service
 | 
					  # Flask service
 | 
				
			||||||
  backend:
 | 
					  backend:
 | 
				
			||||||
    container_name: backend
 | 
					    container_name: backend-production
 | 
				
			||||||
    command: ["gunicorn", "-w", "4", "app:app", "-b", "0.0.0.0:5000"]
 | 
					    command: ["gunicorn", "-w", "4", "app:app", "-b", "0.0.0.0:5000"]
 | 
				
			||||||
    image: backend-flask-production
 | 
					    image: backend-flask-production
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
| 
						 | 
					@ -42,13 +42,13 @@ services:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # ETL job (runs with the same source as the backend)
 | 
					  # ETL job (runs with the same source as the backend)
 | 
				
			||||||
  celery-worker:
 | 
					  celery-worker:
 | 
				
			||||||
    container_name: worker
 | 
					    container_name: worker-production
 | 
				
			||||||
    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
 | 
				
			||||||
 | 
					    image: backend-flask-production
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      - CELERY_BROKER_URL=redis://redis:6379/0
 | 
					      - CELERY_BROKER_URL=redis://redis:6379/0
 | 
				
			||||||
      - CELERY_RESULT_BACKEND=redis://redis:6379/0
 | 
					      - CELERY_RESULT_BACKEND=redis://redis:6379/0
 | 
				
			||||||
      - DATABASE_URI=postgresql+psycopg://db:5432
 | 
					      - DATABASE_URI=postgresql+psycopg://postgres:password@db:5432/availabilitf
 | 
				
			||||||
    image: backend-flask-production
 | 
					 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - ./backend-flask:/app
 | 
					      - ./backend-flask:/app
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
| 
						 | 
					@ -68,7 +68,8 @@ services:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Vue + Vite service
 | 
					  # Vue + Vite service
 | 
				
			||||||
  frontend:
 | 
					  frontend:
 | 
				
			||||||
    container_name: frontend
 | 
					    container_name: frontend-production
 | 
				
			||||||
 | 
					    image: frontend-production
 | 
				
			||||||
    build:
 | 
					    build:
 | 
				
			||||||
      context: ./availabili.tf
 | 
					      context: ./availabili.tf
 | 
				
			||||||
      dockerfile: Dockerfile.prod
 | 
					      dockerfile: Dockerfile.prod
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ services:
 | 
				
			||||||
  # ETL job (runs with the same source as the backend)
 | 
					  # ETL job (runs with the same source as the backend)
 | 
				
			||||||
  celery-worker:
 | 
					  celery-worker:
 | 
				
			||||||
    container_name: 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:
 | 
					    environment:
 | 
				
			||||||
      - CELERY_BROKER_URL=redis://redis:6379/0
 | 
					      - CELERY_BROKER_URL=redis://redis:6379/0
 | 
				
			||||||
      - CELERY_RESULT_BACKEND=redis://redis:6379/0
 | 
					      - CELERY_RESULT_BACKEND=redis://redis:6379/0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue