@nocobase/plugin-ai 2.1.0-beta.43 → 2.1.0-beta.45

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 (117) hide show
  1. package/dist/ai/docs/nocobase/ai/install-upgrade-migration.mdx +127 -132
  2. package/dist/ai/docs/nocobase/ai-dev/capabilities.md +1 -1
  3. package/dist/ai/docs/nocobase/ai-dev/index.md +1 -1
  4. package/dist/ai/docs/nocobase/ai-dev/watermark-plugin.md +1 -1
  5. package/dist/ai/docs/nocobase/api/cli/app/autostart/disable.md +44 -0
  6. package/dist/ai/docs/nocobase/api/cli/app/autostart/enable.md +44 -0
  7. package/dist/ai/docs/nocobase/api/cli/app/autostart/index.md +63 -0
  8. package/dist/ai/docs/nocobase/api/cli/app/autostart/list.md +41 -0
  9. package/dist/ai/docs/nocobase/api/cli/app/autostart/run.md +50 -0
  10. package/dist/ai/docs/nocobase/api/cli/app/index.md +18 -15
  11. package/dist/ai/docs/nocobase/api/cli/app/restart.md +3 -11
  12. package/dist/ai/docs/nocobase/api/cli/app/start.md +3 -11
  13. package/dist/ai/docs/nocobase/api/cli/app/stop.md +22 -12
  14. package/dist/ai/docs/nocobase/api/cli/app/upgrade.md +6 -6
  15. package/dist/ai/docs/nocobase/api/cli/backup/create.md +49 -0
  16. package/dist/ai/docs/nocobase/api/cli/backup/index.md +46 -0
  17. package/dist/ai/docs/nocobase/api/cli/backup/restore.md +46 -0
  18. package/dist/ai/docs/nocobase/api/cli/config/delete.md +11 -9
  19. package/dist/ai/docs/nocobase/api/cli/config/get.md +11 -8
  20. package/dist/ai/docs/nocobase/api/cli/config/index.md +28 -24
  21. package/dist/ai/docs/nocobase/api/cli/config/set.md +14 -12
  22. package/dist/ai/docs/nocobase/api/cli/db/stop.md +10 -11
  23. package/dist/ai/docs/nocobase/api/cli/env/index.md +25 -23
  24. package/dist/ai/docs/nocobase/api/cli/env/info.md +12 -10
  25. package/dist/ai/docs/nocobase/api/cli/env/proxy/caddy.md +108 -0
  26. package/dist/ai/docs/nocobase/api/cli/env/proxy/index.md +54 -0
  27. package/dist/ai/docs/nocobase/api/cli/env/proxy/nginx.md +104 -0
  28. package/dist/ai/docs/nocobase/api/cli/env/remove.md +18 -14
  29. package/dist/ai/docs/nocobase/api/cli/env/update.md +115 -14
  30. package/dist/ai/docs/nocobase/api/cli/index.md +66 -52
  31. package/dist/ai/docs/nocobase/api/cli/init.md +244 -62
  32. package/dist/ai/docs/nocobase/api/cli/license/activate.md +13 -12
  33. package/dist/ai/docs/nocobase/api/cli/license/index.md +2 -2
  34. package/dist/ai/docs/nocobase/api/cli/plugin/import.md +74 -0
  35. package/dist/ai/docs/nocobase/api/cli/plugin/index.md +4 -2
  36. package/dist/ai/docs/nocobase/get-started/deployment/how-to-deploy-nocobase-faster.mdx +384 -0
  37. package/dist/ai/docs/nocobase/get-started/install-upgrade-plugins.mdx +16 -10
  38. package/dist/ai/docs/nocobase/get-started/upgrading/docker.md +1 -1
  39. package/dist/ai/docs/nocobase/index.md +3 -3
  40. package/dist/ai/docs/nocobase/multi-app/multi-app/app-block-and-switcher.md +68 -0
  41. package/dist/ai/docs/nocobase/multi-app/multi-app/app-sso.md +71 -0
  42. package/dist/ai/docs/nocobase/multi-app/multi-app/index.md +9 -1
  43. package/dist/ai/docs/nocobase/multi-app/multi-app/sub-app-api.md +112 -0
  44. package/dist/ai/docs/nocobase/plugin-development/client/appendix/faq.md +3 -3
  45. package/dist/ai/docs/nocobase/plugin-development/client/component/index.md +1 -1
  46. package/dist/ai/docs/nocobase/plugin-development/client/ctx/common-capabilities.md +2 -2
  47. package/dist/ai/docs/nocobase/plugin-development/client/ctx/index.md +1 -1
  48. package/dist/ai/docs/nocobase/plugin-development/client/router.md +11 -11
  49. package/dist/ai/docs/nocobase/quickstart/index.md +27 -0
  50. package/dist/ai/docs/nocobase/quickstart/installation/airgap.md +67 -0
  51. package/dist/ai/docs/nocobase/quickstart/installation/cli.md +205 -0
  52. package/dist/ai/docs/nocobase/quickstart/installation/docker-compose.md +123 -0
  53. package/dist/ai/docs/nocobase/quickstart/installation/env.md +101 -0
  54. package/dist/ai/docs/nocobase/quickstart/installation/migration.md +50 -0
  55. package/dist/ai/docs/nocobase/quickstart/operations/backup-restore.md +94 -0
  56. package/dist/ai/docs/nocobase/quickstart/operations/manage-app.md +166 -0
  57. package/dist/ai/docs/nocobase/quickstart/operations/multi-environment.md +171 -0
  58. package/dist/ai/docs/nocobase/quickstart/plugins/third-party.md +86 -0
  59. package/dist/ai/docs/nocobase/quickstart/production/index.md +163 -0
  60. package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/caddy.md +158 -0
  61. package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/index.md +100 -0
  62. package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/nginx.md +166 -0
  63. package/dist/ai/docs/nocobase/quickstart/release-management.md +1 -0
  64. package/dist/ai/docs/nocobase/solution/all-in-one/installation.md +181 -0
  65. package/dist/ai/docs/nocobase/solution/crm/changelog.md +0 -3
  66. package/dist/ai/docs/nocobase/solution/crm/installation.md +6 -76
  67. package/dist/ai/docs/nocobase/solution/crm/v1.md +6 -35
  68. package/dist/ai/docs/nocobase/solution/ticket-system/changelog.md +0 -2
  69. package/dist/ai/docs/nocobase/solution/ticket-system/installation.md +6 -69
  70. package/dist/ai/docs/nocobase/workflow/advanced/options.md +45 -1
  71. package/dist/client/{406.15c09d98faa2ccf1.js → 406.9a530334eae8cede.js} +1 -1
  72. package/dist/client/{428.e9f38da3b0d8b498.js → 428.431a00d29107058e.js} +1 -1
  73. package/dist/client/index.js +2 -2
  74. package/dist/client-v2/index.js +1 -1
  75. package/dist/externalVersion.js +18 -18
  76. package/dist/locale/de-DE.json +1 -0
  77. package/dist/locale/en-US.json +2 -1
  78. package/dist/locale/es-ES.json +1 -0
  79. package/dist/locale/fr-FR.json +1 -0
  80. package/dist/locale/hu-HU.json +1 -0
  81. package/dist/locale/id-ID.json +1 -0
  82. package/dist/locale/it-IT.json +1 -0
  83. package/dist/locale/ja-JP.json +1 -0
  84. package/dist/locale/ko-KR.json +1 -0
  85. package/dist/locale/nl-NL.json +1 -0
  86. package/dist/locale/pt-BR.json +1 -0
  87. package/dist/locale/ru-RU.json +1 -0
  88. package/dist/locale/tr-TR.json +1 -0
  89. package/dist/locale/uk-UA.json +1 -0
  90. package/dist/locale/vi-VN.json +1 -0
  91. package/dist/locale/zh-CN.json +2 -1
  92. package/dist/locale/zh-TW.json +1 -0
  93. package/dist/node_modules/@langchain/xai/package.json +1 -1
  94. package/dist/node_modules/fs-extra/package.json +1 -1
  95. package/dist/node_modules/jsonrepair/package.json +1 -1
  96. package/dist/node_modules/just-bash/package.json +1 -1
  97. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  98. package/dist/node_modules/openai/package.json +1 -1
  99. package/dist/node_modules/zod/package.json +1 -1
  100. package/dist/server/llm-providers/anthropic.js +17 -23
  101. package/dist/server/llm-providers/dashscope.js +3 -3
  102. package/dist/server/llm-providers/deepseek.js +2 -2
  103. package/dist/server/llm-providers/google-genai.js +17 -22
  104. package/dist/server/llm-providers/kimi/provider.js +4 -4
  105. package/dist/server/llm-providers/mimo.js +2 -2
  106. package/dist/server/llm-providers/ollama.js +14 -21
  107. package/dist/server/llm-providers/openai/completions.js +2 -2
  108. package/dist/server/llm-providers/openai/embedding.js +1 -1
  109. package/dist/server/llm-providers/openai/responses.js +2 -2
  110. package/dist/server/llm-providers/provider.d.ts +3 -1
  111. package/dist/server/llm-providers/provider.js +55 -22
  112. package/dist/server/llm-providers/xai.js +2 -2
  113. package/dist/server/resource/ai.js +11 -9
  114. package/dist/server/workflow/nodes/employee/index.js +2 -4
  115. package/dist/server/workflow/nodes/employee/types.d.ts +2 -2
  116. package/package.json +2 -2
  117. package/dist/ai/docs/nocobase/api/cli/app/down.md +0 -41
@@ -0,0 +1,163 @@
1
+ ---
2
+ title: "Production Deployment"
3
+ description: "Deploy NocoBase in production with two final steps: enable app autostart and configure a reverse proxy."
4
+ keywords: "NocoBase,production deployment,nb app autostart,nb env proxy,Nginx,Caddy"
5
+ ---
6
+
7
+ # Production Deployment
8
+
9
+ If your NocoBase app is already running correctly on the server, production rollout usually only needs two more steps:
10
+
11
+ 1. Make sure the app starts automatically after the machine restarts
12
+ 2. Put a reverse proxy in front of the app for stable external access
13
+
14
+ In the NocoBase CLI, the main commands are:
15
+
16
+ - `nb app autostart`
17
+ - `nb env proxy`
18
+
19
+ This page gives the overall path first. For Nginx or Caddy details, continue to the corresponding subpages.
20
+
21
+ ## Step 1: Enable App Autostart
22
+
23
+ In production, the first priority is not the domain name. The first priority is making sure the service can recover reliably after a reboot, container recreation, or routine maintenance.
24
+
25
+ In the CLI, `nb app autostart` is a command group. The most commonly used commands are:
26
+
27
+ - `nb app autostart enable`
28
+ - `nb app autostart list`
29
+ - `nb app autostart run`
30
+
31
+ Enable autostart for the current env:
32
+
33
+ ```bash
34
+ nb app autostart enable
35
+ ```
36
+
37
+ If you want to target a different env explicitly:
38
+
39
+ ```bash
40
+ nb app autostart enable --env app1 --yes
41
+ ```
42
+
43
+ Then check which envs are marked for autostart:
44
+
45
+ ```bash
46
+ nb app autostart list
47
+ ```
48
+
49
+ After the system boots, run the following command to start every env that has autostart enabled:
50
+
51
+ ```bash
52
+ nb app autostart run
53
+ ```
54
+
55
+ If you want the underlying startup output for troubleshooting:
56
+
57
+ ```bash
58
+ nb app autostart run --verbose
59
+ ```
60
+
61
+ :::tip What this actually does
62
+
63
+ `nb app autostart enable` marks a CLI-managed env as allowed to start automatically.
64
+ `nb app autostart run` is the command that actually starts all envs that were marked for autostart.
65
+
66
+ In other words, in a real production setup you usually still need to wire `nb app autostart run` into your own system startup flow, such as `systemd`, a container platform startup script, or another host-level boot mechanism you already use.
67
+
68
+ :::
69
+
70
+ ### Scope
71
+
72
+ `nb app autostart` only applies to envs with a CLI-managed runtime on the current machine:
73
+
74
+ - `local`
75
+ - `docker`
76
+
77
+ If the env is only a remote API connection, or the app is not managed locally by the CLI on this machine, these commands are not the right tool for autostart.
78
+
79
+ ## Step 2: Configure a Reverse Proxy
80
+
81
+ Once the app can recover automatically, the next step is to handle the external entry point. In production, the reverse proxy usually takes care of:
82
+
83
+ - binding the domain name or public port
84
+ - forwarding HTTP and WebSocket traffic to NocoBase
85
+ - handling HTTPS, certificates, caching, or access control
86
+
87
+ In the NocoBase CLI, the recommended entry points are:
88
+
89
+ - `nb env proxy nginx`
90
+ - `nb env proxy caddy`
91
+
92
+ ### Default Approach
93
+
94
+ If your app is already saved as a CLI env and is a `local` or `docker` env, letting the CLI generate the proxy config is usually enough:
95
+
96
+ ```bash
97
+ nb env proxy nginx --env app1 --host app.example.com
98
+ nb env proxy caddy --env app1 --host app.example.com
99
+ ```
100
+
101
+ If the current env is already the target env, you can omit `--env`:
102
+
103
+ ```bash
104
+ nb env proxy nginx --host app.example.com
105
+ ```
106
+
107
+ The CLI helps cover details that are easy to miss in handwritten configs, such as:
108
+
109
+ - WebSocket forwarding
110
+ - entry and static asset paths for subpath deployments
111
+ - SPA fallback pages
112
+ - provider shared config files
113
+
114
+ ### When To Choose Nginx Or Caddy
115
+
116
+ You can usually decide like this:
117
+
118
+ | Scenario | Recommended |
119
+ | --- | --- |
120
+ | You already use Nginx for sites, caching, certificates, or access control | [Nginx](./reverse-proxy/nginx.md) |
121
+ | You already have a domain and want HTTPS working quickly with less TLS maintenance | [Caddy](./reverse-proxy/caddy.md) |
122
+ | You want the overall explanation of this command group first | [Production Reverse Proxy](./reverse-proxy/index.md) |
123
+
124
+ If you change env settings that affect the proxy result, such as `app-port` or `app-public-path`, remember to rerun the corresponding proxy subcommand.
125
+
126
+ ## Recommended Rollout Path
127
+
128
+ If you want the simplest production path, this order usually works well:
129
+
130
+ 1. Make sure the app can already start correctly on the server itself
131
+ 2. Run `nb app autostart enable`
132
+ 3. Add `nb app autostart run` to your system startup process
133
+ 4. Choose Nginx or Caddy and run the matching `nb env proxy` subcommand
134
+ 5. Verify external access through the final domain or public entry address
135
+
136
+ ## Quick Links
137
+
138
+ | I want to... | Read this |
139
+ | --- | --- |
140
+ | Start with the overall reverse proxy explanation | [Production Reverse Proxy](./reverse-proxy/index.md) |
141
+ | Keep using Nginx for the entry layer | [Nginx](./reverse-proxy/nginx.md) |
142
+ | Use Caddy for a faster HTTPS setup | [Caddy](./reverse-proxy/caddy.md) |
143
+ | Manage start, stop, logs, and upgrades | [Manage Apps](../operations/manage-app.md) |
144
+ | Read the `nb env proxy` CLI reference | [`nb env proxy`](../../api/cli/env/proxy/index.md) |
145
+
146
+ ## Related Commands
147
+
148
+ ```bash
149
+ # Enable autostart for one env
150
+ nb app autostart enable --env app1 --yes
151
+
152
+ # List autostart status
153
+ nb app autostart list
154
+
155
+ # Start all envs with autostart enabled
156
+ nb app autostart run
157
+
158
+ # Generate Nginx reverse proxy config
159
+ nb env proxy nginx --env app1 --host app.example.com
160
+
161
+ # Generate Caddy reverse proxy config
162
+ nb env proxy caddy --env app1 --host app.example.com
163
+ ```
@@ -0,0 +1,158 @@
1
+ # Caddy
2
+
3
+ If you already have a domain and want to get HTTPS running quickly, Caddy is usually the easiest choice. Compared with maintaining Nginx certificate config yourself, Caddy is more like the shortcut path for getting the entry layer online first.
4
+
5
+ The default recommendation is to run `nb env proxy caddy` directly.
6
+
7
+ ## When Caddy is usually the better fit
8
+
9
+ These cases usually favor Caddy first:
10
+
11
+ - You already have a domain and want HTTPS quickly
12
+ - You do not want to maintain too many certificate and TLS details yourself
13
+ - You only need a simple and stable entry layer
14
+
15
+ If you already use Nginx across the server to manage many sites, or you still need heavier caching, access control, and custom rules, [Nginx](./nginx.md) is usually the better fit.
16
+
17
+ ## Default path: let the CLI generate the Caddy config
18
+
19
+ If your app has already been saved as a CLI env and the env type is `local` or `docker`, the default recommendation is still to let the CLI generate the config. That way, routing details related to NocoBase paths, WebSocket handling, and subpaths stay managed by the CLI, and you only need to care about the site entry itself.
20
+
21
+ The most direct form is:
22
+
23
+ ```bash
24
+ nb env proxy caddy --env demo --host demo.example.com
25
+ ```
26
+
27
+ If you have already switched to the current env, you can also omit `--env`:
28
+
29
+ ```bash
30
+ nb env proxy caddy --host demo.example.com
31
+ ```
32
+
33
+ If you also want to specify the entry port, add it at the same time:
34
+
35
+ ```bash
36
+ nb env proxy caddy --env demo --host demo.example.com --port 8080
37
+ ```
38
+
39
+ `--host` is important here. Caddy decides whether to manage HTTPS based on the site address. In production, try to pass a domain that already resolves to the current server.
40
+
41
+ ### Which files the CLI generates
42
+
43
+ If you do not pass `--output`, the Caddy provider keeps three layers of files under `~/.nocobase/proxy/caddy/<env>/`:
44
+
45
+ | File | Purpose |
46
+ | --- | --- |
47
+ | `generated.caddy` | The actual reverse-proxy config managed by the CLI and overwritten every time you run `nb env proxy caddy` |
48
+ | `app.caddy` | Editable site entry file where you can add site-level config |
49
+ | `~/.nocobase/proxy/caddy/nocobase.caddy` | Shared main config that imports every env `app.caddy` |
50
+
51
+ Where:
52
+
53
+ - `generated.caddy` is only meant to be managed by the CLI and should not be edited manually
54
+ - `app.caddy` is editable, but you should keep the generated import inserted by the CLI
55
+ - `nocobase.caddy` is mainly used by `--install`
56
+
57
+ :::warning Note
58
+
59
+ If you need to add site-level Caddy config such as extra headers, authentication, rate limiting, or compression rules, edit `app.caddy`. `generated.caddy` will be overwritten the next time you run `nb env proxy caddy`.
60
+
61
+ :::
62
+
63
+ ### Install the shared config into Caddy and reload it
64
+
65
+ If you want the CLI to connect the shared config to the Caddy main config and immediately validate and reload Caddy, run:
66
+
67
+ ```bash
68
+ nb env proxy caddy --env demo --host demo.example.com --install --reload
69
+ ```
70
+
71
+ These flags are split like this:
72
+
73
+ - `--install` connects `~/.nocobase/proxy/caddy/nocobase.caddy` to the Caddy main config
74
+ - `--reload` validates the config first and then reloads Caddy
75
+
76
+ If your Caddy executable is not on the default path, set the CLI config first:
77
+
78
+ ```bash
79
+ nb config set bin.caddy /usr/bin/caddy
80
+ ```
81
+
82
+ ### When should you change `proxy.nb-cli-root`
83
+
84
+ Most setups do not need to change `proxy.nb-cli-root`. You usually need it only when Caddy runs in another container, mount root, or path view and cannot see the current user's `~/.nocobase` path.
85
+
86
+ For example, if Caddy sees that path as `/workspace/.nocobase/...` inside a container, set:
87
+
88
+ ```bash
89
+ nb config set proxy.nb-cli-root /workspace
90
+ nb env proxy caddy --env demo --install --reload
91
+ ```
92
+
93
+ If you only want to preview the generated result, use:
94
+
95
+ ```bash
96
+ nb env proxy caddy --env demo --print
97
+ ```
98
+
99
+ If you want to write the generated route fragment to a custom file, use:
100
+
101
+ ```bash
102
+ nb env proxy caddy --env demo --output ./generated.caddy
103
+ ```
104
+
105
+ For the full parameter reference, see [`nb env proxy caddy`](../../../api/cli/env/proxy/caddy.md).
106
+
107
+ ## Handwritten config: what to do without the CLI
108
+
109
+ If your app is not managed by the CLI, or you explicitly want to maintain the full `Caddyfile` yourself, start with this minimal version:
110
+
111
+ ```text
112
+ your-domain.com {
113
+ encode zstd gzip
114
+ reverse_proxy 127.0.0.1:13000
115
+ }
116
+ ```
117
+
118
+ Where:
119
+
120
+ - Replace `your-domain.com` with your domain
121
+ - Replace `127.0.0.1:13000` with the real address your NocoBase app listens on
122
+
123
+ If the domain already resolves to the current server correctly, Caddy usually handles HTTPS certificate issuance and renewal automatically.
124
+
125
+ If you do not have a domain yet and only want to verify the reverse-proxy chain first, you can listen on a port:
126
+
127
+ ```text
128
+ :80 {
129
+ reverse_proxy 127.0.0.1:13000
130
+ }
131
+ ```
132
+
133
+ In production, though, it is still better to switch to a domain-based site address as soon as possible so Caddy can also take over HTTPS.
134
+
135
+ If your app is not mounted at `/` but under a subpath, handwritten Caddy config also means you need to confirm application variables such as `APP_PUBLIC_PATH` and `WS_PATH`. In that case, it is usually easier to go back to `nb env proxy caddy` and let the CLI generate the config.
136
+
137
+ ## Validate and reload the config
138
+
139
+ ```bash
140
+ caddy validate --config /etc/caddy/Caddyfile
141
+ systemctl reload caddy
142
+ ```
143
+
144
+ If you do not manage Caddy with `systemd`, use your own startup and reload workflow.
145
+
146
+ ## Notes
147
+
148
+ - `nb env proxy caddy` only works for CLI-managed envs whose runtime is reachable from the current machine, which means `local` or `docker`
149
+ - If the command says the env is missing `appPort`, run `nb env update <name> --app-port <port>` first
150
+ - `--output` and `--print` are useful for preview or custom integration, but they do not additionally create `app.caddy` or the shared main config
151
+ - If you already have a domain that resolves correctly to the server, Caddy is often the fastest way to get HTTPS working
152
+
153
+ ## Related links
154
+
155
+ - [`nb env proxy caddy`](../../../api/cli/env/proxy/caddy.md)
156
+ - [Install with CLI (Recommended)](../../installation/cli.md)
157
+ - [Install with Docker Compose](../../installation/docker-compose.md)
158
+ - [App Environment Variables](../../installation/env.md)
@@ -0,0 +1,100 @@
1
+ ---
2
+ title: 'Reverse Proxy for Production'
3
+ description: 'Use nb env proxy nginx and nb env proxy caddy to generate reverse-proxy configs for CLI-managed NocoBase envs.'
4
+ keywords: 'NocoBase,nb env proxy nginx,nb env proxy caddy,reverse proxy,Nginx,Caddy,production'
5
+ ---
6
+
7
+ # Reverse Proxy for Production
8
+
9
+ In NocoBase CLI, there are two recommended entry points for putting a reverse proxy in front of a production app:
10
+
11
+ - `nb env proxy nginx`
12
+ - `nb env proxy caddy`
13
+
14
+ As long as your app has already been saved as a CLI env and the env type is `local` or `docker`, letting the CLI generate the config is usually enough. That way, the CLI keeps tricky details such as WebSocket handling, subpaths, SPA fallback pages, and later updates in sync. You only need to decide whether the entry layer should keep using Nginx or move to Caddy.
15
+
16
+ If your app is not managed by the CLI, or if you explicitly want to handwrite the full proxy config, go straight to the handwritten-config section in the provider pages.
17
+
18
+ ## Check whether this path fits your setup
19
+
20
+ - Your app is already reachable through an internal address such as `http://127.0.0.1:13000`
21
+ - The app has already been saved as a CLI env, and the env type is `local` or `docker`
22
+ - The env already has `appPort` saved
23
+
24
+ If the command says the env is missing `appPort`, run [`nb env update`](../../../api/cli/env/update.md) first and save it.
25
+
26
+ If you later change settings such as `app-port` or `app-public-path` that affect proxy output, remember to rerun the matching proxy subcommand.
27
+
28
+ ## Default path: let the CLI generate the config first
29
+
30
+ If you already know which entry provider you want to keep using, go straight to that subcommand:
31
+
32
+ ```bash
33
+ nb env proxy nginx --env demo --host demo.example.com
34
+ nb env proxy caddy --env demo --host demo.example.com
35
+ ```
36
+
37
+ If you have already switched to the current env, you can also omit `--env`:
38
+
39
+ ```bash
40
+ nb env proxy nginx --host demo.example.com
41
+ ```
42
+
43
+ Where:
44
+
45
+ - If you already use Nginx to manage sites, caching, access control, or certificates, start with [`nb env proxy nginx`](../../../api/cli/env/proxy/nginx.md)
46
+ - If you want HTTPS running quickly and do not want to maintain many TLS details yourself, start with [`nb env proxy caddy`](../../../api/cli/env/proxy/caddy.md)
47
+ - `--port` is the proxy entry port, not the app `appPort`
48
+
49
+ If you want the CLI to also connect the shared config to the provider main config and reload it after validation, add:
50
+
51
+ ```bash
52
+ nb env proxy nginx --env demo --host demo.example.com --install --reload
53
+ ```
54
+
55
+ For the full command reference, see [`nb env proxy`](../../../api/cli/env/proxy/index.md).
56
+
57
+ ## What the CLI keeps in sync for you
58
+
59
+ The CLI does more than generate one proxy snippet. It also maintains provider-specific helper files. The output shape differs between the two providers:
60
+
61
+ - Nginx keeps `app.conf`, `public/index-v1.html`, `public/index-v2.html`, the shared `nocobase.conf`, and the shared `snippets/`
62
+ - Caddy keeps `generated.caddy`, `app.caddy`, and the shared `nocobase.caddy`
63
+
64
+ :::warning Note
65
+
66
+ If you need to add site-level configuration, edit `app.conf` or `app.caddy`. Do not manually edit CLI-managed helper files, because they will be overwritten the next time you run the command.
67
+
68
+ :::
69
+
70
+ ## Which page should you open first
71
+
72
+ | I want to... | Go here |
73
+ | --- | --- |
74
+ | Keep using Nginx to manage sites, certificates, caching, or access control | [Nginx](./nginx.md) |
75
+ | Get HTTPS running quickly and maintain fewer certificate and TLS details | [Caddy](./caddy.md) |
76
+ | Review the command tree and choose a provider first | [`nb env proxy`](../../../api/cli/env/proxy/index.md) |
77
+ | See the Nginx subcommand options, output files, and examples first | [`nb env proxy nginx`](../../../api/cli/env/proxy/nginx.md) |
78
+ | See the Caddy subcommand options, output files, and examples first | [`nb env proxy caddy`](../../../api/cli/env/proxy/caddy.md) |
79
+ | Adjust env settings that may affect proxy output, such as `app-port` or `app-public-path` | [`nb env update`](../../../api/cli/env/update.md) |
80
+ | Install the app as a CLI-managed env first | [Install with CLI (Recommended)](../../installation/cli.md) |
81
+
82
+ ## When the CLI-generated path is not the best fit
83
+
84
+ These cases are usually better served by the handwritten-config section in the provider pages:
85
+
86
+ - Your app is not managed by the CLI
87
+ - The env only has a remote API connection, or it is an SSH env
88
+ - You explicitly want to maintain the full Nginx config or full `Caddyfile` yourself
89
+
90
+ As long as the app has already been saved as a CLI env and the current machine can reach its runtime, the default recommendation is still to start with these commands. It makes later domain changes, site-level adjustments, and regeneration much easier to manage.
91
+
92
+ ## Related links
93
+
94
+ - [`nb env proxy`](../../../api/cli/env/proxy/index.md)
95
+ - [`nb env proxy nginx`](../../../api/cli/env/proxy/nginx.md)
96
+ - [`nb env proxy caddy`](../../../api/cli/env/proxy/caddy.md)
97
+ - [Nginx](./nginx.md)
98
+ - [Caddy](./caddy.md)
99
+ - [App Environment Variables](../../installation/env.md)
100
+ - [Install with CLI (Recommended)](../../installation/cli.md)
@@ -0,0 +1,166 @@
1
+ # Nginx
2
+
3
+ If you already use Nginx on the server to manage sites, or you still want to manage certificates, caching, or access control yourself, staying with Nginx is the most direct path. For CLI-managed NocoBase envs, this is also the default recommendation.
4
+
5
+ If you mainly want to get HTTPS running quickly and do not want to maintain many proxy details yourself, [Caddy](./caddy.md) is the easier path. But if Nginx is already part of your stack, this page is the default place to start.
6
+
7
+ ## Confirm these two things first
8
+
9
+ - NocoBase is already reachable through an internal address such as `http://127.0.0.1:13000`
10
+ - You know whether this deployment is a CLI-managed env or a fully handwritten setup
11
+
12
+ Once those two things are clear, the next step is usually straightforward:
13
+
14
+ - If the app has already been saved as a CLI env and the env type is `local` or `docker`, use `nb env proxy nginx`
15
+ - If the app is not managed by the CLI, or you explicitly want to maintain the full Nginx config yourself, handwrite the `server` block
16
+
17
+ ## Default path: let the CLI generate the Nginx config
18
+
19
+ If your app was installed, adopted, or saved through NocoBase CLI as a `local` or `docker` env, the default recommendation is to run `nb env proxy nginx`. The CLI maintains the editable entry file, SPA fallback pages, shared main config, and shared snippets together, which makes it much less likely to miss WebSocket handling, subpaths, or later updates.
20
+
21
+ Start by generating a config for a specific env:
22
+
23
+ ```bash
24
+ nb env proxy nginx --env demo
25
+ ```
26
+
27
+ If you have already switched to the current env, you can also omit `--env`:
28
+
29
+ ```bash
30
+ nb env proxy nginx
31
+ ```
32
+
33
+ If you already know the public domain or entry port, you can write them at generation time:
34
+
35
+ ```bash
36
+ nb env proxy nginx --env demo --host demo.example.com
37
+ nb env proxy nginx --env demo --host demo.example.com --port 8080
38
+ ```
39
+
40
+ Here, `--port` is the proxy entry port, not the port the NocoBase app itself listens on. The upstream app port comes from the saved env `appPort`.
41
+
42
+ ### Which files the CLI generates
43
+
44
+ The Nginx provider keeps these files under `~/.nocobase/proxy/nginx/`:
45
+
46
+ | File | Purpose |
47
+ | --- | --- |
48
+ | `~/.nocobase/proxy/nginx/<env>/app.conf` | Editable site entry file. The CLI refreshes the managed block inside it, and you can add site-level config around that block |
49
+ | `~/.nocobase/proxy/nginx/<env>/public/index-v1.html` | v1 SPA fallback page generated from the current active client's `index.html` |
50
+ | `~/.nocobase/proxy/nginx/<env>/public/index-v2.html` | v2 SPA fallback page generated from the current active client's `v/index.html` |
51
+ | `~/.nocobase/proxy/nginx/nocobase.conf` | Shared main config that includes every env `app.conf` |
52
+ | `~/.nocobase/proxy/nginx/snippets/` | Shared snippets directory copied from built-in templates |
53
+
54
+ Where:
55
+
56
+ - `app.conf` is editable, but you should keep the managed block between `# BEGIN NocoBase managed config` and `# END NocoBase managed config`
57
+ - `index-v1.html` and `index-v2.html` automatically rewrite asset URLs according to the current env subpath, active client version, and `CDN_BASE_URL`
58
+ - `nocobase.conf` is mainly used by `--install`
59
+ - Files under `snippets/` and `public/` are usually not meant to be edited manually and will be resynced the next time you run the command
60
+
61
+ :::warning Note
62
+
63
+ If you need to add site-level Nginx config such as rate limits, extra headers, or access control, edit `app.conf`. Managed files under `public/` and `snippets/` will be overwritten the next time you run `nb env proxy nginx`.
64
+
65
+ :::
66
+
67
+ ### Install the shared config into Nginx and reload it
68
+
69
+ If you want the CLI to connect the shared config to the Nginx main config and immediately validate and reload Nginx, run:
70
+
71
+ ```bash
72
+ nb env proxy nginx --env demo --host demo.example.com --install --reload
73
+ ```
74
+
75
+ These flags are split like this:
76
+
77
+ - `--install` connects `~/.nocobase/proxy/nginx/nocobase.conf` to the Nginx main config
78
+ - `--reload` validates the config first and then reloads Nginx
79
+
80
+ If your Nginx executable is not on the default path, set the CLI config first:
81
+
82
+ ```bash
83
+ nb config set bin.nginx /usr/sbin/nginx
84
+ ```
85
+
86
+ ### When should you change `proxy.nb-cli-root`
87
+
88
+ Most setups do not need to change `proxy.nb-cli-root`. You usually need it only when Nginx runs in another container, mount root, or path view and cannot see the current user's `~/.nocobase` path.
89
+
90
+ For example, if Nginx sees that path as `/workspace/.nocobase/...` inside a container, set:
91
+
92
+ ```bash
93
+ nb config set proxy.nb-cli-root /workspace
94
+ nb env proxy nginx --env demo --install --reload
95
+ ```
96
+
97
+ If you only want to preview the rendered `app.conf`, you can also use:
98
+
99
+ ```bash
100
+ nb env proxy nginx --env demo --print
101
+ ```
102
+
103
+ The Nginx provider does not support `--output`. For the full parameter reference, see [`nb env proxy nginx`](../../../api/cli/env/proxy/nginx.md).
104
+
105
+ ## Handwritten config: what to do without the CLI
106
+
107
+ If your app is not managed by the CLI, or you explicitly want to maintain the full Nginx config yourself, start with this minimal version. In most cases, one `server` block is enough.
108
+
109
+ Create a config file on the server, for example `/etc/nginx/conf.d/nocobase.conf`:
110
+
111
+ ```nginx
112
+ server {
113
+ listen 80;
114
+ server_name your-domain.com;
115
+
116
+ client_max_body_size 100m;
117
+
118
+ location / {
119
+ proxy_pass http://127.0.0.1:13000;
120
+ proxy_http_version 1.1;
121
+ proxy_set_header Host $host;
122
+ proxy_set_header X-Real-IP $remote_addr;
123
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
124
+ proxy_set_header X-Forwarded-Proto $scheme;
125
+ proxy_set_header Upgrade $http_upgrade;
126
+ proxy_set_header Connection "upgrade";
127
+ }
128
+ }
129
+ ```
130
+
131
+ Where:
132
+
133
+ - Replace `server_name` with your domain
134
+ - Replace `127.0.0.1:13000` with the real address your NocoBase app listens on
135
+ - Adjust `client_max_body_size` to match your upload needs
136
+
137
+ If your app is not mounted at `/` but under a subpath such as `/app/`, handwritten configs also need you to confirm application variables such as `APP_PUBLIC_PATH` and `WS_PATH`. In that case, it is usually easier to go back to `nb env proxy nginx` and let the CLI handle the routing details.
138
+
139
+ ## Validate and reload the config
140
+
141
+ ```bash
142
+ nginx -t
143
+ systemctl reload nginx
144
+ ```
145
+
146
+ If you do not manage Nginx with `systemd`, use your own reload workflow.
147
+
148
+ ## How to handle HTTPS
149
+
150
+ If you have already decided to stay with Nginx, you can keep handling HTTPS there as well. A common next step is to expand `listen 80` into dual `80/443` entry points and add your certificate paths and TLS config.
151
+
152
+ But if you mainly want working HTTPS as quickly as possible and do not want to deal with certificate issuance and renewal yourself, switching to [Caddy](./caddy.md) is usually easier.
153
+
154
+ ## Notes
155
+
156
+ - `nb env proxy nginx` only works for CLI-managed envs whose runtime is reachable from the current machine, which means `local` or `docker`
157
+ - If the command says the env is missing `appPort`, run `nb env update <name> --app-port <port>` first
158
+ - `nb env proxy nginx` does not support `--output`. If you only want to preview the entry file, use `--print`
159
+ - If you already have a large custom Nginx main config, the CLI-generated config usually fits best as a site fragment that you include, not as a replacement for the whole main config
160
+
161
+ ## Related links
162
+
163
+ - [`nb env proxy nginx`](../../../api/cli/env/proxy/nginx.md)
164
+ - [Install with CLI (Recommended)](../../installation/cli.md)
165
+ - [Install with Docker Compose](../../installation/docker-compose.md)
166
+ - [App Environment Variables](../../installation/env.md)
@@ -0,0 +1 @@
1
+ # 发布管理