add configuration files and update docker-compose for hydra and redis services
This commit is contained in:
2
config/back/.env.example
Normal file
2
config/back/.env.example
Normal file
@ -0,0 +1,2 @@
|
||||
REDIS_PASSWORD=
|
||||
HYDRA_PASSWORD=
|
||||
10
config/back/config.yaml
Normal file
10
config/back/config.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
app:
|
||||
port: 8080
|
||||
|
||||
redis:
|
||||
host: redis
|
||||
port: 6379
|
||||
db: 0
|
||||
|
||||
hydra:
|
||||
host: https://oauth2.logidex.ru/admin
|
||||
1
config/hydra/.env
Normal file
1
config/hydra/.env
Normal file
@ -0,0 +1 @@
|
||||
DSN=postgres://postgres:postgres@db:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
|
||||
@ -4,12 +4,12 @@ serve:
|
||||
|
||||
urls:
|
||||
self:
|
||||
issuer: http://oauth2.logidex.ru
|
||||
public: http://oauth2.logidex.ru
|
||||
admin: http://oauth2.logidex.ru
|
||||
consent: http://id.logidex.ru/consent
|
||||
login: http://id.logidex.ru/
|
||||
logout: http://id.logidex.ru/logout
|
||||
issuer: https://oauth2.logidex.ru
|
||||
public: https://oauth2.logidex.ru
|
||||
admin: https://oauth2.logidex.ru
|
||||
consent: https://id.logidex.ru/consent
|
||||
login: https://id.logidex.ru/login
|
||||
logout: https://id.logidex.ru/logout
|
||||
|
||||
strategies:
|
||||
access_token: jwt
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
upstream hydra_public_api {
|
||||
server hydra:4444;
|
||||
server hydra:4444;
|
||||
}
|
||||
upstream hydra_admin_api {
|
||||
server hydra:4445;
|
||||
server hydra:4445;
|
||||
}
|
||||
upstream frontend {
|
||||
server front:3000;
|
||||
server front:3000;
|
||||
}
|
||||
|
||||
upstream backend {
|
||||
server back:8080;
|
||||
}
|
||||
|
||||
server {
|
||||
@ -51,6 +52,15 @@ server {
|
||||
listen 80;
|
||||
server_name id.logidex.ru;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://backend/api/; # Replace with your backend API URL
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://frontend;
|
||||
proxy_set_header Host $http_host;
|
||||
@ -58,4 +68,12 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
location /_next/webpack-hmr {
|
||||
proxy_pass http://frontend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,8 +10,8 @@ services:
|
||||
target: /etc/config/hydra
|
||||
networks:
|
||||
- appnet
|
||||
environment:
|
||||
- DSN=postgres://postgres:GjitkeYf%5Beq@172.17.0.1:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
|
||||
env_file:
|
||||
- ./config/hydra/.env
|
||||
hydra-migrate:
|
||||
image: oryd/hydra:v2.3.0
|
||||
command: migrate -c /etc/config/hydra/hydra.yml sql up -e --yes
|
||||
@ -21,28 +21,75 @@ services:
|
||||
target: /etc/config/hydra
|
||||
networks:
|
||||
- appnet
|
||||
environment:
|
||||
- DSN=postgres://postgres:GjitkeYf%5Beq@172.17.0.1:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
|
||||
env_file:
|
||||
- ./config/hydra/.env
|
||||
|
||||
depends_on:
|
||||
- db
|
||||
nginx:
|
||||
container_name: "logidexid"
|
||||
image: nginx:latest
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./config/nginx/nginx.conf
|
||||
target: /etc/nginx/conf.d/default.conf
|
||||
read_only: true
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
depends_on:
|
||||
- hydra
|
||||
- front
|
||||
- back
|
||||
- hydra
|
||||
networks:
|
||||
- appnet
|
||||
ports:
|
||||
- "80:80"
|
||||
front:
|
||||
image: git.logidex.ru/aserbin/logidex-id-frontend:latest
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
networks:
|
||||
- appnet
|
||||
back:
|
||||
image: git.logidex.ru/fakz9/id-backend:latest
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- appnet
|
||||
volumes:
|
||||
- ./config/back/.env:/app/.env
|
||||
- ./config/back/config.yaml:/app/config.yaml
|
||||
redis:
|
||||
image: redis
|
||||
command: [ "redis-server", "--save", "60", "1", "--appendonly", "no" ]
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- appnet
|
||||
healthcheck:
|
||||
test: [ "CMD" ,"redis-cli", "ping" ]
|
||||
interval: 5s
|
||||
timeout: 2s
|
||||
retries: 5
|
||||
db:
|
||||
image: postgres:17-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: hydra
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data
|
||||
networks:
|
||||
- appnet
|
||||
networks:
|
||||
appnet:
|
||||
appnet:
|
||||
external: false
|
||||
# proxy:
|
||||
# external: true
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
db:
|
||||
driver: local
|
||||
|
||||
28
traefik.yml
Normal file
28
traefik.yml
Normal file
@ -0,0 +1,28 @@
|
||||
http:
|
||||
routers:
|
||||
id-app:
|
||||
rule: "Host(`id.logidex.ru`)"
|
||||
entryPoints:
|
||||
- websecure
|
||||
service: id-app
|
||||
tls:
|
||||
certResolver: default
|
||||
|
||||
oauth2-app:
|
||||
rule: "Host(`oauth2.logidex.ru`)"
|
||||
entryPoints:
|
||||
- websecure
|
||||
service: oauth2-app
|
||||
tls:
|
||||
certResolver: default
|
||||
|
||||
services:
|
||||
id-app:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://logidexid:80" # имя контейнера с NGINX внутри
|
||||
|
||||
oauth2-app:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://logidexid:80" # имя контейнера с NGINX внутри
|
||||
Reference in New Issue
Block a user