@aaricchen1991/deploy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/PUBLISHING.md +131 -0
  2. package/README.md +256 -0
  3. package/dist/cli.d.ts +6 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +95 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/init.d.ts +10 -0
  8. package/dist/commands/init.d.ts.map +1 -0
  9. package/dist/commands/init.js +104 -0
  10. package/dist/commands/init.js.map +1 -0
  11. package/dist/commands/nginx.d.ts +10 -0
  12. package/dist/commands/nginx.d.ts.map +1 -0
  13. package/dist/commands/nginx.js +70 -0
  14. package/dist/commands/nginx.js.map +1 -0
  15. package/dist/commands/ssl-logs.d.ts +17 -0
  16. package/dist/commands/ssl-logs.d.ts.map +1 -0
  17. package/dist/commands/ssl-logs.js +54 -0
  18. package/dist/commands/ssl-logs.js.map +1 -0
  19. package/dist/commands/ssl.d.ts +16 -0
  20. package/dist/commands/ssl.d.ts.map +1 -0
  21. package/dist/commands/ssl.js +98 -0
  22. package/dist/commands/ssl.js.map +1 -0
  23. package/dist/lib/domains.d.ts +22 -0
  24. package/dist/lib/domains.d.ts.map +1 -0
  25. package/dist/lib/domains.js +70 -0
  26. package/dist/lib/domains.js.map +1 -0
  27. package/dist/lib/logger.d.ts +14 -0
  28. package/dist/lib/logger.d.ts.map +1 -0
  29. package/dist/lib/logger.js +60 -0
  30. package/dist/lib/logger.js.map +1 -0
  31. package/dist/lib/nginx.d.ts +6 -0
  32. package/dist/lib/nginx.d.ts.map +1 -0
  33. package/dist/lib/nginx.js +113 -0
  34. package/dist/lib/nginx.js.map +1 -0
  35. package/dist/lib/paths.d.ts +8 -0
  36. package/dist/lib/paths.d.ts.map +1 -0
  37. package/dist/lib/paths.js +28 -0
  38. package/dist/lib/paths.js.map +1 -0
  39. package/package.json +24 -0
  40. package/src/cli.ts +122 -0
  41. package/src/commands/init.ts +127 -0
  42. package/src/commands/nginx.ts +82 -0
  43. package/src/commands/ssl-logs.ts +80 -0
  44. package/src/commands/ssl.ts +140 -0
  45. package/src/lib/domains.ts +77 -0
  46. package/src/lib/logger.ts +79 -0
  47. package/src/lib/nginx.ts +120 -0
  48. package/src/lib/paths.ts +30 -0
  49. package/tsconfig.json +19 -0
