一拖四compose
services:
mx:
container_name: mx-server
image: innei/mx-server:latest
environment:
- TZ=Asia/Shanghai
- NODE_ENV=production
- DB_HOST=mongo
- REDIS_HOST=redis
- ALLOWED_ORIGINS=https://dsuk.top
- JWT_SECRET=1111111111111111111111
volumes:
- ./mx-space:/root/.mx-space
ports:
- '2333:2333'
depends_on:
- mongo
- redis
networks:
- mx-space
restart: unless-stopped
healthcheck:
test: [CMD, curl, -f, 'http://127.0.0.1:2333/api/v2/ping']
interval: 1m30s
timeout: 30s
retries: 5
start_period: 30s
mongo:
container_name: mongo
image: mongo:latest
volumes:
- mongo_data:/data/db
networks:
- mx-space
restart: unless-stopped
redis:
image: redis:alpine
container_name: redis
volumes:
- redis_data:/data
healthcheck:
test: [CMD-SHELL, 'redis-cli ping | grep PONG']
start_period: 20s
interval: 30s
retries: 5
timeout: 3s
networks:
- mx-space
restart: unless-stopped
shiro:
container_name: shiro
image: ghcr.io/iwvw/shiro:main
volumes:
- ./.env:/app/.env
- ./public:/app/public
restart: always
environment:
- NEXT_SHARP_PATH=/usr/local/lib/node_modules/sharp
ports:
- 2323:2323
networks:
- mx-space
networks:
mx-space:
driver: bridge
volumes:
mongo_data:
driver: local
redis_data:
driver: local
Copy
反向代理
## 反向代理开始,直接复制官方文档的
## WebSocket 地址
location /socket.io {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:2333/socket.io;
}
## API 地址
location /api/v2 {
proxy_pass http://127.0.0.1:2333/api/v2;
}
## 简读 render 地址
location /render {
proxy_pass http://127.0.0.1:2333/render;
}
## 前端地址
location / {
proxy_pass http://127.0.0.1:2323;
}
## 后台地址
location /proxy {
proxy_pass http://127.0.0.1:2333/proxy;
}
location /qaqdmin {
proxy_pass http://127.0.0.1:2333/proxy/qaqdmin;
}
## RSS 地址
location ~* \/(feed|sitemap|atom.xml) {
proxy_pass http://127.0.0.1:2333/$1;
}
## 反向代理结束
add_header Access-Control-Allow-Origin *,127.0.0.1:* always;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS,PUT,DELETE always;
if ( $request_method = 'OPTIONS' ) {
return 204;
}
Copy
env
NEXT_PUBLIC_API_URL=http://127.0.0.1:2333/api/v2
NEXT_PUBLIC_GATEWAY_URL=http://127.0.0.1:2333/
NEXT_PUBLIC_API_URL=https://dsuk.top/api/v2
NEXT_PUBLIC_GATEWAY_URL=https://dsuk.top
Copy