大修改

This commit is contained in:
Yeomai committed 2026-09-30 03:38:10 +08:00
1 parent a1cbc9404a
commit e81481623c
47 files changed
+1453 -285

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
# Copy this file to deploy.config.ps1 and fill in your own values.
# deploy.config.ps1 is gitignored, so your server address stays out of the repo.
$Config = @{
# ---- SSH ----
Host = '1.2.3.4' # server IP or domain
Port = 22
User = 'root'
# Node bin directory on the server (prepended to PATH during the remote build).
# Find it in BT Panel -> Node version manager, e.g. /www/server/nodejs/v22.14.0/bin
NodeBin = '/www/server/nodejs/v22/bin'
# ---- Nginx proxy cache ----
# BT Panel enables `proxy_cache cache_one` globally in
# /www/server/nginx/conf/proxy.conf, while Next.js answers with
# `Cache-Control: s-maxage=31536000` — i.e. "this page may be cached for a year".
# Nginx obeys, so a fresh build is never served; the cached HTML references chunks
# that the new build already removed (404), and the page breaks halfway through.
# deploy.ps1 clears this directory and reloads Nginx after every deploy.
# Leave NginxCacheDir empty ('') to skip that step.
NginxCacheDir = '/www/server/nginx/proxy_cache_dir'
NginxBin = '/www/server/nginx/sbin/nginx'
# ---- yelaymaths_api ----
Api = @{
Key = 'api'
Label = 'yelaymaths_api (server API)'
LocalPath = 'yelaymaths_api'
RemotePath = '/www/wwwroot/yelaymaths/yelaymaths_api'
DeployPaths = @(
'src', 'prisma', 'tools',
'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml',
'tsconfig.json', 'tsconfig.build.json', 'nest-cli.json',
'.env.example'
)
InstallCmd = 'pnpm install --frozen-lockfile'
BuildCmd = 'pnpm build'
# Restart command. Run `pm2 list` on the server to find the process name.
# Leave empty ('') if you restart the process some other way.
RestartCmd = 'pm2 restart yelaymaths-api'
# Start command. Used when killing the old process is not enough
# (BT Panel does not bring it back automatically). setsid + nohup keeps
# the process alive after the SSH session ends. Leave empty to skip.
# `node` resolves through the NodeBin PATH exported by the remote script.
StartCmd = 'setsid nohup node dist/main.js >> /www/wwwlogs/yelaymaths-api.out.log 2>&1 < /dev/null &'
# Probe after start. The deploy fails if this URL does not answer in 30s.
HealthUrl = 'http://127.0.0.1:3002/healthz'
}
# ---- yelaymaths_admin ----
# NOTE: NEXT_PUBLIC_* values are inlined at build time, so .env.local must already
# exist on the server before the first deploy. It is never uploaded (it is gitignored
# and not in the whitelist).
Admin = @{
Key = 'admin'
Label = 'yelaymaths_admin (admin console)'
LocalPath = 'yelaymaths_admin'
RemotePath = '/www/wwwroot/yelaymaths/yelaymaths_admin'
DeployPaths = @(
'src',
'package.json', 'pnpm-lock.yaml',
'tsconfig.json', 'next.config.ts', 'postcss.config.mjs'
)
InstallCmd = 'pnpm install --frozen-lockfile'
BuildCmd = 'pnpm build'
RestartCmd = 'pm2 restart yelaymaths-admin'
StartCmd = 'setsid nohup node node_modules/next/dist/bin/next start -p 3001 >> /www/wwwlogs/yelaymaths-admin.out.log 2>&1 < /dev/null &'
HealthUrl = 'http://127.0.0.1:3001/'
}
}