shipfe 1.1.1 → 1.1.3

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 (170) hide show
  1. package/bin/shipfe +0 -0
  2. package/package.json +5 -1
  3. package/.github/workflows/deploy.yml +0 -46
  4. package/.github/workflows/release.yml +0 -51
  5. package/.vscode/settings.json +0 -5
  6. package/README_CN.md +0 -41
  7. package/docs/.vitepress/cache/deps/@theme_index.js +0 -275
  8. package/docs/.vitepress/cache/deps/@theme_index.js.map +0 -7
  9. package/docs/.vitepress/cache/deps/_metadata.json +0 -40
  10. package/docs/.vitepress/cache/deps/chunk-BRNHR3LR.js +0 -9719
  11. package/docs/.vitepress/cache/deps/chunk-BRNHR3LR.js.map +0 -7
  12. package/docs/.vitepress/cache/deps/chunk-H6MPEGKE.js +0 -12877
  13. package/docs/.vitepress/cache/deps/chunk-H6MPEGKE.js.map +0 -7
  14. package/docs/.vitepress/cache/deps/package.json +0 -3
  15. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -4505
  16. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -7
  17. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -583
  18. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -7
  19. package/docs/.vitepress/cache/deps/vue.js +0 -347
  20. package/docs/.vitepress/cache/deps/vue.js.map +0 -7
  21. package/docs/.vitepress/config.ts +0 -120
  22. package/docs/.vitepress/dist/404.html +0 -22
  23. package/docs/.vitepress/dist/assets/app.DZUgfPE2.js +0 -1
  24. package/docs/.vitepress/dist/assets/chunks/framework.BeaujayP.js +0 -19
  25. package/docs/.vitepress/dist/assets/chunks/theme.CNyaCki0.js +0 -1
  26. package/docs/.vitepress/dist/assets/commands_deploy.md.cybIRa1n.js +0 -17
  27. package/docs/.vitepress/dist/assets/commands_deploy.md.cybIRa1n.lean.js +0 -1
  28. package/docs/.vitepress/dist/assets/commands_init.md.Da652so5.js +0 -2
  29. package/docs/.vitepress/dist/assets/commands_init.md.Da652so5.lean.js +0 -1
  30. package/docs/.vitepress/dist/assets/commands_rollback.md.C0zKmFtz.js +0 -7
  31. package/docs/.vitepress/dist/assets/commands_rollback.md.C0zKmFtz.lean.js +0 -1
  32. package/docs/.vitepress/dist/assets/config_auth.md.hvDhtWY8.js +0 -56
  33. package/docs/.vitepress/dist/assets/config_auth.md.hvDhtWY8.lean.js +0 -1
  34. package/docs/.vitepress/dist/assets/config_overview.md.DAQclMJL.js +0 -34
  35. package/docs/.vitepress/dist/assets/config_overview.md.DAQclMJL.lean.js +0 -1
  36. package/docs/.vitepress/dist/assets/config_schema.md.Bv5TuD6E.js +0 -1
  37. package/docs/.vitepress/dist/assets/config_schema.md.Bv5TuD6E.lean.js +0 -1
  38. package/docs/.vitepress/dist/assets/config_sub-env.md.DSUt0Nyq.js +0 -26
  39. package/docs/.vitepress/dist/assets/config_sub-env.md.DSUt0Nyq.lean.js +0 -1
  40. package/docs/.vitepress/dist/assets/features_atomic.md.Cszqfb8O.js +0 -22
  41. package/docs/.vitepress/dist/assets/features_atomic.md.Cszqfb8O.lean.js +0 -1
  42. package/docs/.vitepress/dist/assets/features_cleanup.md.D1j3LEm1.js +0 -20
  43. package/docs/.vitepress/dist/assets/features_cleanup.md.D1j3LEm1.lean.js +0 -1
  44. package/docs/.vitepress/dist/assets/features_shared-assets.md.ChpQD81r.js +0 -26
  45. package/docs/.vitepress/dist/assets/features_shared-assets.md.ChpQD81r.lean.js +0 -1
  46. package/docs/.vitepress/dist/assets/features_snapshot.md.Bddk9nNL.js +0 -24
  47. package/docs/.vitepress/dist/assets/features_snapshot.md.Bddk9nNL.lean.js +0 -1
  48. package/docs/.vitepress/dist/assets/index.md.DqmDY2QI.js +0 -1
  49. package/docs/.vitepress/dist/assets/index.md.DqmDY2QI.lean.js +0 -1
  50. package/docs/.vitepress/dist/assets/install.md.CblrJsha.js +0 -1
  51. package/docs/.vitepress/dist/assets/install.md.CblrJsha.lean.js +0 -1
  52. package/docs/.vitepress/dist/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  53. package/docs/.vitepress/dist/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  54. package/docs/.vitepress/dist/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  55. package/docs/.vitepress/dist/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  56. package/docs/.vitepress/dist/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  57. package/docs/.vitepress/dist/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  58. package/docs/.vitepress/dist/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  59. package/docs/.vitepress/dist/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  60. package/docs/.vitepress/dist/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  61. package/docs/.vitepress/dist/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  62. package/docs/.vitepress/dist/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  63. package/docs/.vitepress/dist/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  64. package/docs/.vitepress/dist/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  65. package/docs/.vitepress/dist/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  66. package/docs/.vitepress/dist/assets/license.md.hVRT8__d.js +0 -1
  67. package/docs/.vitepress/dist/assets/license.md.hVRT8__d.lean.js +0 -1
  68. package/docs/.vitepress/dist/assets/quick-start.md.C06xD920.js +0 -23
  69. package/docs/.vitepress/dist/assets/quick-start.md.C06xD920.lean.js +0 -1
  70. package/docs/.vitepress/dist/assets/style.DES0mfMn.css +0 -1
  71. package/docs/.vitepress/dist/assets/troubleshooting.md.DLP5r-7N.js +0 -1
  72. package/docs/.vitepress/dist/assets/troubleshooting.md.DLP5r-7N.lean.js +0 -1
  73. package/docs/.vitepress/dist/assets/zh_commands_deploy.md.BbKuBIij.js +0 -9
  74. package/docs/.vitepress/dist/assets/zh_commands_deploy.md.BbKuBIij.lean.js +0 -1
  75. package/docs/.vitepress/dist/assets/zh_commands_init.md.Dc_WYD8D.js +0 -18
  76. package/docs/.vitepress/dist/assets/zh_commands_init.md.Dc_WYD8D.lean.js +0 -1
  77. package/docs/.vitepress/dist/assets/zh_commands_rollback.md.Cdvwk1lB.js +0 -6
  78. package/docs/.vitepress/dist/assets/zh_commands_rollback.md.Cdvwk1lB.lean.js +0 -1
  79. package/docs/.vitepress/dist/assets/zh_config_auth.md.BytNcdS4.js +0 -44
  80. package/docs/.vitepress/dist/assets/zh_config_auth.md.BytNcdS4.lean.js +0 -1
  81. package/docs/.vitepress/dist/assets/zh_config_overview.md.CvAKxlb5.js +0 -45
  82. package/docs/.vitepress/dist/assets/zh_config_overview.md.CvAKxlb5.lean.js +0 -1
  83. package/docs/.vitepress/dist/assets/zh_config_schema.md.CTCn0g9X.js +0 -67
  84. package/docs/.vitepress/dist/assets/zh_config_schema.md.CTCn0g9X.lean.js +0 -1
  85. package/docs/.vitepress/dist/assets/zh_config_sub-env.md.Ce3xOEsi.js +0 -167
  86. package/docs/.vitepress/dist/assets/zh_config_sub-env.md.Ce3xOEsi.lean.js +0 -1
  87. package/docs/.vitepress/dist/assets/zh_features_atomic.md.DUhJ_qq0.js +0 -42
  88. package/docs/.vitepress/dist/assets/zh_features_atomic.md.DUhJ_qq0.lean.js +0 -1
  89. package/docs/.vitepress/dist/assets/zh_features_cleanup.md.CEgw587m.js +0 -50
  90. package/docs/.vitepress/dist/assets/zh_features_cleanup.md.CEgw587m.lean.js +0 -1
  91. package/docs/.vitepress/dist/assets/zh_features_shared-assets.md.DZhvWCTp.js +0 -26
  92. package/docs/.vitepress/dist/assets/zh_features_shared-assets.md.DZhvWCTp.lean.js +0 -1
  93. package/docs/.vitepress/dist/assets/zh_features_snapshot.md.Bkqgn7lu.js +0 -39
  94. package/docs/.vitepress/dist/assets/zh_features_snapshot.md.Bkqgn7lu.lean.js +0 -1
  95. package/docs/.vitepress/dist/assets/zh_index.md.DKRf1R-g.js +0 -1
  96. package/docs/.vitepress/dist/assets/zh_index.md.DKRf1R-g.lean.js +0 -1
  97. package/docs/.vitepress/dist/assets/zh_install.md.0LCLPI3L.js +0 -41
  98. package/docs/.vitepress/dist/assets/zh_install.md.0LCLPI3L.lean.js +0 -1
  99. package/docs/.vitepress/dist/assets/zh_license.md.BUZ74dvK.js +0 -1
  100. package/docs/.vitepress/dist/assets/zh_license.md.BUZ74dvK.lean.js +0 -1
  101. package/docs/.vitepress/dist/assets/zh_quick-start.md.Bl-Larcu.js +0 -19
  102. package/docs/.vitepress/dist/assets/zh_quick-start.md.Bl-Larcu.lean.js +0 -1
  103. package/docs/.vitepress/dist/assets/zh_troubleshooting.md.DHyCAfy2.js +0 -1
  104. package/docs/.vitepress/dist/assets/zh_troubleshooting.md.DHyCAfy2.lean.js +0 -1
  105. package/docs/.vitepress/dist/commands/deploy.html +0 -41
  106. package/docs/.vitepress/dist/commands/init.html +0 -26
  107. package/docs/.vitepress/dist/commands/rollback.html +0 -31
  108. package/docs/.vitepress/dist/config/auth.html +0 -80
  109. package/docs/.vitepress/dist/config/overview.html +0 -58
  110. package/docs/.vitepress/dist/config/schema.html +0 -25
  111. package/docs/.vitepress/dist/config/sub-env.html +0 -50
  112. package/docs/.vitepress/dist/features/atomic.html +0 -46
  113. package/docs/.vitepress/dist/features/cleanup.html +0 -44
  114. package/docs/.vitepress/dist/features/shared-assets.html +0 -50
  115. package/docs/.vitepress/dist/features/snapshot.html +0 -48
  116. package/docs/.vitepress/dist/hashmap.json +0 -1
  117. package/docs/.vitepress/dist/index.html +0 -25
  118. package/docs/.vitepress/dist/install.html +0 -25
  119. package/docs/.vitepress/dist/license.html +0 -25
  120. package/docs/.vitepress/dist/quick-start.html +0 -47
  121. package/docs/.vitepress/dist/troubleshooting.html +0 -25
  122. package/docs/.vitepress/dist/vp-icons.css +0 -0
  123. package/docs/.vitepress/dist/zh/commands/deploy.html +0 -33
  124. package/docs/.vitepress/dist/zh/commands/init.html +0 -42
  125. package/docs/.vitepress/dist/zh/commands/rollback.html +0 -30
  126. package/docs/.vitepress/dist/zh/config/auth.html +0 -68
  127. package/docs/.vitepress/dist/zh/config/overview.html +0 -69
  128. package/docs/.vitepress/dist/zh/config/schema.html +0 -91
  129. package/docs/.vitepress/dist/zh/config/sub-env.html +0 -191
  130. package/docs/.vitepress/dist/zh/features/atomic.html +0 -66
  131. package/docs/.vitepress/dist/zh/features/cleanup.html +0 -74
  132. package/docs/.vitepress/dist/zh/features/shared-assets.html +0 -50
  133. package/docs/.vitepress/dist/zh/features/snapshot.html +0 -63
  134. package/docs/.vitepress/dist/zh/index.html +0 -25
  135. package/docs/.vitepress/dist/zh/install.html +0 -65
  136. package/docs/.vitepress/dist/zh/license.html +0 -25
  137. package/docs/.vitepress/dist/zh/quick-start.html +0 -43
  138. package/docs/.vitepress/dist/zh/troubleshooting.html +0 -25
  139. package/docs/commands/deploy.md +0 -46
  140. package/docs/commands/init.md +0 -27
  141. package/docs/commands/rollback.md +0 -45
  142. package/docs/config/auth.md +0 -112
  143. package/docs/config/overview.md +0 -63
  144. package/docs/config/schema.md +0 -52
  145. package/docs/config/sub-env.md +0 -62
  146. package/docs/features/atomic.md +0 -67
  147. package/docs/features/cleanup.md +0 -80
  148. package/docs/features/shared-assets.md +0 -72
  149. package/docs/features/snapshot.md +0 -58
  150. package/docs/index.md +0 -48
  151. package/docs/install.md +0 -21
  152. package/docs/license.md +0 -23
  153. package/docs/quick-start.md +0 -98
  154. package/docs/troubleshooting.md +0 -88
  155. package/docs/zh/commands/deploy.md +0 -127
  156. package/docs/zh/commands/init.md +0 -76
  157. package/docs/zh/commands/rollback.md +0 -115
  158. package/docs/zh/config/auth.md +0 -195
  159. package/docs/zh/config/overview.md +0 -153
  160. package/docs/zh/config/schema.md +0 -253
  161. package/docs/zh/config/sub-env.md +0 -293
  162. package/docs/zh/features/atomic.md +0 -249
  163. package/docs/zh/features/cleanup.md +0 -241
  164. package/docs/zh/features/shared-assets.md +0 -72
  165. package/docs/zh/features/snapshot.md +0 -186
  166. package/docs/zh/index.md +0 -65
  167. package/docs/zh/install.md +0 -160
  168. package/docs/zh/license.md +0 -23
  169. package/docs/zh/quick-start.md +0 -109
  170. package/docs/zh/troubleshooting.md +0 -88
