feat: UAT environment setup with separate PocketBase instance
- Add UAT PocketBase on port 8712 with separate pb_data_uat - Add UAT nginx config proxying to UAT PB (port 8712) - Update Dockerfile to support NGINX_CONF build arg - Add .gitignore for .playwright-mcp/ - Auto-generated team_sessions migration Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -35,4 +35,4 @@ backend/pb_migrations.bak/
|
|||||||
|
|
||||||
# Temporary files
|
# Temporary files
|
||||||
*.tmp
|
*.tmp
|
||||||
.cache/
|
.cache/.playwright-mcp/
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/// <reference path="../pb_data/types.d.ts" />
|
||||||
|
migrate((db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("sac8t6o9rspld8p")
|
||||||
|
|
||||||
|
collection.listRule = "@request.auth.id != \"\""
|
||||||
|
collection.viewRule = "@request.auth.id != \"\""
|
||||||
|
collection.updateRule = "@request.auth.id != \"\""
|
||||||
|
collection.deleteRule = "@request.auth.id != \"\""
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
}, (db) => {
|
||||||
|
const dao = new Dao(db)
|
||||||
|
const collection = dao.findCollectionByNameOrId("sac8t6o9rspld8p")
|
||||||
|
|
||||||
|
collection.listRule = "sourceGroup.owner = @request.auth.id || sourceGroup.members.id = @request.auth.id"
|
||||||
|
collection.viewRule = "sourceGroup.owner = @request.auth.id || sourceGroup.members.id = @request.auth.id"
|
||||||
|
collection.updateRule = "sourceGroup.owner = @request.auth.id"
|
||||||
|
collection.deleteRule = "sourceGroup.owner = @request.auth.id"
|
||||||
|
|
||||||
|
return dao.saveCollection(collection)
|
||||||
|
})
|
||||||
@@ -1,14 +1,39 @@
|
|||||||
services:
|
services:
|
||||||
|
pocketbase-uat:
|
||||||
|
image: ghcr.io/muchobien/pocketbase:0.22.4
|
||||||
|
container_name: gamegroup-pb-uat
|
||||||
|
ports:
|
||||||
|
- "8712:8090"
|
||||||
|
volumes:
|
||||||
|
- ./backend/pb_data_uat:/pb_data
|
||||||
|
- ./backend/pb_migrations:/pb_migrations
|
||||||
|
- ./backend/pb_hooks:/pb_hooks
|
||||||
|
environment:
|
||||||
|
- GO_ENV=production
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/api/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 40s
|
||||||
|
networks:
|
||||||
|
- gamegroup-net
|
||||||
|
|
||||||
frontend-uat:
|
frontend-uat:
|
||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
NGINX_CONF: nginx.uat.conf
|
||||||
container_name: gamegroup-frontend-uat
|
container_name: gamegroup-frontend-uat
|
||||||
ports:
|
ports:
|
||||||
- "7034:80"
|
- "7034:80"
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- pocketbase-uat
|
||||||
networks:
|
networks:
|
||||||
- gamegroup-net
|
- gamegroup-net
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -22,8 +22,9 @@ FROM nginx:alpine
|
|||||||
# 复制构建产物
|
# 复制构建产物
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# 复制 nginx 配置
|
# 通过 NGINX_CONF 参数选择配置文件(默认 dev)
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
ARG NGINX_CONF=nginx.conf
|
||||||
|
COPY ${NGINX_CONF} /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# 开启 gzip 压缩
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
|
add_header Pragma "no-cache";
|
||||||
|
add_header Expires "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
# SSE realtime 连接(必须在 /api/ 之前)
|
||||||
|
location /api/realtime {
|
||||||
|
proxy_pass http://192.168.1.14:8712;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection '';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_cache off;
|
||||||
|
proxy_read_timeout 86400s;
|
||||||
|
gzip off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# API 代理到局域网 PocketBase
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://192.168.1.14:8712;
|
||||||
|
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;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 静态资源缓存
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user