From 82f3ce51951a51540876d99d7bec0b092bfa3df3 Mon Sep 17 00:00:00 2001 From: ivanprytula Date: Tue, 17 Dec 2024 16:52:55 +0100 Subject: [PATCH] swap adminer to pgadmin for backend-ms --- .editorconfig | 2 +- microservices/backend/.gitignore | 7 ++++ .../backend/app/api/routes/private.py | 5 +++ microservices/backend/compose.override.yaml | 13 +++++-- microservices/backend/compose.yml | 39 ++++++++++++++++--- 5 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 microservices/backend/.gitignore diff --git a/.editorconfig b/.editorconfig index f7d82d5..6457ffc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,7 +13,7 @@ trim_trailing_whitespace = true insert_final_newline = true [*.py] -max_line_length = 119 +max_line_length = 80 indent_size = 2 [*.md] diff --git a/microservices/backend/.gitignore b/microservices/backend/.gitignore new file mode 100644 index 0000000..5c0dc28 --- /dev/null +++ b/microservices/backend/.gitignore @@ -0,0 +1,7 @@ +__pycache__ +*.pyc +.mypy_cache +.coverage +htmlcov +.cache +.venv diff --git a/microservices/backend/app/api/routes/private.py b/microservices/backend/app/api/routes/private.py index 9f33ef1..600cf12 100644 --- a/microservices/backend/app/api/routes/private.py +++ b/microservices/backend/app/api/routes/private.py @@ -20,6 +20,11 @@ class PrivateUserCreate(BaseModel): is_verified: bool = False +@router.get("/") +def read_root(): + return {"message": "Hello from FastAPI"} + + @router.post("/users/", response_model=UserPublic) def create_user(user_in: PrivateUserCreate, session: SessionDep) -> Any: """ diff --git a/microservices/backend/compose.override.yaml b/microservices/backend/compose.override.yaml index 089df5b..a58e46f 100644 --- a/microservices/backend/compose.override.yaml +++ b/microservices/backend/compose.override.yaml @@ -5,10 +5,15 @@ services: ports: - "5432:5432" - adminer: + # adminer: + # restart: "no" + # ports: + # - "8080:8080" + + pgadmin: restart: "no" ports: - - "8080:8080" + - "5050:80" backend: restart: "no" @@ -59,5 +64,5 @@ services: # - MAILTRAP_PASSWORD=password -volumes: - maildata: +# volumes: +# maildata: diff --git a/microservices/backend/compose.yml b/microservices/backend/compose.yml index 1fdca40..3e2655d 100644 --- a/microservices/backend/compose.yml +++ b/microservices/backend/compose.yml @@ -19,18 +19,35 @@ services: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set} - POSTGRES_USER=${POSTGRES_USER?Variable not set} - POSTGRES_DB=${POSTGRES_DB?Variable not set} - # - POSTGRES_INITDB_ARGS=${POSTGRES_INITDB_ARGS} - adminer: - image: adminer + # adminer: + # image: adminer + # restart: always + # networks: + # # - traefik-public + # - default + # depends_on: + # - db + # environment: + # - ADMINER_DESIGN=pepa-linha-dark + + pgadmin: + image: dpage/pgadmin4:latest + container_name: pgadmin4_container restart: always networks: # - traefik-public - default depends_on: - - db + db: + condition: service_healthy + restart: true environment: - - ADMINER_DESIGN=pepa-linha-dark + - PGADMIN_DEFAULT_EMAIL=${PGADMIN_MAIL} + - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PW} + volumes: + - pgadmin-data:/var/lib/pgadmin + prestart: # image: '${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG-latest}' @@ -109,5 +126,17 @@ services: context: . dockerfile: Dockerfile + + # nginx-reverse-proxy: + # image: nginx:latest + # ports: + # - 8080:8080 + # volumes: + # - ./nginx_config.conf:/etc/nginx/conf.d/default.conf + # depends_on: + # - team-service + # - pokemon-service + volumes: app-db-data: + pgadmin-data: