1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

чиним билд15

This commit is contained in:
MoonTestUse1
2025-01-02 00:48:44 +06:00
parent 6c10497678
commit b866a61e53
3 changed files with 25 additions and 17 deletions

View File

@@ -6,10 +6,16 @@ import os
SQLALCHEMY_DATABASE_URL = os.getenv( SQLALCHEMY_DATABASE_URL = os.getenv(
"DATABASE_URL", "DATABASE_URL",
"postgresql://postgres:postgres@postgres/support_db" "postgresql://postgres:postgres123@postgres:5432/support_db"
)
engine = create_engine(
SQLALCHEMY_DATABASE_URL,
pool_pre_ping=True,
pool_size=5,
max_overflow=10
) )
engine = create_engine(SQLALCHEMY_DATABASE_URL)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base() Base = declarative_base()

View File

@@ -1,8 +1,8 @@
-- Create the postgres superuser -- Create database
CREATE USER postgres WITH PASSWORD 'postgres' SUPERUSER;
-- Create the database
CREATE DATABASE support_db; CREATE DATABASE support_db;
-- Grant privileges -- Connect to the database
GRANT ALL PRIVILEGES ON DATABASE support_db TO postgres; \c support_db;
-- Create extensions if needed
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

View File

@@ -2,9 +2,7 @@ version: '3.8'
services: services:
frontend: frontend:
build: build: frontend
context: ./frontend
dockerfile: Dockerfile
container_name: support-frontend container_name: support-frontend
ports: ports:
- "80:80" - "80:80"
@@ -14,16 +12,15 @@ services:
- support-network - support-network
backend: backend:
build: build: backend
context: ./backend
dockerfile: Dockerfile
container_name: support-backend container_name: support-backend
environment: environment:
- DATABASE_URL=postgresql://postgres:postgres@postgres/support_db - DATABASE_URL=postgresql://postgres:postgres123@postgres:5432/support_db
ports: ports:
- "8000:8000" - "8000:8000"
depends_on: depends_on:
- postgres postgres:
condition: service_healthy
networks: networks:
- support-network - support-network
@@ -32,11 +29,16 @@ services:
container_name: support-postgres container_name: support-postgres
environment: environment:
- POSTGRES_USER=postgres - POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres - POSTGRES_PASSWORD=postgres123
- POSTGRES_DB=support_db - POSTGRES_DB=support_db
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
- ./backend/docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql - ./backend/docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d support_db"]
interval: 5s
timeout: 5s
retries: 5
networks: networks:
- support-network - support-network