@@ -1,127 +0,0 @@
1
- # deploy 命令
2
-
3
- 执行应用部署到远程服务器。
4
-
5
- ## 语法
6
-
7
- ```bash
8
- shipfe deploy [options]
9
- ```
10
-
11
- ## 描述
12
-
13
- `deploy` 命令执行完整的部署流程:
14
- 1. 执行构建命令(如果配置了)
15
- 2. 创建新的发布目录
16
- 3. 上传文件到服务器
17
- 4. 原子化切换到新版本
18
- 5. 清理旧版本(根据配置)
19
-
20
- ## 选项
21
-
22
- | 选项 | 描述 |
23
- |------|------|
24
- | `-c, --config <file>` | 指定配置文件路径 |
25
- | `-d, --debug` | 启用调试模式,显示详细日志 |
26
- | `--dry-run` | 预览模式,不实际执行部署 |
27
- | `--skip-build` | 跳过构建步骤 |
28
- | `-h, --help` | 显示帮助信息 |
29
-
30
- ## 示例
31
-
32
- ### 基本部署
33
-
34
- ```bash
35
- shipfe deploy
36
- ```
37
-
38
- 使用默认配置文件执行完整部署。
39
-
40
- ### 指定配置文件
41
-
42
- ```bash
43
- shipfe deploy --config production.json
44
- ```
45
-
46
- 使用特定的配置文件进行部署。
47
-
48
- ### 调试模式
49
-
50
- ```bash
51
- shipfe deploy --debug
52
- ```
53
-
54
- 启用详细日志输出,帮助诊断问题。
55
-
56
- ### 预览部署
57
-
58
- ```bash
59
- shipfe deploy --dry-run
60
- ```
61
-
62
- 显示将要执行的操作,但不实际部署。
63
-
64
- ### 跳过构建
65
-
66
- ```bash
67
- shipfe deploy --skip-build
68
- ```
69
-
70
- 如果构建已手动完成,可以跳过构建步骤。
71
-
72
- ## 部署流程
73
-
74
- ### 1. 构建阶段
75
-
76
- 如果配置了 `build_command`,Shipfe会执行它:
77
-
78
- ```bash
79
- npm run build
80
- # 或其他构建命令
81
- ```
82
-
83
- ### 2. 准备阶段
84
-
85
- - 创建时间戳目录:`releases/YYYYMMDD_HHMMSS`
86
- - 生成部署快照
87
-
88
- ### 3. 上传阶段
89
-
90
- - 上传构建产物到新发布目录
91
- - 处理共享资源(如果启用)
92
-
93
- ### 4. 切换阶段
94
-
95
- - 原子化切换 `current` 符号链接
96
- - 确保零停机部署
97
-
98
- ### 5. 清理阶段
99
-
100
- - 删除超出 `keep_releases` 限制的旧版本
101
- - 清理未使用的共享资源
102
-
103
- ## 部署目录结构
104
-
105
- ```
106
- remote_path/
107
- ├── current -> releases/20260304_120000 # 当前版本
108
- ├── releases/
109
- │ ├── 20260304_120000/ # 最新版本
110
- │ ├── 20260304_110000/ # 上一版本
111
- │ └── 20260304_100000/ # 更早版本
112
- └── shared/ # 共享资源(可选)
113
- └── assets/
114
- ```
115
-
116
- ## 错误处理
117
-
118
- 部署过程中如果出现错误:
119
-
120
- - 自动清理失败的发布目录
121
- - 不影响当前运行的版本
122
- - 详细的错误日志输出
123
-
124
- ## 相关命令
125
-
126
- - [`init`](/zh/commands/init) - 初始化配置文件
127
- - [`rollback`](/zh/commands/rollback) - 回滚部署
@@ -1,76 +0,0 @@
1
- # init 命令
2
-
3
- 初始化Shipfe配置文件。
4
-
5
- ## 语法
6
-
7
- ```bash
8
- shipfe init [options]
9
- ```
10
-
11
- ## 描述
12
-
13
- `init` 命令在当前目录创建 `shipfe.config.json` 配置文件。这个文件包含了部署所需的所有配置信息。
14
-
15
- ## 选项
16
-
17
- | 选项 | 描述 |
18
- |------|------|
19
- | `-f, --force` | 强制覆盖已存在的配置文件 |
20
- | `-h, --help` | 显示帮助信息 |
21
-
22
- ## 示例
23
-
24
- ### 基本初始化
25
-
26
- ```bash
27
- shipfe init
28
- ```
29
-
30
- 这将在当前目录创建 `shipfe.config.json` 文件。
31
-
32
- ### 强制覆盖
33
-
34
- ```bash
35
- shipfe init --force
36
- ```
37
-
38
- 如果配置文件已存在,将被覆盖。
39
-
40
- ## 生成的配置文件
41
-
42
- `init` 命令会生成一个包含默认值的配置文件:
43
-
44
- ```json
45
- {
46
- "remote_host": "",
47
- "remote_user": "",
48
- "remote_path": "",
49
- "local_path": "./dist",
50
- "keep_releases": 5,
51
- "build_command": "",
52
- "delete_old": false,
53
- "enable_shared": false,
54
- "hashed_asset_patterns": [
55
- "**/*.js",
56
- "**/*.css",
57
- "**/*.png",
58
- "**/*.jpg",
59
- "**/*.svg",
60
- "**/*.woff2"
61
- ]
62
- }
63
- ```
64
-
65
- ## 下一步
66
-
67
- 创建配置文件后,您需要:
68
-
69
- 1. 编辑配置文件,填入您的服务器信息
70
- 2. 配置SSH密钥认证
71
- 3. 运行 `shipfe deploy` 进行首次部署
72
-
73
- ## 相关命令
74
-
75
- - [`deploy`](/zh/commands/deploy) - 执行部署
76
- - [`rollback`](/zh/commands/rollback) - 回滚到上一版本
@@ -1,115 +0,0 @@
1
- # rollback 命令
2
-
3
- 回滚到之前的部署版本。
4
-
5
- ## 语法
6
-
7
- ```bash
8
- shipfe rollback [options] [version]
9
- ```
10
-
11
- ## 描述
12
-
13
- `rollback` 命令将应用回滚到指定的历史版本。如果不指定版本,则回滚到上一个版本。
14
-
15
- ## 选项
16
-
17
- | 选项 | 描述 |
18
- |------|------|
19
- | `-c, --config <file>` | 指定配置文件路径 |
20
- | `-d, --debug` | 启用调试模式 |
21
- | `--dry-run` | 预览模式,不实际执行回滚 |
22
- | `-h, --help` | 显示帮助信息 |
23
-
24
- ## 参数
25
-
26
- - `version`: 可选,要回滚到的版本号(时间戳格式,如 `20260304_120000`)
27
-
28
- ## 示例
29
-
30
- ### 回滚到上一版本
31
-
32
- ```bash
33
- shipfe rollback
34
- ```
35
-
36
- 自动回滚到最近的稳定版本。
37
-
38
- ### 回滚到指定版本
39
-
40
- ```bash
41
- shipfe rollback 20260304_120000
42
- ```
43
-
44
- 回滚到特定的历史版本。
45
-
46
- ### 预览回滚
47
-
48
- ```bash
49
- shipfe rollback --dry-run
50
- ```
51
-
52
- 显示将要回滚到的版本,但不实际执行。
53
-
54
- ## 回滚流程
55
-
56
- ### 1. 版本选择
57
-
58
- - 如果指定了版本,直接使用
59
- - 如果未指定,自动选择最新的可用版本(非当前版本)
60
-
61
- ### 2. 验证检查
62
-
63
- - 检查目标版本是否存在
64
- - 验证快照文件的完整性
65
- - 确保版本文件未损坏
66
-
67
- ### 3. 原子切换
68
-
69
- - 切换 `current` 符号链接到目标版本
70
- - 确保切换的原子性
71
-
72
- ### 4. 状态验证
73
-
74
- - 验证切换后的符号链接正确
75
- - 检查应用是否正常运行
76
-
77
- ## 查看可用版本
78
-
79
- 要查看可回滚的版本:
80
-
81
- ```bash
82
- # SSH到服务器查看
83
- ssh user@server "ls -la /var/www/myapp/releases/"
84
-
85
- # 或使用shipfe日志
86
- tail -f shipfe.log
87
- ```
88
-
89
- ## 回滚历史
90
-
91
- 每次回滚都会记录在日志中:
92
-
93
- ```
94
- 2026-03-04 12:01:00 INFO Starting rollback to version 20260304_110000
95
- 2026-03-04 12:01:01 INFO Successfully rolled back to version 20260304_110000
96
- ```
97
-
98
- ## 注意事项
99
-
100
- - 回滚不会删除任何版本,只改变当前链接
101
- - 可以多次回滚到不同版本
102
- - 回滚操作是可逆的,可以再次部署新版本
103
-
104
- ## 错误处理
105
-
106
- 如果回滚失败:
107
-
108
- - 当前版本保持不变
109
- - 详细错误信息输出
110
- - 不会影响应用的可用性
111
-
112
- ## 相关命令
113
-
114
- - [`deploy`](/zh/commands/deploy) - 执行新部署
115
- - [`init`](/zh/commands/init) - 初始化配置
@@ -1,195 +0,0 @@
1
- # 认证配置
2
-
3
- 配置SSH认证以安全连接到远程服务器。
4
-
5
- ## SSH密钥认证(推荐)
6
-
7
- Shipfe 使用SSH密钥认证,这是最安全和最方便的方式。
8
-
9
- ### 生成SSH密钥
10
-
11
- 如果还没有SSH密钥:
12
-
13
- ```bash
14
- # 生成RSA密钥(推荐)
15
- ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
16
-
17
- # 或生成Ed25519密钥(更现代)
18
- ssh-keygen -t ed25519 -C "your-email@example.com"
19
- ```
20
-
21
- ### 配置密钥路径
22
-
23
- 在 `shipfe.config.json` 中指定私钥路径:
24
-
25
- ```json
26
- {
27
- "ssh_key_path": "~/.ssh/id_rsa"
28
- }
29
- ```
30
-
31
- 默认路径是 `~/.ssh/id_rsa`。
32
-
33
- ### 添加公钥到服务器
34
-
35
- 将公钥添加到服务器的 `authorized_keys`:
36
-
37
- ```bash
38
- # 自动添加(推荐)
39
- ssh-copy-id user@your-server.com
40
-
41
- # 或手动添加
42
- cat ~/.ssh/id_rsa.pub | ssh user@server "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
43
- ```
44
-
45
- ### 验证SSH连接
46
-
47
- 测试SSH连接是否正常:
48
-
49
- ```bash
50
- ssh -i ~/.ssh/id_rsa user@your-server.com
51
- ```
52
-
53
- ## SSH端口配置
54
-
55
- 如果SSH服务使用非标准端口:
56
-
57
- ```json
58
- {
59
- "ssh_port": 2222
60
- }
61
- ```
62
-
63
- ## 密钥权限
64
-
65
- 确保SSH密钥文件权限正确:
66
-
67
- ```bash
68
- # 私钥权限
69
- chmod 600 ~/.ssh/id_rsa
70
-
71
- # 公钥权限
72
- chmod 644 ~/.ssh/id_rsa.pub
73
-
74
- # .ssh目录权限
75
- chmod 700 ~/.ssh
76
- ```
77
-
78
- ## 使用不同的密钥
79
-
80
- 为不同项目或环境使用不同的SSH密钥:
81
-
82
- ```json
83
- {
84
- "ssh_key_path": "~/.ssh/project_deploy_key"
85
- }
86
- ```
87
-
88
- ## SSH代理转发
89
-
90
- 如果使用SSH代理,可以配置代理转发:
91
-
92
- ```bash
93
- # 在本地启用代理
94
- eval "$(ssh-agent -s)"
95
- ssh-add ~/.ssh/id_rsa
96
-
97
- # 配置转发(在shipfe配置中不需要特殊设置)
98
- ```
99
-
100
- ## 密码认证(不推荐)
101
-
102
- 虽然不推荐,但也可以使用密码认证:
103
-
104
- **注意**:密码认证不够安全,建议使用SSH密钥。
105
-
106
- 如果必须使用密码,Shipfe会提示输入密码。
107
-
108
- ## 多服务器部署
109
-
110
- 为多个服务器配置不同的认证:
111
-
112
- ```json
113
- // staging.json
114
- {
115
- "remote_host": "staging.example.com",
116
- "remote_user": "deploy",
117
- "ssh_key_path": "~/.ssh/staging_key"
118
- }
119
-
120
- // production.json
121
- {
122
- "remote_host": "production.example.com",
123
- "remote_user": "deploy",
124
- "ssh_key_path": "~/.ssh/production_key"
125
- }
126
- ```
127
-
128
- ## 故障排除
129
-
130
- ### 权限拒绝错误
131
-
132
- ```
133
- Permission denied (publickey)
134
- ```
135
-
136
- **解决方案**:
137
-
138
- 1. 检查私钥路径是否正确
139
- 2. 验证公钥是否已添加到服务器
140
- 3. 检查密钥文件权限
141
- 4. 测试直接SSH连接
142
-
143
- ### 主机密钥验证失败
144
-
145
- ```
146
- Host key verification failed
147
- ```
148
-
149
- **解决方案**:
150
-
151
- ```bash
152
- # 添加主机密钥到known_hosts
153
- ssh-keyscan your-server.com >> ~/.ssh/known_hosts
154
-
155
- # 或禁用严格检查(不推荐)
156
- # 在~/.ssh/config中添加:
157
- # Host your-server.com
158
- # StrictHostKeyChecking no
159
- ```
160
-
161
- ### SSH连接超时
162
-
163
- ```
164
- Connection timed out
165
- ```
166
-
167
- **解决方案**:
168
-
169
- 1. 检查服务器是否可达
170
- 2. 验证防火墙设置
171
- 3. 确认SSH服务正在运行
172
- 4. 检查网络连接
173
-
174
- ### 调试SSH连接
175
-
176
- 启用详细SSH调试:
177
-
178
- ```bash
179
- ssh -v -i ~/.ssh/id_rsa user@your-server.com
180
- ```
181
-
182
- 或在Shipfe中使用调试模式:
183
-
184
- ```bash
185
- shipfe deploy --debug
186
- ```
187
-
188
- ## 安全最佳实践
189
-
190
- 1. **使用强密钥**:使用4096位RSA或Ed25519密钥
191
- 2. **定期轮换密钥**:定期更换SSH密钥
192
- 3. **限制密钥使用**:为特定服务器限制密钥使用
193
- 4. **禁用密码认证**:在服务器上禁用SSH密码认证
194
- 5. **使用SSH代理**:使用ssh-agent管理密钥
195
- 6. **监控访问**:监控SSH登录日志
@@ -1,153 +0,0 @@
1
- # 配置概览
2
-
3
- Shipfe 使用 JSON 格式的配置文件来定义部署行为。
4
-
5
- ## 配置文件位置
6
-
7
- 默认情况下,Shipfe 在项目根目录查找 `shipfe.config.json` 文件。
8
-
9
- 您也可以使用 `-c` 或 `--config` 参数指定自定义配置文件:
10
-
11
- ```bash
12
- shipfe deploy --config production.json
13
- ```
14
-
15
- ## 基本配置
16
-
17
- 最小的配置文件包含服务器连接信息:
18
-
19
- ```json
20
- {
21
- "remote_host": "your-server.com",
22
- "remote_user": "deploy",
23
- "remote_path": "/var/www/myapp",
24
- "local_path": "./dist"
25
- }
26
- ```
27
-
28
- ## 完整配置示例
29
-
30
- ```json
31
- {
32
- "remote_host": "your-server.com",
33
- "remote_user": "deploy",
34
- "remote_path": "/var/www/myapp",
35
- "local_path": "./dist",
36
- "build_command": "npm run build",
37
- "keep_releases": 5,
38
- "delete_old": false,
39
- "enable_shared": true,
40
- "hashed_asset_patterns": [
41
- "**/*.js",
42
- "**/*.css",
43
- "**/*.png",
44
- "**/*.jpg",
45
- "**/*.svg",
46
- "**/*.woff2"
47
- ],
48
- "exclude_patterns": [
49
- "**/*.map",
50
- "**/*.log"
51
- ],
52
- "ssh_key_path": "~/.ssh/id_rsa",
53
- "ssh_port": 22,
54
- "pre_deploy_commands": [
55
- "sudo systemctl stop nginx"
56
- ],
57
- "post_deploy_commands": [
58
- "sudo systemctl start nginx"
59
- ]
60
- }
61
- ```
62
-
63
- ## 配置分类
64
-
65
- ### 连接配置
66
-
67
- - [`remote_host`](/zh/config/auth) - 服务器地址
68
- - [`remote_user`](/zh/config/auth) - SSH用户名
69
- - [`ssh_key_path`](/zh/config/auth) - SSH密钥路径
70
- - [`ssh_port`](/zh/config/auth) - SSH端口
71
-
72
- ### 路径配置
73
-
74
- - `remote_path` - 服务器部署根目录
75
- - `local_path` - 本地构建输出目录
76
-
77
- ### 构建配置
78
-
79
- - `build_command` - 构建命令
80
- - `exclude_patterns` - 排除的文件模式
81
-
82
- ### 部署策略
83
-
84
- - `keep_releases` - 保留的发布数量
85
- - `delete_old` - 是否只保留最新版本
86
-
87
- ### 高级功能
88
-
89
- - [`enable_shared`](/zh/features/shared-assets) - 启用共享资源
90
- - `hashed_asset_patterns` - 共享资源文件模式
91
- - `pre_deploy_commands` - 部署前命令
92
- - `post_deploy_commands` - 部署后命令
93
-
94
- ## 环境特定配置
95
-
96
- 对于不同的部署环境,可以创建多个配置文件:
97
-
98
- ```bash
99
- # 生产环境
100
- shipfe deploy --config production.json
101
-
102
- # 预发布环境
103
- shipfe deploy --config staging.json
104
-
105
- # 测试环境
106
- shipfe deploy --config test.json
107
- ```
108
-
109
- ## 配置验证
110
-
111
- Shipfe 在部署前会验证配置的正确性:
112
-
113
- - 检查必需字段
114
- - 验证服务器连接
115
- - 检查路径权限
116
- - 验证构建命令
117
-
118
- ## 最佳实践
119
-
120
- 1. **使用版本控制**:将配置文件纳入版本控制
121
- 2. **环境分离**:为不同环境使用不同配置
122
- 3. **敏感信息**:不要在配置文件中存储密码
123
- 4. **权限控制**:确保配置文件权限正确(600)
124
- 5. **备份配置**:定期备份重要的配置文件
125
-
126
- ## 故障排除
127
-
128
- ### 配置无效
129
-
130
- ```bash
131
- shipfe deploy --debug
132
- ```
133
-
134
- 启用调试模式查看详细的配置验证信息。
135
-
136
- ### 权限问题
137
-
138
- 确保配置文件权限正确:
139
-
140
- ```bash
141
- chmod 600 shipfe.config.json
142
- ```
143
-
144
- ### 路径问题
145
-
146
- 使用绝对路径避免歧义:
147
-
148
- ```json
149
- {
150
- "local_path": "/full/path/to/dist",
151
- "remote_path": "/var/www/myapp"
152
- }
153
- ```