package/PUBLISHING.md ADDED
@@ -0,0 +1,131 @@
1
+ # 发布 @aaricchen1991/deploy 到 npm
2
+
3
+ 本文说明如何将 `@aaricchen1991/deploy` 包发布到 npm,以便用户通过 `npx @aaricchen1991/deploy` 使用。
4
+
5
+ ## 前置条件
6
+
7
+ 1. **npm 账号**
8
+ 在 [npmjs.com](https://www.npmjs.com/) 注册并登录。
9
+
10
+ 2. **@aaricchen1991 命名空间**
11
+ - 包名为 `@aaricchen1991/deploy`,使用 npm 用户名(或组织)`aaricchen1991` 作为 scope。个人包无需创建 Organization,使用当前登录账号即可发布到 `@aaricchen1991`。
12
+
13
+ 3. **登录 npm**
14
+ ```bash
15
+ npm login
16
+ ```
17
+ 按提示输入用户名、密码与邮箱/OTP。
18
+
19
+ 4. **双因素认证(2FA)或 Granular Access Token**
20
+ npm 要求发布包时必须满足其一:
21
+ - **启用账号 2FA**:在 [npm 账号设置](https://www.npmjs.com/settings/~aaricchen1991/account) 中开启 Two-Factor Authentication,发布时 `npm publish` 会提示输入 OTP。
22
+ - **使用 Granular Access Token(适合 CI/脚本)**:在 [Access Tokens](https://www.npmjs.com/settings/~aaricchen1991/tokens) 创建 Token,权限勾选 **Publish packages**,若需在无 2FA 环境下发布可勾选 **Bypass 2FA for publish**;发布时用 `npm config set //registry.npmjs.org/:_authToken YOUR_TOKEN` 或环境变量 `NPM_TOKEN`。
23
+
24
+ 若未满足,会报错:`403 Forbidden - Two-factor authentication or granular access token with bypass 2fa enabled is required to publish packages`。
25
+
26
+ ## 发布前准备
27
+
28
+ ### 1. 开放发布(当前为 private)
29
+
30
+ 仓库内 `package.json` 中通常为 `"private": true`,避免误发到 npm。发布前需改为可发布:
31
+
32
+ - **方式 A**:临时改为 `"private": false` 再执行 `npm publish`,发布后可改回 `true`。
33
+ - **方式 B**:在 CI 或本地发布脚本里用 `npm pkg set private=false` 再 publish,不提交该改动。
34
+
35
+ ### 2. 控制发布内容(推荐)
36
+
37
+ 在 `apps/deploy/package.json` 中增加 `files` 字段,只发布构建产物和必要文件,避免把源码、测试、配置等发到 npm:
38
+
39
+ ```json
40
+ {
41
+ "name": "@aaricchen1991/deploy",
42
+ "version": "0.1.0",
43
+ "files": ["dist", "README.md"]
44
+ }
45
+ ```
46
+
47
+ 未设置 `files` 时,npm 会按 `.npmignore` 或默认规则排除;设置后仅包含列出的文件/目录。
48
+
49
+ ### 3. 构建
50
+
51
+ 在仓库根目录或 `apps/deploy` 目录下执行:
52
+
53
+ ```bash
54
+ # 在仓库根目录
55
+ pnpm --filter @aaricchen1991/deploy build
56
+
57
+ # 或在 apps/deploy 下
58
+ cd apps/deploy && pnpm build
59
+ ```
60
+
61
+ 确认 `apps/deploy/dist/` 下已生成 `cli.js` 及依赖的 `.js` 等文件。
62
+
63
+ ## 发布命令
64
+
65
+ ### 在 monorepo 根目录发布指定包
66
+
67
+ ```bash
68
+ # 从仓库根目录发布 apps/deploy
69
+ npm publish apps/deploy --access public
70
+ ```
71
+
72
+ - `--access public`:作用域包(如 `@aaricchen1991/deploy`)默认视为 restricted,需显式指定 `public` 才能被所有人安装。
73
+
74
+ ### 进入包目录再发布
75
+
76
+ ```bash
77
+ cd apps/deploy
78
+ pnpm build
79
+ npm pkg set private=false
80
+ npm publish --access public
81
+ # 如需保持仓库不发布,可再改回:npm pkg set private=true
82
+ ```
83
+
84
+ ## 版本号
85
+
86
+ - 遵循 [语义化版本](https://semver.org/lang/zh-CN/)(如 `0.1.0`、`1.0.0`)。
87
+ - 修改版本号:
88
+ ```bash
89
+ cd apps/deploy
90
+ npm version patch # 0.1.0 -> 0.1.1
91
+ npm version minor # 0.1.0 -> 0.2.0
92
+ npm version major # 0.1.0 -> 1.0.0
93
+ ```
94
+ 会同时改 `package.json` 的 `version` 并产生一次 git commit + tag(若未加 `--no-git-tag-version`)。
95
+
96
+ ## 发布后使用方式
97
+
98
+ 用户可这样使用已发布的包:
99
+
100
+ ```bash
101
+ # 直接执行(不安装到本地)
102
+ npx @aaricchen1991/deploy --help
103
+ npx @aaricchen1991/deploy init --config domains.yaml
104
+
105
+ # 全局安装后使用命令 n2-deploy
106
+ npm install -g @aaricchen1991/deploy
107
+ n2-deploy init --config domains.yaml
108
+ ```
109
+
110
+ ## 可选:发布前检查清单
111
+
112
+ - [ ] 已执行 `pnpm --filter @aaricchen1991/deploy build`,且 `dist/` 内容正确
113
+ - [ ] `package.json` 中 `version` 已更新,且未带 `-dev` 等后缀(除非发 beta)
114
+ - [ ] 已设置 `files` 或通过 `.npmignore` 控制发布内容
115
+ - [ ] 已 `npm login`,且有权限发布到 `@aaricchen1991` 作用域
116
+ - [ ] 使用 `npm publish --access public`(针对作用域包)
117
+ - [ ] 发布后可用 `npx @aaricchen1991/deploy --version` 校验版本
118
+
119
+ ## 常见问题
120
+
121
+ **Q: 提示 "You must sign up for private packages"**
122
+ A: 作用域包默认视为私有,需加 `--access public` 发布为公开包。
123
+
124
+ **Q: 403 Forbidden**
125
+ A: 检查是否已登录、是否有该组织/包的发布权限,以及包名是否与 npm 上已有包冲突。
126
+
127
+ **Q: 403 Forbidden - Two-factor authentication or granular access token with bypass 2fa enabled is required**
128
+ A: npm 要求发布时必须启用账号 2FA,或使用具有 “Bypass 2FA for publish” 的 Granular Access Token。请在 npm 网站 Account 中开启 2FA,或在 Tokens 中创建并选用上述 Token 后再执行 `npm publish`。
129
+
130
+ **Q: 发布后 npx 拉到的仍是旧版本**
131
+ A: 使用 `npx @aaricchen1991/deploy@latest` 或指定版本号 `npx @aaricchen1991/deploy@0.1.0`,并确认本地/缓存已更新。
package/README.md ADDED
@@ -0,0 +1,256 @@
1
+ # @aaricchen1991/deploy
2
+
3
+ 服务器部署与运维 CLI(包名 `@aaricchen1991/deploy`,命令 `n2-deploy`):服务器初始化、Nginx 配置生成、SSL 证书申请/续期及日志查看。设计为在**部署服务器上**执行(或从本机指定配置生成文件)。
4
+
5
+ ## 功能概览
6
+
7
+ | 命令 | 说明 |
8
+ | ---------- | ------------------------------------------------------------------------------------ |
9
+ | `init` | 服务器初始化(幂等):安装 Nginx、创建目录、安装 `deploy.sh`、占位证书。可重复执行。 |
10
+ | `nginx` | 根据域名配置文件生成 Nginx 配置;可选安装到系统并 reload。 |
11
+ | `ssl` | 为配置中的全部域名申请/续期 SSL 证书(acme.sh + 阿里云 DNS),并写入统一日志。 |
12
+ | `ssl-logs` | 查看 SSL 操作日志(创建、续期、成功、失败),支持行数、跟随、按动作/结果过滤。 |
13
+
14
+ ## 安装
15
+
16
+ ### 从本仓库使用
17
+
18
+ 在仓库根目录:
19
+
20
+ ```bash
21
+ pnpm install
22
+ pnpm --filter @aaricchen1991/deploy build
23
+ ```
24
+
25
+ 执行时需在**仓库根目录**或通过 `--config` 指定域名配置路径:
26
+
27
+ ```bash
28
+ node apps/deploy/dist/cli.js <command> [options]
29
+ ```
30
+
31
+ 或使用根目录脚本(会先构建再执行):
32
+
33
+ ```bash
34
+ pnpm run deploy:cli -- <command> [options]
35
+ ```
36
+
37
+ ### 发布为 npm 包后
38
+
39
+ ```bash
40
+ npx @aaricchen1991/deploy --help
41
+ ```
42
+
43
+ (安装后执行的命令仍为 `n2-deploy`,与包名 `@aaricchen1991/deploy` 对应。)
44
+
45
+ 如何将本包发布到 npm,见 [PUBLISHING.md](./PUBLISHING.md)。
46
+
47
+ ## 域名配置文件
48
+
49
+ 域名与端口以 **domains.yaml** 为唯一数据源,格式与仓库内 `scripts/deploy/domains.yaml` 一致:
50
+
51
+ ```yaml
52
+ api:
53
+ backend_port: 3000
54
+ domains:
55
+ - n2-api.example.com
56
+
57
+ admin:
58
+ domains:
59
+ - n2-admin.example.com
60
+
61
+ tenant:
62
+ domains:
63
+ - n2-tenant.example.com
64
+
65
+ client:
66
+ domains:
67
+ - n2-client.example.com
68
+ ```
69
+
70
+ - `api.backend_port`:API 后端端口(Nginx 反向代理目标)。
71
+ - 各应用的 `domains`:该应用对外提供服务的域名列表。
72
+
73
+ 默认读取当前工作目录下的 `domains.yaml`,可通过 `-c, --config <path>` 指定路径。
74
+
75
+ ---
76
+
77
+ ## 命令说明
78
+
79
+ ### init — 服务器初始化
80
+
81
+ 在部署服务器上执行(建议使用 root 或 sudo),完成:
82
+
83
+ - 检测系统(Alibaba Cloud Linux / CentOS / Ubuntu 等)并安装 Nginx(若未安装)
84
+ - 创建 `/var/www/{admin,tenant,client}`、`/opt/deploy`、`/etc/nginx/ssl` 等目录
85
+ - 将 `deploy.sh` 安装到 `/opt/deploy/`
86
+ - 根据 domains 配置生成占位 SSL 证书与 Nginx 配置并安装,使 Nginx 可正常启动
87
+
88
+ **用法:**
89
+
90
+ ```bash
91
+ n2-deploy init [options]
92
+ ```
93
+
94
+ | 选项 | 默认值 | 说明 |
95
+ | ---------------------- | -------------- | ----------------------------------------------------------- |
96
+ | `-c, --config <path>` | `domains.yaml` | 域名配置文件路径 |
97
+ | `--scripts-dir <path>` | 见下方 | 部署脚本目录(含 deploy.sh、server-setup.sh、ssl/_、lib/_) |
98
+
99
+ **脚本目录解析顺序:**
100
+
101
+ 1. 环境变量 `N2_DEPLOY_SCRIPTS_DIR`
102
+ 2. 当前目录下的 `scripts/deploy`(在仓库根目录执行时)
103
+ 3. 包内 `assets/deploy`(若存在)
104
+
105
+ **示例:**
106
+
107
+ ```bash
108
+ # 在仓库根目录执行
109
+ node apps/deploy/dist/cli.js init --config scripts/deploy/domains.yaml
110
+
111
+ # 指定脚本目录(例如在服务器上单独拷贝了脚本)
112
+ sudo n2-deploy init --config /etc/n2/domains.yaml --scripts-dir /opt/n2-scripts
113
+ ```
114
+
115
+ ---
116
+
117
+ ### nginx — 生成/安装 Nginx 配置
118
+
119
+ 根据 domains 配置生成 `n2.conf`(API 反向代理 + 各前端静态站点 + HTTP 跳 HTTPS),可仅生成文件或同时安装到系统并 reload。
120
+
121
+ **用法:**
122
+
123
+ ```bash
124
+ n2-deploy nginx [options]
125
+ ```
126
+
127
+ | 选项 | 默认值 | 说明 |
128
+ | --------------------- | --------------- | ------------------------------------------------------------------ |
129
+ | `-c, --config <path>` | `domains.yaml` | 域名配置文件路径 |
130
+ | `-o, --output <path>` | `nginx/n2.conf` | 生成的配置文件输出路径 |
131
+ | `-i, --install` | — | 安装到系统 Nginx 目录并执行 `nginx -t` 与 `systemctl reload nginx` |
132
+
133
+ **示例:**
134
+
135
+ ```bash
136
+ # 仅生成到当前目录
137
+ n2-deploy nginx --config scripts/deploy/domains.yaml --output ./n2.conf
138
+
139
+ # 生成并安装到系统(需在服务器上且有相应权限)
140
+ sudo n2-deploy nginx --config /etc/n2/domains.yaml --install
141
+ ```
142
+
143
+ ---
144
+
145
+ ### ssl — SSL 证书申请/续期
146
+
147
+ 为 domains 配置中的**所有域名**申请或续期证书(Let's Encrypt,通过 acme.sh + 阿里云 DNS API),安装到 `/etc/nginx/ssl/` 并触发 Nginx reload。所有操作会写入 SSL 专用日志,便于排查与审计。
148
+
149
+ **用法:**
150
+
151
+ ```bash
152
+ n2-deploy ssl [options]
153
+ ```
154
+
155
+ | 选项 | 默认值 | 说明 |
156
+ | ----------------------- | -------------------------- | ------------------------ |
157
+ | `-c, --config <path>` | `domains.yaml` | 域名配置文件路径 |
158
+ | `--ali-key <key>` | 环境变量 | 阿里云 Access Key ID |
159
+ | `--ali-secret <secret>` | 环境变量 | 阿里云 Access Key Secret |
160
+ | `--log-file <path>` | `/opt/deploy/logs/ssl.log` | SSL 日志文件路径 |
161
+ | `--scripts-dir <path>` | 同 init | 部署脚本目录 |
162
+
163
+ **凭证来源(按优先级):**
164
+ `--ali-key` / `--ali-secret` → 环境变量 `ALIYUN_ACCESS_KEY_ID` / `ALIYUN_ACCESS_KEY_SECRET` → 环境变量 `Ali_Key` / `Ali_Secret`。
165
+
166
+ **示例:**
167
+
168
+ ```bash
169
+ # 使用环境变量
170
+ export ALIYUN_ACCESS_KEY_ID="your_key"
171
+ export ALIYUN_ACCESS_KEY_SECRET="your_secret"
172
+ sudo n2-deploy ssl --config /etc/n2/domains.yaml
173
+
174
+ # 使用命令行参数(注意 shell 历史中可能暴露密钥)
175
+ sudo n2-deploy ssl --config scripts/deploy/domains.yaml \
176
+ --ali-key "your_key" --ali-secret "your_secret"
177
+ ```
178
+
179
+ **说明:**
180
+
181
+ - 首次使用前需在服务器上执行过 `init`,或已手动将 SSL 相关脚本安装到 `/opt/ssl/`(如 `check-and-setup-ssl.sh`)。
182
+ - 证书会安装到 `/etc/nginx/ssl/<domain>.crt` 与 `<domain>.key`,Nginx 配置中已引用该路径。
183
+ - 建议通过 cron 或 systemd timer 定期执行 `n2-deploy ssl` 以实现自动续期。
184
+
185
+ ---
186
+
187
+ ### ssl-logs — 查看 SSL 日志
188
+
189
+ 查看 SSL 操作日志(创建、续期、成功、失败等)。日志为文本格式,部分行为结构化行(制表符分隔:时间、类型、域名、结果、消息)。
190
+
191
+ **用法:**
192
+
193
+ ```bash
194
+ n2-deploy ssl-logs [options]
195
+ ```
196
+
197
+ | 选项 | 默认值 | 说明 |
198
+ | ------------------- | -------------------------- | -------------------------------------------------------------- |
199
+ | `--log-file <path>` | `/opt/deploy/logs/ssl.log` | SSL 日志文件路径 |
200
+ | `-n, --lines <n>` | `50` | 显示最后 N 行 |
201
+ | `-f, --follow` | — | 持续跟踪(等同 `tail -f`) |
202
+ | `--action <action>` | — | 按动作过滤:`create` / `renew` / `success` / `failure` / `run` |
203
+ | `--result <result>` | — | 按结果过滤:`ok` / `fail` |
204
+
205
+ **示例:**
206
+
207
+ ```bash
208
+ # 查看最后 50 行
209
+ n2-deploy ssl-logs
210
+
211
+ # 查看最后 200 行并只显示失败
212
+ n2-deploy ssl-logs --lines 200 --result fail
213
+
214
+ # 实时跟踪
215
+ n2-deploy ssl-logs --follow
216
+ ```
217
+
218
+ ---
219
+
220
+ ## 环境变量
221
+
222
+ | 变量 | 说明 |
223
+ | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
224
+ | `N2_DEPLOY_SCRIPTS_DIR` | 部署脚本根目录(含 deploy.sh、server-setup.sh、ssl/、lib/)。未设置时使用 `cwd/scripts/deploy` 或包内 assets。 |
225
+ | `ALIYUN_ACCESS_KEY_ID` / `Ali_Key` | 阿里云 Access Key ID(ssl 命令)。 |
226
+ | `ALIYUN_ACCESS_KEY_SECRET` / `Ali_Secret` | 阿里云 Access Key Secret(ssl 命令)。 |
227
+
228
+ ## 典型流程
229
+
230
+ 1. **首次部署服务器**
231
+ - 将本仓库或 `scripts/deploy` 拷贝到服务器(或设置 `N2_DEPLOY_SCRIPTS_DIR`)。
232
+ - 准备 `domains.yaml`(可放在 `/etc/n2/domains.yaml`)。
233
+ - 执行:`sudo n2-deploy init --config /etc/n2/domains.yaml`。
234
+ - 执行:`sudo n2-deploy ssl --config /etc/n2/domains.yaml` 并配置阿里云凭证。
235
+ - 之后由 CI 通过 SSH 执行 `/opt/deploy/deploy.sh` 完成应用部署。
236
+
237
+ 2. **仅更新 Nginx 配置(如新增域名)**
238
+ - 修改 `domains.yaml` 后执行:
239
+ `sudo n2-deploy nginx --config /etc/n2/domains.yaml --install`
240
+ - 若新增了域名,再执行一次 `n2-deploy ssl` 为新域名申请证书。
241
+
242
+ 3. **定期续期证书**
243
+ - 使用 cron:例如每月执行一次
244
+ `0 3 1 * * /usr/bin/n2-deploy ssl --config /etc/n2/domains.yaml`
245
+ - 或使用 systemd timer 调用同一命令。
246
+
247
+ 4. **排查 SSL 问题**
248
+ - `n2-deploy ssl-logs --result fail` 查看失败记录。
249
+ - `n2-deploy ssl-logs --follow` 在再次执行 `ssl` 时实时查看输出。
250
+
251
+ ## 与 CI/CD 的关系
252
+
253
+ - **GitHub Actions** 只负责构建产物(API 镜像、前端 tar)并部署到服务器(SSH + `/opt/deploy/deploy.sh`)。
254
+ - **服务器环境与 SSL** 不在此流程中完成,需在服务器上预先执行 `n2-deploy init` 与 `n2-deploy ssl`(或等价的手动/脚本步骤)。
255
+
256
+ 详见仓库根目录 [docs/deployment.md](../../docs/deployment.md)。
package/dist/cli.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * n2-deploy CLI: server init, nginx config, SSL management.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG"}
package/dist/cli.js ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * n2-deploy CLI: server init, nginx config, SSL management.
4
+ */
5
+ import { Command } from "commander";
6
+ import { runInit } from "./commands/init.js";
7
+ import { runNginx } from "./commands/nginx.js";
8
+ import { runSslLogs } from "./commands/ssl-logs.js";
9
+ import { runSsl } from "./commands/ssl.js";
10
+ const program = new Command();
11
+ program
12
+ .name("n2-deploy")
13
+ .description("Server init, nginx config generation, and SSL certificate management")
14
+ .version("0.1.0");
15
+ program
16
+ .command("init")
17
+ .description("Initialize server (idempotent): nginx, dirs, deploy.sh, placeholder certs")
18
+ .option("-c, --config <path>", "Path to domains.yaml", "domains.yaml")
19
+ .option("--scripts-dir <path>", "Path to deploy scripts (default: cwd/scripts/deploy or N2_DEPLOY_SCRIPTS_DIR)")
20
+ .action(async (opts) => {
21
+ try {
22
+ await runInit({ config: opts.config, scriptsDir: opts.scriptsDir });
23
+ }
24
+ catch (e) {
25
+ console.error(e);
26
+ process.exit(1);
27
+ }
28
+ });
29
+ program
30
+ .command("nginx")
31
+ .description("Generate nginx config from domains config; optionally install and reload")
32
+ .option("-c, --config <path>", "Path to domains.yaml", "domains.yaml")
33
+ .option("-o, --output <path>", "Output path for nginx config", "nginx/n2.conf")
34
+ .option("-i, --install", "Install to system nginx dir and reload")
35
+ .action(async (opts) => {
36
+ try {
37
+ await runNginx({
38
+ config: opts.config,
39
+ output: opts.output,
40
+ install: opts.install,
41
+ });
42
+ }
43
+ catch (e) {
44
+ console.error(e);
45
+ process.exit(1);
46
+ }
47
+ });
48
+ program
49
+ .command("ssl")
50
+ .description("Setup/renew SSL certificates for all domains (acme.sh + Aliyun DNS)")
51
+ .option("-c, --config <path>", "Path to domains.yaml", "domains.yaml")
52
+ .option("--ali-key <key>", "Aliyun Access Key ID (or set ALIYUN_ACCESS_KEY_ID)")
53
+ .option("--ali-secret <secret>", "Aliyun Access Key Secret (or set ALIYUN_ACCESS_KEY_SECRET)")
54
+ .option("--log-file <path>", "SSL log file path", "/opt/deploy/logs/ssl.log")
55
+ .option("--scripts-dir <path>", "Path to deploy scripts")
56
+ .action(async (opts) => {
57
+ try {
58
+ await runSsl({
59
+ config: opts.config,
60
+ aliKey: opts.aliKey,
61
+ aliSecret: opts.aliSecret,
62
+ logFile: opts.logFile,
63
+ scriptsDir: opts.scriptsDir,
64
+ });
65
+ }
66
+ catch (e) {
67
+ console.error(e);
68
+ process.exit(1);
69
+ }
70
+ });
71
+ program
72
+ .command("ssl-logs")
73
+ .description("View SSL log (create, renew, success, failure)")
74
+ .option("--log-file <path>", "SSL log file path", "/opt/deploy/logs/ssl.log")
75
+ .option("-n, --lines <n>", "Number of lines to show", "50")
76
+ .option("-f, --follow", "Follow log (tail -f)")
77
+ .option("--action <action>", "Filter by action: create | renew | success | failure | run")
78
+ .option("--result <result>", "Filter by result: ok | fail")
79
+ .action(async (opts) => {
80
+ try {
81
+ await runSslLogs({
82
+ logFile: opts.logFile,
83
+ lines: parseInt(opts.lines, 10) || 50,
84
+ follow: opts.follow,
85
+ action: opts.action,
86
+ result: opts.result,
87
+ });
88
+ }
89
+ catch (e) {
90
+ console.error(e);
91
+ process.exit(1);
92
+ }
93
+ });
94
+ program.parse();
95
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot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CAAC;KAC7D,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,0BAA0B,CAAC;KAC5E,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,IAAI,CAAC;KAC1D,MAAM,CAAC,cAAc,EAAE,sBAAsB,CAAC;KAC9C,MAAM,CACL,mBAAmB,EACnB,4DAA4D,CAC7D;KACA,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC;KAC1D,MAAM,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE;IACnB,IAAI,CAAC;QACH,MAAM,UAAU,CAAC;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE;YACrC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Server init (idempotent): nginx, dirs, deploy.sh, placeholder certs.
3
+ * Uses server-setup.sh from scripts dir when available.
4
+ */
5
+ export interface InitOptions {
6
+ config: string;
7
+ scriptsDir?: string;
8
+ }
9
+ export declare function runInit(opts: InitOptions): Promise<void>;
10
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0G9D"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Server init (idempotent): nginx, dirs, deploy.sh, placeholder certs.
3
+ * Uses server-setup.sh from scripts dir when available.
4
+ */
5
+ import { spawn } from "node:child_process";
6
+ import fs from "node:fs";
7
+ import path from "node:path";
8
+ import { getAllDomains, parseDomainsYaml } from "../lib/domains.js";
9
+ import { error, info, warn } from "../lib/logger.js";
10
+ import { generateNginxConf } from "../lib/nginx.js";
11
+ import { getScriptsDir } from "../lib/paths.js";
12
+ const DEFAULT_SSL_LOG = "/opt/deploy/logs/ssl.log";
13
+ export async function runInit(opts) {
14
+ const configPath = path.resolve(process.cwd(), opts.config);
15
+ if (!fs.existsSync(configPath)) {
16
+ error(`Domains config not found: ${configPath}`);
17
+ process.exit(1);
18
+ }
19
+ const yaml = fs.readFileSync(configPath, "utf8");
20
+ const config = parseDomainsYaml(yaml);
21
+ const domains = getAllDomains(config);
22
+ const nginxConf = generateNginxConf(config);
23
+ const scriptsDir = opts.scriptsDir ||
24
+ process.env.N2_DEPLOY_SCRIPTS_DIR ||
25
+ getScriptsDir(process.cwd());
26
+ if (!scriptsDir || !fs.existsSync(path.join(scriptsDir, "server-setup.sh"))) {
27
+ error("Deploy scripts directory not found. Set N2_DEPLOY_SCRIPTS_DIR or run from repo root (scripts/deploy must exist).");
28
+ process.exit(1);
29
+ }
30
+ info("Using scripts directory: " + scriptsDir);
31
+ const tmpDir = path.join(process.env.TMPDIR || "/tmp", `n2-deploy-init-${Date.now()}`);
32
+ fs.mkdirSync(path.join(tmpDir, "nginx"), { recursive: true });
33
+ fs.mkdirSync(path.join(tmpDir, "ssl"), { recursive: true });
34
+ try {
35
+ fs.writeFileSync(path.join(tmpDir, "nginx", "n2.conf"), nginxConf);
36
+ const deploySh = path.join(scriptsDir, "deploy.sh");
37
+ if (fs.existsSync(deploySh)) {
38
+ fs.copyFileSync(deploySh, path.join(tmpDir, "deploy.sh"));
39
+ fs.chmodSync(path.join(tmpDir, "deploy.sh"), 0o755);
40
+ }
41
+ else {
42
+ error("deploy.sh not found in scripts directory");
43
+ process.exit(1);
44
+ }
45
+ const setupSh = path.join(scriptsDir, "server-setup.sh");
46
+ fs.copyFileSync(setupSh, path.join(tmpDir, "server-setup.sh"));
47
+ fs.chmodSync(path.join(tmpDir, "server-setup.sh"), 0o755);
48
+ const sslDir = path.join(scriptsDir, "ssl");
49
+ if (fs.existsSync(sslDir)) {
50
+ const sslDest = path.join(tmpDir, "ssl");
51
+ for (const name of fs.readdirSync(sslDir)) {
52
+ const src = path.join(sslDir, name);
53
+ if (fs.statSync(src).isFile()) {
54
+ fs.copyFileSync(src, path.join(sslDest, name));
55
+ fs.chmodSync(path.join(sslDest, name), 0o755);
56
+ }
57
+ }
58
+ }
59
+ fs.writeFileSync(path.join(tmpDir, "ssl", "domains.txt"), domains.join("\n") + "\n");
60
+ const libDir = path.join(scriptsDir, "lib");
61
+ if (fs.existsSync(libDir)) {
62
+ const libDest = path.join(tmpDir, "lib");
63
+ fs.mkdirSync(libDest, { recursive: true });
64
+ for (const name of fs.readdirSync(libDir)) {
65
+ fs.copyFileSync(path.join(libDir, name), path.join(libDest, name));
66
+ }
67
+ }
68
+ info("Running server-setup.sh (may require sudo)...");
69
+ await new Promise((resolve, reject) => {
70
+ const child = spawn("bash", [path.join(tmpDir, "server-setup.sh")], {
71
+ cwd: tmpDir,
72
+ stdio: "inherit",
73
+ env: { ...process.env, SCRIPT_DIR: tmpDir },
74
+ });
75
+ child.on("close", code => {
76
+ if (code === 0)
77
+ resolve();
78
+ else
79
+ reject(new Error(`server-setup.sh exited with ${code}`));
80
+ });
81
+ child.on("error", reject);
82
+ });
83
+ const logDir = path.dirname(DEFAULT_SSL_LOG);
84
+ if (logDir && !fs.existsSync(logDir)) {
85
+ try {
86
+ fs.mkdirSync(logDir, { recursive: true });
87
+ info("Created log directory: " + logDir);
88
+ }
89
+ catch {
90
+ warn("Could not create log directory: " + logDir);
91
+ }
92
+ }
93
+ info("Server initialization completed.");
94
+ }
95
+ finally {
96
+ try {
97
+ fs.rmSync(tmpDir, { recursive: true, force: true });
98
+ }
99
+ catch {
100
+ // ignore
101
+ }
102
+ }
103
+ }
104
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAOnD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAiB;IAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,6BAA6B,UAAU,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC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AK,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC7C,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1C,IAAI,CAAC,yBAAyB,GAAG,MAAM,CAAC,CAAC;YAC3C,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,CAAC,kCAAkC,GAAG,MAAM,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QAED,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAC3C,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generate nginx config from domains config; optionally install and reload.
3
+ */
4
+ export interface NginxOptions {
5
+ config: string;
6
+ output: string;
7
+ install?: boolean;
8
+ }
9
+ export declare function runNginx(opts: NginxOptions): Promise<void>;
10
+ //# sourceMappingURL=nginx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nginx.d.ts","sourceRoot":"","sources":["../../src/commands/nginx.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAID,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BhE"}