AUTH_CMD to USER_CMD, updated workflows, Makefile, and docker-compose for user service

This commit is contained in:
A'zamov Samandar
2025-04-19 19:24:18 +05:00
parent 098dce9fdb
commit bc24faeedd
126 changed files with 30 additions and 32 deletions

View File

@@ -1,2 +1,2 @@
AUTH_COMMAND=sh ./resources/scripts/entrypoint.sh USER_COMMAND=sh ./resources/scripts/entrypoint.sh
JWT_KEY=key JWT_KEY=key

View File

@@ -16,10 +16,10 @@ jobs:
- name: 📥 Secret orqali .env fayl yaratish - name: 📥 Secret orqali .env fayl yaratish
run: | run: |
echo "${{ secrets.BASE_ENV_FILE }}" > .env echo "${{ secrets.BASE_ENV_FILE }}" > .env
echo "${{ secrets.AUTH_ENV_FILE }}" > ./auth/.env echo "${{ secrets.USER_ENV_FILE }}" > ./user/.env
- name: 🛠 Docker Compose bilan build & deploy - name: 🛠 Docker Compose bilan build & deploy
run: | run: |
docker compose --profile auth --profile payment build docker compose --profile user --profile payment build
docker compose down docker compose down
docker compose --profile auth --profile payment up -d docker compose --profile user --profile payment up -d

View File

@@ -1,12 +1,10 @@
up-auth: up-user:
docker compose --profile auth up -d docker compose --profile user up -d
down-user:
down-auth: docker compose --profile user down
docker compose --profile auth down
up-payment: up-payment:
docker compose --profile payment up -d docker compose --profile payment up -d
down-payment: down-payment:
docker compose --profile payment down docker compose --profile payment down
down-all: down-all:
docker compose --profile payment --profile auth down docker compose --profile payment --profile user down

View File

@@ -21,46 +21,46 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock:ro" - "/var/run/docker.sock:/var/run/docker.sock:ro"
networks: networks:
- lamenu - lamenu
auth-nginx: user-nginx:
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.auth.rule=PathPrefix(`/auth`)" - "traefik.http.routers.user.rule=PathPrefix(`/user`)"
- "traefik.http.routers.auth.entrypoints=web" - "traefik.http.routers.user.entrypoints=web"
- "traefik.http.services.auth.loadbalancer.server.port=80" - "traefik.http.services.user.loadbalancer.server.port=80"
- "traefik.http.middlewares.auth-strip-prefix.stripPrefix.prefixes=/auth" - "traefik.http.middlewares.user-strip-prefix.stripPrefix.prefixes=/user"
- "traefik.http.routers.auth.middlewares=auth-strip-prefix" - "traefik.http.routers.user.middlewares=user-strip-prefix"
networks: networks:
- lamenu - lamenu
volumes: volumes:
- ./auth/resources/layout/nginx.conf:/etc/nginx/nginx.conf - ./user/resources/layout/nginx.conf:/etc/nginx/nginx.conf
- ./auth/resources/:/usr/share/nginx/html/resources/ - ./user/resources/:/usr/share/nginx/html/resources/
build: build:
context: ./auth context: ./user
dockerfile: ./docker/Dockerfile.nginx dockerfile: ./docker/Dockerfile.nginx
depends_on: depends_on:
- auth - user
profiles: profiles:
- auth - user
auth: user:
networks: networks:
- lamenu - lamenu
build: build:
context: ./auth context: ./user
dockerfile: ./docker/Dockerfile.web dockerfile: ./docker/Dockerfile.web
restart: always restart: always
command: ${AUTH_COMMAND:-sh ./resources/scripts/entrypoint.sh} command: ${user_COMMAND:-sh ./resources/scripts/entrypoint.sh}
environment: environment:
- PYTHONPYCACHEPREFIX=/var/cache/pycache - PYTHONPYCACHEPREFIX=/var/cache/pycache
- JWT_KEY=${JWT_KEY} - JWT_KEY=${JWT_KEY}
volumes: volumes:
- ./auth:/code - ./user:/code
- pycache:/var/cache/pycache - pycache:/var/cache/pycache
depends_on: depends_on:
- auth-db - user-db
- redis - redis
profiles: profiles:
- auth - user
auth-db: user-db:
networks: networks:
- lamenu - lamenu
image: postgres:16 image: postgres:16
@@ -72,7 +72,7 @@ services:
volumes: volumes:
- pg_data:/var/lib/postgresql/data - pg_data:/var/lib/postgresql/data
profiles: profiles:
- auth - user
payment: payment:
labels: labels:

View File

View File

@@ -29,14 +29,14 @@ http {
server_name _; server_name _;
location / { location / {
proxy_pass http://auth:8000; proxy_pass http://user:8000;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
} }
location /ws/ { location /ws/ {
proxy_pass http://auth:8000; # Uvicorn serveri ishga tushadigan port proxy_pass http://user:8000; # Uvicorn serveri ishga tushadigan port
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade'; proxy_set_header Connection 'upgrade';

Some files were not shown because too many files have changed in this diff Show More