@nocobase/plugin-ai 2.1.0-beta.46 → 2.1.0-beta.48

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 (82) hide show
  1. package/dist/ai/docs/nocobase/api/cli/app/restart.md +1 -3
  2. package/dist/ai/docs/nocobase/api/cli/app/start.md +1 -7
  3. package/dist/ai/docs/nocobase/api/cli/config/delete.md +7 -5
  4. package/dist/ai/docs/nocobase/api/cli/config/get.md +7 -5
  5. package/dist/ai/docs/nocobase/api/cli/config/index.md +38 -18
  6. package/dist/ai/docs/nocobase/api/cli/config/set.md +9 -7
  7. package/dist/ai/docs/nocobase/api/cli/env/index.md +19 -20
  8. package/dist/ai/docs/nocobase/api/cli/env/update.md +72 -72
  9. package/dist/ai/docs/nocobase/api/cli/index.md +0 -1
  10. package/dist/ai/docs/nocobase/api/cli/init.md +30 -0
  11. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/current.md +33 -0
  12. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/generate.md +54 -0
  13. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/index.md +60 -0
  14. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/info.md +42 -0
  15. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/reload.md +32 -0
  16. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/restart.md +32 -0
  17. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/start.md +32 -0
  18. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/status.md +36 -0
  19. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/stop.md +32 -0
  20. package/dist/ai/docs/nocobase/api/cli/proxy/caddy/use.md +38 -0
  21. package/dist/ai/docs/nocobase/api/cli/proxy/index.md +124 -0
  22. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/current.md +33 -0
  23. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/generate.md +62 -0
  24. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/index.md +60 -0
  25. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/info.md +43 -0
  26. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/reload.md +32 -0
  27. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/restart.md +32 -0
  28. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/start.md +32 -0
  29. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/status.md +36 -0
  30. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/stop.md +32 -0
  31. package/dist/ai/docs/nocobase/api/cli/proxy/nginx/use.md +38 -0
  32. package/dist/ai/docs/nocobase/data-sources/data-source-external-nocobase/index.md +157 -0
  33. package/dist/ai/docs/nocobase/data-sources/data-source-manager/index.md +5 -0
  34. package/dist/ai/docs/nocobase/ops-management/version-control/index.md +79 -0
  35. package/dist/ai/docs/nocobase/plugins/@nocobase/plugin-version-control/index.md +14 -0
  36. package/dist/ai/docs/nocobase/quickstart/production/index.md +75 -69
  37. package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/caddy.md +211 -80
  38. package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/index.md +72 -53
  39. package/dist/ai/docs/nocobase/quickstart/production/reverse-proxy/nginx.md +186 -89
  40. package/dist/client/{290.0888139e33c9b7cb.js → 290.0f7f441d8a94f03c.js} +1 -1
  41. package/dist/client/{428.431a00d29107058e.js → 428.fdd0cc3cfd1632ef.js} +1 -1
  42. package/dist/client/ai-employees/chatbox/hooks/useChat.d.ts +14 -14
  43. package/dist/client/ai-employees/chatbox/stores/chat-box.d.ts +1 -105
  44. package/dist/client/ai-employees/chatbox/stores/chat-conversations.d.ts +1 -37
  45. package/dist/client/ai-employees/chatbox/stores/chat-messages.d.ts +1 -109
  46. package/dist/client/index.js +3 -3
  47. package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +17 -0
  48. package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +113 -0
  49. package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +45 -0
  50. package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +118 -0
  51. package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +18 -0
  52. package/dist/client-v2/ai-employees/chatbox/stores/global-store.d.ts +9 -0
  53. package/dist/client-v2/ai-employees/types.d.ts +151 -0
  54. package/dist/client-v2/index.d.ts +8 -1
  55. package/dist/client-v2/index.js +1 -1
  56. package/dist/client-v2/repositories/AIConfigRepository.d.ts +81 -0
  57. package/dist/client-v2/repositories/hooks/useAIConfigRepository.d.ts +10 -0
  58. package/dist/collections/ai-context-datasource.js +1 -0
  59. package/dist/externalVersion.js +16 -16
  60. package/dist/node_modules/@langchain/xai/package.json +1 -1
  61. package/dist/node_modules/fs-extra/package.json +1 -1
  62. package/dist/node_modules/jsonrepair/package.json +1 -1
  63. package/dist/node_modules/just-bash/package.json +1 -1
  64. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  65. package/dist/node_modules/openai/package.json +1 -1
  66. package/dist/node_modules/zod/package.json +1 -1
  67. package/dist/server/collections/ai-conversations.js +1 -0
  68. package/dist/server/collections/ai-employees.js +1 -0
  69. package/dist/server/collections/ai-files.js +1 -0
  70. package/dist/server/collections/ai-messages.js +1 -0
  71. package/dist/server/collections/ai-settings.js +1 -0
  72. package/dist/server/collections/ai-tool-messages.js +1 -0
  73. package/dist/server/collections/lc-checkpoint-blobs.js +1 -0
  74. package/dist/server/collections/lc-checkpoint-writes.js +1 -0
  75. package/dist/server/collections/lc-checkpoints.js +1 -0
  76. package/dist/server/collections/llm-services.js +1 -0
  77. package/dist/server/collections/users-ai-employees.js +1 -0
  78. package/package.json +2 -2
  79. package/dist/ai/docs/nocobase/ai/install-upgrade-migration.mdx +0 -402
  80. package/dist/ai/docs/nocobase/api/cli/env/proxy/caddy.md +0 -108
  81. package/dist/ai/docs/nocobase/api/cli/env/proxy/index.md +0 -54
  82. package/dist/ai/docs/nocobase/api/cli/env/proxy/nginx.md +0 -104
@@ -1,402 +0,0 @@
1
- ---
2
- title: 'Installation and Upgrade Migration Guide: Using NocoBase CLI'
3
- description: 'Migrate from legacy Docker, create-nocobase-app, and Git source installation upgrade methods to the new NocoBase CLI workflow.'
4
- keywords: 'NocoBase CLI,installation migration,upgrade migration,nb init,nb app upgrade,Docker,create-nocobase-app,Git source'
5
- ---
6
-
7
- # Installation and Upgrade Migration Guide: Using NocoBase CLI
8
-
9
- :::danger
10
- The CLI's installation and application maintenance capabilities are still under development. At present, it is more suitable for local development, test environments, and AI Agent integration scenarios, and is not recommended for direct installation, upgrade, operation, and maintenance in production environments.
11
- :::
12
-
13
- The new NocoBase CLI (`nb`) unifies installation, connection, startup, shutdown, log viewing, upgrade, and cleanup into one set of commands. Compared with the separate workflows in the old documentation for Docker, create-nocobase-app, and Git source, the CLI is better suited for local development, test environment maintenance, and AI Agent integration and collaboration.
14
-
15
- This article applies to the following scenarios:
16
-
17
- - You are installing or upgrading NocoBase according to the old documentation and want to switch to the new CLI approach.
18
- - You already have a NocoBase deployed in a legacy way and want the CLI to manage or connect to it.
19
- - You need to prepare a connectable and maintainable NocoBase environment for an AI Agent.
20
-
21
- ## Differences between the old and new approaches
22
-
23
- The old approach splits documentation by installation source, and each source requires separate download, configuration, installation, startup, and upgrade commands.
24
-
25
- **Old installation documentation**
26
-
27
- - [Docker installation](/get-started/installation/docker)
28
- - [create-nocobase-app installation](/get-started/installation/create-nocobase-app)
29
- - [Git source installation](/get-started/installation/git)
30
-
31
- **Old upgrade documentation**
32
-
33
- - [Upgrading a Docker installation](/get-started/upgrading/docker)
34
- - [Upgrading a create-nocobase-app installation](/get-started/upgrading/create-nocobase-app)
35
- - [Upgrading a Git source installation](/get-started/upgrading/git)
36
-
37
- The new approach uses `nb init` as the entry point and records the application source, runtime directory, storage directory, database, and API connection information in a CLI env. After that, whether the source is Docker, npm, or Git, maintenance uses the same set of `nb app`, `nb source`, and `nb db` commands as much as possible.
38
-
39
- | Scenario | Old approach | New CLI approach |
40
- | ----------------------------------- | --------------------------------------------------------- | ------------------------------------------------- |
41
- | Installation entry point | `docker compose`, `create-nocobase-app`, `git clone` | `nb init` or `nb init --ui` |
42
- | Application runtime management | Switch directories, modify compose, run yarn/pm2 commands | `nb app start/stop/restart/logs`, `nb env remove` |
43
- | Upgrade | One set of commands per installation method | `nb app upgrade -e <env>` |
44
- | Development mode | `yarn dev` | `nb source dev -e <env>` |
45
- | Database status | Manually inspect containers or database services | `nb db ps -e <env>` |
46
- | View environment status and details | Manually record paths, ports, and access URLs | `nb env list`, `nb env info <env>` |
47
- | Access existing applications | Not covered uniformly in old installation docs | `nb init --ui` or `nb init --api-base-url` |
48
-
49
- ## Install the CLI
50
-
51
- ```bash
52
- npm install -g @nocobase/cli@beta
53
- nb --version
54
- ```
55
-
56
- After installation, you can view the help:
57
-
58
- ```bash
59
- nb --help
60
- nb init --help
61
- ```
62
-
63
- ## Install NocoBase using the new approach
64
-
65
- ### Recommended: use the visual wizard
66
-
67
- ```bash
68
- nb init --ui
69
- ```
70
-
71
- The wizard will guide you to choose:
72
-
73
- - Create a new application or connect to an existing application
74
- - Installation source: Docker, npm, Git
75
- - NocoBase version
76
- - Use the built-in database or an external database
77
- - Administrator account and password
78
-
79
- ### Use the terminal interactive wizard
80
-
81
- ```bash
82
- nb init
83
- ```
84
-
85
- ### Use non-interactive commands
86
-
87
- The default installation method is Docker and uses the built-in PostgreSQL database:
88
-
89
- ```bash
90
- nb init --yes --env app1
91
- ```
92
-
93
- Install a specified version with Docker:
94
-
95
- ```bash
96
- nb init --yes --env app1 --source docker --version beta
97
- ```
98
-
99
- Install with npm:
100
-
101
- ```bash
102
- nb init --yes --env app1 --source npm --version beta --app-port 13080
103
- ```
104
-
105
- Install from Git source:
106
-
107
- ```bash
108
- nb init --yes --env app1 --source git --version beta
109
- ```
110
-
111
- Install from Git source and specify the built-in database type:
112
-
113
- ```bash
114
- nb init --yes --env app1 --source git --version beta --db-dialect mysql
115
- ```
116
-
117
- Connect to an existing NocoBase application:
118
-
119
- ```bash
120
- # Uses OAuth authentication by default
121
- nb init --yes --env app1 --api-base-url=http://next.v2.test.nocobase.com/nocobase/api
122
-
123
- # Use token authentication
124
- nb init --yes --env app1 \
125
- --api-base-url=http://next.v2.test.nocobase.com/nocobase/api \
126
- --auth-type=token \
127
- --access-token=<token>
128
- ```
129
-
130
- :::tip
131
- `--env` is the environment name in the CLI. Subsequent commands such as startup, upgrade, and log viewing can all specify the target application with `-e app1`.
132
- :::
133
-
134
- ## Upgrade using the new approach
135
-
136
- In the old approach, the upgrade commands for Docker, create-nocobase-app, and Git source were different; the new CLI unifies them as:
137
-
138
- ```bash
139
- nb app upgrade -e app1
140
- ```
141
-
142
- If you only want to run the upgrade process using the source code or image that has already been downloaded, without pulling new code or images:
143
-
144
- ```bash
145
- nb app upgrade -e app1 --skip-code-update
146
- ```
147
-
148
- Or use the short form:
149
-
150
- ```bash
151
- nb app upgrade -e app1 -s
152
- ```
153
-
154
- ## Common maintenance commands
155
-
156
- | Operation | Command |
157
- | -------------------------------------------------- | ------------------------------------ |
158
- | Start application | `nb app start -e app1` |
159
- | Stop application | `nb app stop -e app1` |
160
- | Restart application | `nb app restart -e app1` |
161
- | View logs | `nb app logs -e app1` |
162
- | View env and API authentication status | `nb env list` |
163
- | View env details | `nb env info app1` |
164
- | View built-in database status | `nb db ps -e app1` |
165
- | Upgrade application | `nb app upgrade -e app1` |
166
- | Stop application and built-in database | `nb app stop -e app1 --with-db` |
167
- | Completely remove env and locally hosted resources | `nb env remove app1 --purge --force` |
168
-
169
- If you just want to stop the application together with the built-in database managed by the CLI, the default is to simply use `nb app stop -e app1 --with-db`.
170
-
171
- If you are sure this env is no longer needed, then use `nb env remove app1 --purge --force`. It will remove hosted runtime resources, storage data, and, when applicable, local app files downloaded and managed by the CLI.
172
-
173
- ## Daily development commands
174
-
175
- `nb source` is used to manage local source projects and is mainly suitable for npm and Git source envs.
176
-
177
- | Operation | Command |
178
- | ----------------------------------- | --------------------------------------------------- |
179
- | Run application in development mode | `nb source dev -e app1` |
180
- | Build source code | `nb source build --cwd /your/workspace/app1/source` |
181
- | Run tests | `nb source test --cwd /your/workspace/app1/source` |
182
- | Download or refresh source/image | `nb source download --source git --version beta` |
183
-
184
- :::tip
185
- Docker envs are usually managed through `nb app start`, `nb app logs`, and `nb app upgrade`, and do not use `nb source dev`.
186
- :::
187
-
188
- ## NB_CLI_ROOT and directory structure
189
-
190
- The CLI stores global configuration and local application files in the directory corresponding to `NB_CLI_ROOT`.
191
-
192
- By default, `NB_CLI_ROOT` is the current user's home directory, that is, the path returned by Node.js `os.homedir()`. For example, on macOS it is usually `/Users/<user>`. Therefore, without additional configuration, the files generated by `nb init --yes --env app1` are usually located at:
193
-
194
- ```text
195
- ~
196
- ├── .nocobase
197
- │ └── config.json
198
- └── app1
199
- ├── source
200
- └── storage
201
- ```
202
-
203
- You can also explicitly specify `NB_CLI_ROOT`:
204
-
205
- ```bash
206
- export NB_CLI_ROOT=/your/workspace
207
- ```
208
-
209
- After setting it, the configuration file and default application directory will both be placed under that directory:
210
-
211
- ```text
212
- /your/workspace
213
- ├── .nocobase
214
- │ └── config.json
215
- └── app1
216
- ├── source
217
- └── storage
218
- ```
219
-
220
- Where:
221
-
222
- - `.nocobase/config.json` stores information such as envs, current environment, API address, source path, storage path, and database configuration.
223
- - `<envName>/source` is the source code or application directory managed by the CLI.
224
- - `<envName>/storage` is the application storage directory managed by the CLI.
225
-
226
- :::warning
227
- After initializing the same application, keep using the same `NB_CLI_ROOT`. If you later change `NB_CLI_ROOT`, the CLI will look for `.nocobase/config.json` in the new directory, and relative `appRootPath` and `storagePath` will also be resolved against the new directory, which may cause the application to not be found or to read and write to the wrong directory.
228
- :::
229
-
230
- The CLI currently only uses the global configuration scope. If you need to adjust where configuration and local application files are stored, set `NB_CLI_ROOT`.
231
-
232
- When viewing and locating applications, prefer `nb env list` and `nb env info`:
233
-
234
- ```bash
235
- # View configured envs and API authentication status
236
- nb env list
237
-
238
- # View detailed information for an env
239
- nb env info app1
240
- ```
241
-
242
- `nb env list` is intended for a quick overview. Here, `App Status` is the authentication status obtained by accessing the application API with the saved Token/OAuth credentials, and no longer displays database status. To view the running status of the built-in database, use:
243
-
244
- ```bash
245
- nb db ps -e app1
246
- ```
247
-
248
- Only use this when you need to switch the default env:
249
-
250
- ```bash
251
- nb env use app1
252
- ```
253
-
254
- ## Migrate from the old approach to CLI
255
-
256
- There are two migration strategies: **connect to an existing application**, or **bring a local application directory under CLI management**. If your old application is already running stably, it is recommended to first use "connect to an existing application", which has the lowest risk.
257
-
258
- ### Method 1: connect to an existing application
259
-
260
- Suitable for NocoBase instances already running via Docker, create-nocobase-app, Git source, or server deployment.
261
-
262
- ```bash
263
- # Uses OAuth authentication by default
264
- nb init --yes --env app1 --api-base-url=http://next.v2.test.nocobase.com/nocobase/api
265
-
266
- # Use token authentication
267
- nb init --yes --env "app$RANDOM" \
268
- --api-base-url=http://next.v2.test.nocobase.com/nocobase/api \
269
- --auth-type=token \
270
- --access-token=<token>
271
- ```
272
-
273
- This approach only stores the API connection. The CLI will not take over startup, shutdown, upgrade, source directory, or storage directory management of the old application. It is suitable for allowing AI Agents or CLI API commands to connect to existing applications.
274
-
275
- If you need to refresh authentication:
276
-
277
- ```bash
278
- nb env auth app1
279
- ```
280
-
281
- ### Method 2: create a new CLI env and then migrate files
282
-
283
- Suitable for scenarios where you want to use `nb app` and `nb source` to manage local applications afterward.
284
-
285
- Before migration, complete the following first:
286
-
287
- 1. Stop the old application.
288
- 2. Back up the old database.
289
- 3. Back up the old `storage` directory.
290
- 4. Record the key environment variables of the old application, such as `APP_KEY`, `TZ`, `DB_*`, and `DB_UNDERSCORED`.
291
-
292
- #### Migrate from an old Docker installation
293
-
294
- The old Docker approach usually stores application data in the project's `storage` directory:
295
-
296
- ```text
297
- /old-docker-project
298
- ├── docker-compose.yml
299
- └── storage
300
- ```
301
-
302
- It is recommended to first determine the new `NB_CLI_ROOT`, then use the CLI to create a new Docker env. The following example assumes that `NB_CLI_ROOT` is `/your/workspace`.
303
-
304
- ```bash
305
- export NB_CLI_ROOT=/your/workspace
306
- nb init --yes --env app2 --source docker --version beta
307
- nb app stop -e app2
308
- ```
309
-
310
- The new env will use the following directories by default:
311
-
312
- ```text
313
- /your/workspace
314
- └── app2
315
- ├── source
316
- └── storage
317
- ```
318
-
319
- Then copy the old `storage` to `/your/workspace/app2/storage`, and make sure the database connection, `APP_KEY`, and other configurations match the old environment.
320
-
321
- After the copy is complete and the database configuration is confirmed, start the application:
322
-
323
- ```bash
324
- nb app start -e app2
325
- nb app logs -e app2
326
- ```
327
-
328
- #### Migrate from an old create-nocobase-app or Git source installation
329
-
330
- The old npm/Git approach usually places the source code, `.env`, and `storage` in the same project directory:
331
-
332
- ```text
333
- /old-nocobase
334
- ├── .env
335
- ├── package.json
336
- ├── packages
337
- └── storage
338
- ```
339
-
340
- It is recommended to first determine the new `NB_CLI_ROOT`, then create a new npm or Git env. The following example assumes that `NB_CLI_ROOT` is `/your/workspace`.
341
-
342
- ```bash
343
- export NB_CLI_ROOT=/your/workspace
344
- nb init --yes --env app3 --source git --version beta
345
- nb app stop -e app3
346
- ```
347
-
348
- Then migrate as needed:
349
-
350
- - Migrate custom plugin source code from the old project to the corresponding directory under `/your/workspace/app3/source`.
351
- - Copy the old project's `storage` to `/your/workspace/app3/storage`.
352
- - Sync key configurations from the old `.env` to the CLI env configuration or initialization parameters.
353
- - If using the original database, disable the built-in database during initialization and fill in the old database connection information.
354
-
355
- Example of initialization with an external database:
356
-
357
- ```bash
358
- nb init --yes --env app3 --source git --version beta \
359
- --no-builtin-db \
360
- --db-dialect postgres \
361
- --db-host 127.0.0.1 \
362
- --db-port 5432 \
363
- --db-database nocobase \
364
- --db-user nocobase \
365
- --db-password nocobase
366
- ```
367
-
368
- After migration, start it and view the logs:
369
-
370
- ```bash
371
- nb app start -e app3
372
- nb app logs -e app3
373
- ```
374
-
375
- :::warning
376
- Do not directly overwrite `source`, `storage`, or connect to the production database for upgrades without a backup. Before formal migration, it is recommended to do a full rehearsal once in a test environment.
377
- :::
378
-
379
- ## Quick reference for old command migration
380
-
381
- | Old command | New CLI command |
382
- | ----------------------------------------------------- | --------------------------------------------------------------------------------------- |
383
- | `docker compose up -d app` | `nb app start -e app1` |
384
- | `docker compose stop app` | `nb app stop -e app1` |
385
- | `docker compose logs -f app` | `nb app logs -e app1` |
386
- | `docker compose pull app && docker compose up -d app` | `nb app upgrade -e app1` |
387
- | `yarn create nocobase-app my-nocobase-app ...` | `nb init --yes --env app1 --source npm --version beta` |
388
- | `npx create-nocobase-app@beta my-nocobase-app ...` | `nb init --yes --env app1 --source npm --version beta` |
389
- | `git clone ... -b next --depth=1 my-nocobase` | `nb init --yes --env app1 --source git --version beta` |
390
- | `git clone ... -b develop --depth=1 my-nocobase` | `nb init --yes --env app1 --source git --version alpha` |
391
- | `yarn dev` | `nb source dev -e app1` |
392
- | `yarn nocobase upgrade` | `nb app upgrade -e app1` |
393
- | `yarn nocobase upgrade --skip-code-update` | `nb app upgrade -e app1 -s` |
394
- | Manually record multiple application addresses | `nb env list`, `nb env info app1` |
395
- | Manually connect to an existing application | `nb init --yes --env app1 --api-base-url=http://next.v2.test.nocobase.com/nocobase/api` |
396
-
397
- ## Related links
398
-
399
- - [AI Agent Integration Guide](/ai/quick-start)
400
- - [NocoBase CLI Command Reference](/api/cli)
401
- - [Installation methods and version comparison](/get-started/quickstart)
402
- - [Install and upgrade plugins](/get-started/install-upgrade-plugins)
@@ -1,108 +0,0 @@
1
- ---
2
- title: 'nb env proxy caddy'
3
- description: 'nb env proxy caddy command reference: generate a Caddy proxy config for one CLI-managed env.'
4
- keywords: 'nb env proxy caddy,NocoBase CLI,caddy,reverse proxy,proxy configuration'
5
- ---
6
-
7
- # nb env proxy caddy
8
-
9
- `nb env proxy caddy` generates a Caddy proxy config for one CLI-managed env. It fits these cases well: you already have a domain, want HTTPS running quickly, and do not want to maintain too many TLS details yourself.
10
-
11
- This command only works for managed envs whose runtime is reachable from the current machine, which means `local` or `docker`. It does not currently work for envs that only have a remote API connection or for SSH envs.
12
-
13
- ## Usage
14
-
15
- ```bash
16
- nb env proxy caddy [name] [flags]
17
- ```
18
-
19
- ## Parameters
20
-
21
- | Parameter | Type | Description |
22
- | --- | --- | --- |
23
- | `[name]` | string | Name of the configured env to generate a proxy config for. Uses the current env when omitted |
24
- | `--env`, `-e` | string | Explicitly specify the env name. This form is usually recommended |
25
- | `--output`, `-o` | string | Output file path. Only writes the generated route config and does not additionally create `app.caddy` or the shared main config |
26
- | `--host` | string | Host written into the entry config, such as `example.com` or `localhost` |
27
- | `--port` | string | Port written into the entry config. This is the proxy entry port, not the upstream NocoBase app port |
28
- | `--install` | boolean | Install the shared proxy config into the Caddy main config |
29
- | `--reload` | boolean | Validate and reload Caddy after writing files |
30
- | `--print` | boolean | Print the generated route config directly instead of writing files |
31
-
32
- ## Default output
33
-
34
- If you do not pass `--output`, the CLI maintains these files under `~/.nocobase/proxy/caddy/`:
35
-
36
- | File | Purpose |
37
- | --- | --- |
38
- | `~/.nocobase/proxy/caddy/<env>/generated.caddy` | Actual reverse-proxy config managed by the CLI and overwritten on every run |
39
- | `~/.nocobase/proxy/caddy/<env>/app.caddy` | Editable site entry file where you can add site-level config |
40
- | `~/.nocobase/proxy/caddy/nocobase.caddy` | Shared main config that imports every env `app.caddy` |
41
-
42
- Where:
43
-
44
- - `generated.caddy` is only meant to be managed by the CLI and should not be edited manually
45
- - `app.caddy` is editable, but you should keep the managed import inserted by the CLI
46
- - `nocobase.caddy` is mainly used by `--install`
47
-
48
- :::warning Note
49
-
50
- If you need to add site-level Caddy config, edit `app.caddy`. `generated.caddy` will be overwritten the next time you run `nb env proxy caddy`.
51
-
52
- :::
53
-
54
- If you pass `--output`, the CLI only writes the generated config to that file and does not additionally create or update `app.caddy` or the shared main config.
55
-
56
- ## Related configuration items
57
-
58
- These CLI configuration items directly affect the generated Caddy output:
59
-
60
- | Configuration item | Default value | Description |
61
- | --- | --- | --- |
62
- | `proxy.nb-cli-root` | CLI root, usually the current user's home directory | Map the `.nocobase` path to the root path that Caddy actually sees |
63
- | `proxy.upstream-host` | `127.0.0.1` | Host used when the proxy forwards traffic back to the NocoBase app |
64
- | `bin.caddy` | `caddy` | Path to the Caddy executable used by `--install` or `--reload` |
65
-
66
- 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.
67
-
68
- ## Notes
69
-
70
- - `--host` is important. 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
71
- - `--port` must be an integer between `1` and `65535`
72
- - The upstream NocoBase app port comes from the saved env `appPort`, not from `--port`
73
- - If the command says the env is missing `appPort`, run `nb env update <name>` first, or explicitly save it with `nb env update <name> --app-port <port>`
74
- - If you change settings such as `app-port` or `app-public-path` with `nb env update`, you will usually need to rerun `nb env proxy caddy` afterward
75
- - `--print` cannot be combined with `--install` or `--reload`
76
- - `--output` cannot be combined with `--install` or `--reload`
77
-
78
- ## Examples
79
-
80
- ```bash
81
- # Generate a Caddy config for the current env
82
- nb env proxy caddy
83
-
84
- # Generate a config for one env
85
- nb env proxy caddy --env demo
86
-
87
- # Write the public host and port into the entry config
88
- nb env proxy caddy --env demo --host demo.local.nocobase.com --port 8080
89
-
90
- # Print the generated route config without writing files
91
- nb env proxy caddy --env demo --print
92
-
93
- # Write the generated route fragment to a custom file
94
- nb env proxy caddy --env demo --output ./generated.caddy
95
-
96
- # Map the .nocobase path when Caddy runs under another mount root
97
- nb config set proxy.nb-cli-root /workspace
98
-
99
- # Install the shared config into the Caddy main config and reload immediately
100
- nb env proxy caddy --env demo --install --reload
101
- ```
102
-
103
- ## Related commands
104
-
105
- - [`nb env proxy`](./index.md)
106
- - [`nb env proxy nginx`](./nginx.md)
107
- - [`nb env update`](../update.md)
108
- - [`nb config`](../../config/index.md)
@@ -1,54 +0,0 @@
1
- ---
2
- title: 'nb env proxy'
3
- description: 'nb env proxy command-group reference: view and choose the Nginx and Caddy proxy subcommands.'
4
- keywords: 'nb env proxy,NocoBase CLI,nginx,caddy,reverse proxy,proxy configuration'
5
- ---
6
-
7
- # nb env proxy
8
-
9
- In NocoBase CLI, `nb env proxy` is the entry point for reverse-proxy related commands. You mainly use it to discover and choose the Nginx and Caddy provider subcommands.
10
-
11
- If your app has already been saved as a CLI-managed env, and that env is `local` or `docker`, picking one provider subcommand is usually enough.
12
-
13
- ## Usage
14
-
15
- ```bash
16
- nb env proxy
17
- ```
18
-
19
- ## Which subcommand should you open first
20
-
21
- | I want to... | Go here |
22
- | --- | --- |
23
- | Keep using Nginx for sites, certificates, caching, or access control | [`nb env proxy nginx`](./nginx.md) |
24
- | Get HTTPS running quickly and maintain fewer TLS details | [`nb env proxy caddy`](./caddy.md) |
25
- | Adjust env settings that may affect proxy output, such as `app-port` or `app-public-path` | [`nb env update`](../update.md) |
26
-
27
- ## Notes
28
-
29
- - `nb env proxy` does not have its own flags
30
- - Use `nb env proxy nginx` or `nb env proxy caddy` when you want to generate configs
31
- - Both subcommands only work for managed envs whose runtime is reachable from the current machine, which means `local` or `docker`
32
- - If you change settings such as `app-port` or `app-public-path` with `nb env update`, you will usually need to rerun the matching proxy subcommand afterward
33
- - This command group does not currently work for envs that only have a remote API connection or for SSH envs
34
-
35
- ## Examples
36
-
37
- ```bash
38
- # Show command-group help
39
- nb env proxy
40
-
41
- # Generate an Nginx config for one env
42
- nb env proxy nginx --env demo --host demo.local.nocobase.com
43
-
44
- # Generate a Caddy config for one env
45
- nb env proxy caddy --env demo --host demo.local.nocobase.com
46
- ```
47
-
48
- ## Related commands
49
-
50
- - [`nb env proxy nginx`](./nginx.md)
51
- - [`nb env proxy caddy`](./caddy.md)
52
- - [`nb env update`](../update.md)
53
- - [`nb env info`](../info.md)
54
- - [`nb config`](../../config/index.md)
@@ -1,104 +0,0 @@
1
- ---
2
- title: 'nb env proxy nginx'
3
- description: 'nb env proxy nginx command reference: generate Nginx proxy config files and helper files for one CLI-managed env.'
4
- keywords: 'nb env proxy nginx,NocoBase CLI,nginx,reverse proxy,proxy configuration'
5
- ---
6
-
7
- # nb env proxy nginx
8
-
9
- `nb env proxy nginx` generates Nginx proxy config files and helper files for one CLI-managed env. It fits these cases well: you already use Nginx to manage sites, or you still want to manage certificates, caching, or access control yourself.
10
-
11
- This command only works for managed envs whose runtime is reachable from the current machine, which means `local` or `docker`. It does not currently work for envs that only have a remote API connection or for SSH envs.
12
-
13
- ## Usage
14
-
15
- ```bash
16
- nb env proxy nginx [name] [flags]
17
- ```
18
-
19
- ## Parameters
20
-
21
- | Parameter | Type | Description |
22
- | --- | --- | --- |
23
- | `[name]` | string | Name of the configured env to generate a proxy config for. Uses the current env when omitted |
24
- | `--env`, `-e` | string | Explicitly specify the env name. This form is usually recommended |
25
- | `--host` | string | Host written into the entry config, such as `example.com` or `localhost` |
26
- | `--port` | string | Port written into the entry config. This is the proxy entry port, not the upstream NocoBase app port |
27
- | `--install` | boolean | Install the shared proxy config into the Nginx main config |
28
- | `--reload` | boolean | Validate and reload Nginx after writing files |
29
- | `--print` | boolean | Print the rendered `app.conf` directly instead of writing files |
30
-
31
- ## Default output
32
-
33
- `nb env proxy nginx` maintains these files under `~/.nocobase/proxy/nginx/`:
34
-
35
- | File | Purpose |
36
- | --- | --- |
37
- | `~/.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 |
38
- | `~/.nocobase/proxy/nginx/<env>/public/index-v1.html` | v1 SPA fallback page generated from the current active client's `index.html` |
39
- | `~/.nocobase/proxy/nginx/<env>/public/index-v2.html` | v2 SPA fallback page generated from the current active client's `v/index.html` |
40
- | `~/.nocobase/proxy/nginx/nocobase.conf` | Shared main config that includes every env `app.conf` |
41
- | `~/.nocobase/proxy/nginx/snippets/` | Shared snippets directory copied from built-in templates |
42
-
43
- Where:
44
-
45
- - `app.conf` is editable, but you should keep the managed block between `# BEGIN NocoBase managed config` and `# END NocoBase managed config`
46
- - `index-v1.html` and `index-v2.html` automatically rewrite asset URLs according to the current env subpath, active client version, and `CDN_BASE_URL`
47
- - `nocobase.conf` is mainly used by `--install`
48
- - Files under `public/` and `snippets/` are usually not meant to be edited manually and will be resynced the next time you run the command
49
-
50
- :::warning Note
51
-
52
- If you need to add site-level Nginx config, edit `app.conf`. Do not manually edit managed files under `public/` or `snippets/`, because they will be overwritten the next time you run `nb env proxy nginx`.
53
-
54
- :::
55
-
56
- ## Related configuration items
57
-
58
- These CLI configuration items directly affect the generated Nginx output:
59
-
60
- | Configuration item | Default value | Description |
61
- | --- | --- | --- |
62
- | `proxy.nb-cli-root` | CLI root, usually the current user's home directory | Map the `.nocobase` path to the root path that Nginx actually sees |
63
- | `proxy.upstream-host` | `127.0.0.1` | Host used when the proxy forwards traffic back to the NocoBase app |
64
- | `bin.nginx` | `nginx` | Path to the Nginx executable used by `--install` or `--reload` |
65
-
66
- 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.
67
-
68
- ## Notes
69
-
70
- - `--port` must be an integer between `1` and `65535`
71
- - The upstream NocoBase app port comes from the saved env `appPort`, not from `--port`
72
- - If the command says the env is missing `appPort`, run `nb env update <name>` first, or explicitly save it with `nb env update <name> --app-port <port>`
73
- - If you change settings such as `app-port` or `app-public-path` with `nb env update`, you will usually need to rerun `nb env proxy nginx` afterward
74
- - `--print` cannot be combined with `--install` or `--reload`
75
- - The Nginx provider does not support `--output`
76
-
77
- ## Examples
78
-
79
- ```bash
80
- # Generate an Nginx config for the current env
81
- nb env proxy nginx
82
-
83
- # Generate a config for one env
84
- nb env proxy nginx --env demo
85
-
86
- # Write the public host and port into the entry config
87
- nb env proxy nginx --env demo --host demo.local.nocobase.com --port 8080
88
-
89
- # Print the rendered app.conf without writing files
90
- nb env proxy nginx --env demo --print
91
-
92
- # Map the .nocobase path when Nginx runs under another mount root
93
- nb config set proxy.nb-cli-root /workspace
94
-
95
- # Install the shared config into the Nginx main config and reload immediately
96
- nb env proxy nginx --env demo --install --reload
97
- ```
98
-
99
- ## Related commands
100
-
101
- - [`nb env proxy`](./index.md)
102
- - [`nb env proxy caddy`](./caddy.md)
103
- - [`nb env update`](../update.md)
104
- - [`nb config`](../../config/index.md)