From 863cbd9ec9cf5cb8a6f0935c603abec9b53aa216 Mon Sep 17 00:00:00 2001 From: Amirhossein Khalili Date: Fri, 22 May 2026 00:30:11 +0330 Subject: [PATCH] feat(proxy): add proxy service for google oauth connection --- backend/Dockerfile | 6 +-- docker-compose.yml | 128 +++++++++++++++++++++++++++------------------ 2 files changed, 79 insertions(+), 55 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index b127b6e..e55e593 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -25,9 +25,9 @@ RUN apt-get update \ COPY requirements/ /app/requirements/ -RUN pip install --no-cache-dir --upgrade pip setuptools wheel \ - && pip install --no-cache-dir -r requirements/base.txt \ - && pip install --no-cache-dir -r requirements/prod.txt +RUN pip install --no-cache-dir --upgrade pip setuptools wheel -i https://package-mirror.liara.ir/repository/pypi/simple \ + && pip install --no-cache-dir -r requirements/base.txt -i https://package-mirror.liara.ir/repository/pypi/simple \ + && pip install --no-cache-dir -r requirements/prod.txt -i https://package-mirror.liara.ir/repository/pypi/simple COPY . . diff --git a/docker-compose.yml b/docker-compose.yml index 606d143..b1db61f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,32 +1,47 @@ -services: - db: - image: postgres:18-alpine - restart: always - env_file: - - ./backend/qlockify-backend-deployment/.env - volumes: - - postgres_data:/var/lib/postgresql - - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql - command: postgres - healthcheck: - test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] - interval: 10s - timeout: 5s - retries: 5 - ports: - - "127.0.0.1:5432:5432" # Bound to localhost for security (as in old project) - - redis: - image: redis:7-alpine - restart: always - ports: - - "127.0.0.1:6379:6379" - +services: + proxy: + build: + context: ../proxy + dockerfile: Dockerfile + restart: unless-stopped + expose: + - "8085" + volumes: + - ../proxy/config.json:/app/config.json:ro + - ../proxy/ca:/app/ca + environment: + PYTHONUNBUFFERED: "1" + PROXY_HOST: "0.0.0.0" + PROXY_PORT: "8085" + + db: + image: postgres:18-alpine + restart: always + env_file: + - ./backend/qlockify-backend-deployment/.env + volumes: + - postgres_data:/var/lib/postgresql + - ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql + command: postgres + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 10s + timeout: 5s + retries: 5 + ports: + - "127.0.0.1:5432:5432" # Bound to localhost for security (as in old project) + + redis: + image: redis:7-alpine + restart: always + ports: + - "127.0.0.1:6379:6379" + backend: - build: - context: ./backend/qlockify-backend-deployment - dockerfile: ../Dockerfile - restart: always + build: + context: ./backend/qlockify-backend-deployment + dockerfile: ../Dockerfile + restart: always env_file: - ./backend/qlockify-backend-deployment/.env volumes: @@ -42,27 +57,36 @@ services: --threads 8 --timeout 120 --keep-alive 75" - expose: - - "8000" - depends_on: - db: - condition: service_healthy - redis: - condition: service_started - + expose: + - "8000" + depends_on: + db: + condition: service_healthy + redis: + condition: service_started + proxy: + condition: service_started + environment: + HTTP_PROXY: "http://proxy:8085" + HTTPS_PROXY: "http://proxy:8085" + http_proxy: "http://proxy:8085" + https_proxy: "http://proxy:8085" + NO_PROXY: "localhost,127.0.0.1,db,redis,proxy" + no_proxy: "localhost,127.0.0.1,db,redis,proxy" + celery: build: context: ./backend/qlockify-backend-deployment dockerfile: ../Dockerfile - restart: always + restart: always env_file: - ./backend/qlockify-backend-deployment/.env volumes: - media_data:/app/media - command: celery -A config worker -l INFO - depends_on: - db: - condition: service_healthy + command: celery -A config worker -l INFO + depends_on: + db: + condition: service_healthy redis: condition: service_started backend: @@ -89,13 +113,13 @@ services: frontend: build: context: ./frontend/qlockify-frontend-deployment - dockerfile: ../Dockerfile - restart: always - env_file: - - ./frontend/qlockify-frontend-deployment/.env - expose: - - "80" - + dockerfile: ../Dockerfile + restart: always + env_file: + - ./frontend/qlockify-frontend-deployment/.env + expose: + - "80" + nginx: image: nginx:alpine restart: always @@ -108,10 +132,10 @@ services: - ./nginx/.htpasswd:/etc/nginx/.htpasswd:ro - static_data:/usr/share/nginx/html/static:ro - media_data:/usr/share/nginx/html/media:ro - depends_on: - - backend - - frontend - + depends_on: + - backend + - frontend + volumes: postgres_data: static_data: