@nocobase/plugin-ai 2.1.19 → 2.1.21
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.
- package/dist/ai/docs/nocobase/api/cli/config/delete.md +8 -6
- package/dist/ai/docs/nocobase/api/cli/config/get.md +8 -6
- package/dist/ai/docs/nocobase/api/cli/config/index.md +37 -26
- package/dist/ai/docs/nocobase/api/cli/config/set.md +14 -8
- package/dist/ai/docs/nocobase/file-manager/storage/local.md +3 -1
- package/dist/ai/docs/nocobase/get-started/installation/docker-caddy.mdx +175 -0
- package/dist/ai/docs/nocobase/get-started/installation/docker-nginx.mdx +176 -0
- package/dist/ai/docs/nocobase/get-started/installation/docker.mdx +94 -1
- package/dist/ai/docs/nocobase/security/guide.md +23 -0
- package/dist/client/{559.9f97ebcdb0bd6231.js → 559.959c46d0056ccdc8.js} +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/llm-providers/orcarouter/ModelSettings.d.ts +10 -0
- package/dist/client/llm-providers/orcarouter/ProviderSettings.d.ts +10 -0
- package/dist/client/llm-providers/orcarouter/index.d.ts +10 -0
- package/dist/externalVersion.js +16 -16
- package/dist/locale/en-US.json +4 -0
- package/dist/locale/zh-CN.json +4 -0
- package/dist/node_modules/@langchain/mistralai/package.json +1 -1
- package/dist/node_modules/@langchain/xai/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/just-bash/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/llm-providers/orcarouter.d.ts +35 -0
- package/dist/server/llm-providers/orcarouter.js +155 -0
- package/dist/server/plugin.js +2 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
4
|
-
keywords:
|
|
2
|
+
title: 'nb config delete'
|
|
3
|
+
description: 'nb config delete command reference: delete an explicitly set CLI configuration item.'
|
|
4
|
+
keywords: 'nb config delete,NocoBase CLI,delete configuration'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# nb config delete
|
|
@@ -16,9 +16,9 @@ nb config delete <key>
|
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
| Parameter | Type
|
|
20
|
-
|
|
|
21
|
-
| `<key>`
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| --------- | ------ | --------------------------------------------------------------------------- |
|
|
21
|
+
| `<key>` | string | Configuration item name. See [`nb config`](./index.md) for supported values |
|
|
22
22
|
|
|
23
23
|
## Examples
|
|
24
24
|
|
|
@@ -27,6 +27,8 @@ nb config delete locale
|
|
|
27
27
|
nb config delete update.policy
|
|
28
28
|
nb config delete docker.network
|
|
29
29
|
nb config delete docker.container-prefix
|
|
30
|
+
nb config delete nb-image-registry
|
|
31
|
+
nb config delete nb-image-variant
|
|
30
32
|
nb config delete proxy.nb-cli-root
|
|
31
33
|
nb config delete proxy.upstream-host
|
|
32
34
|
nb config delete proxy.nginx-driver
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
4
|
-
keywords:
|
|
2
|
+
title: 'nb config get'
|
|
3
|
+
description: 'nb config get command reference: read the effective value of a CLI configuration item.'
|
|
4
|
+
keywords: 'nb config get,NocoBase CLI,read configuration'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# nb config get
|
|
@@ -16,9 +16,9 @@ nb config get <key>
|
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
| Parameter | Type
|
|
20
|
-
|
|
|
21
|
-
| `<key>`
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| --------- | ------ | --------------------------------------------------------------------------- |
|
|
21
|
+
| `<key>` | string | Configuration item name. See [`nb config`](./index.md) for supported values |
|
|
22
22
|
|
|
23
23
|
## Examples
|
|
24
24
|
|
|
@@ -28,6 +28,8 @@ nb config get update.policy
|
|
|
28
28
|
nb config get license.pkg-url
|
|
29
29
|
nb config get docker.network
|
|
30
30
|
nb config get docker.container-prefix
|
|
31
|
+
nb config get nb-image-registry
|
|
32
|
+
nb config get nb-image-variant
|
|
31
33
|
nb config get proxy.nb-cli-root
|
|
32
34
|
nb config get proxy.upstream-host
|
|
33
35
|
nb config get proxy.nginx-driver
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
4
|
-
keywords:
|
|
2
|
+
title: 'nb config'
|
|
3
|
+
description: 'nb config command reference: manage default configuration items for the NocoBase CLI.'
|
|
4
|
+
keywords: 'nb config,NocoBase CLI,configuration,default configuration'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# nb config
|
|
@@ -10,6 +10,7 @@ Manage default CLI configuration values. The currently supported keys are mainly
|
|
|
10
10
|
|
|
11
11
|
- CLI itself: `locale`, `update.policy`, `license.pkg-url`
|
|
12
12
|
- Docker runtime: `docker.network`, `docker.container-prefix`
|
|
13
|
+
- Official NocoBase images: `nb-image-registry`, `nb-image-variant`
|
|
13
14
|
- External executables: `bin.docker`, `bin.caddy`, `bin.git`, `bin.nginx`, `bin.pnpm`, `bin.yarn`
|
|
14
15
|
- Proxy generation: `proxy.nb-cli-root`, `proxy.upstream-host`, `proxy.nginx-driver`, `proxy.caddy-driver`
|
|
15
16
|
|
|
@@ -18,28 +19,32 @@ Most projects only need a few of these keys. In practice, the most common ones a
|
|
|
18
19
|
- `update.policy`
|
|
19
20
|
- `docker.network`
|
|
20
21
|
- `docker.container-prefix`
|
|
22
|
+
- `nb-image-registry`
|
|
23
|
+
- `nb-image-variant`
|
|
21
24
|
- `bin.nginx` or `bin.caddy`
|
|
22
25
|
- `proxy.nginx-driver` or `proxy.caddy-driver`
|
|
23
26
|
|
|
24
27
|
## Common configuration keys
|
|
25
28
|
|
|
26
|
-
| Key
|
|
27
|
-
|
|
|
28
|
-
| `locale`
|
|
29
|
-
| `update.policy`
|
|
30
|
-
| `license.pkg-url`
|
|
31
|
-
| `docker.network`
|
|
32
|
-
| `docker.container-prefix` | `nb`
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `bin.
|
|
36
|
-
| `bin.
|
|
37
|
-
| `bin.
|
|
38
|
-
| `bin.
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `proxy.
|
|
42
|
-
| `proxy.
|
|
29
|
+
| Key | Default | Description |
|
|
30
|
+
| ------------------------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| `locale` | resolved by the current CLI rules | Override the language used by the CLI |
|
|
32
|
+
| `update.policy` | `prompt` | Startup update policy: `prompt`, `auto`, or `off` |
|
|
33
|
+
| `license.pkg-url` | `https://pkg.nocobase.com/` | Override the download URL for commercial extension packages |
|
|
34
|
+
| `docker.network` | `nocobase` | Default network for CLI-managed Docker apps |
|
|
35
|
+
| `docker.container-prefix` | `nb` | Default prefix for CLI-managed Docker containers |
|
|
36
|
+
| `nb-image-registry` | `dockerhub` | Default registry family for official NocoBase images: `dockerhub` or `aliyun` |
|
|
37
|
+
| `nb-image-variant` | `full` | Default tag variant for official NocoBase app images: `standard`, `no-nginx`, `full`, or `full-no-nginx` |
|
|
38
|
+
| `bin.docker` | `docker` | Override the Docker executable path |
|
|
39
|
+
| `bin.caddy` | `caddy` | Override the Caddy executable path |
|
|
40
|
+
| `bin.git` | `git` | Override the Git executable path |
|
|
41
|
+
| `bin.nginx` | `nginx` | Override the Nginx executable path |
|
|
42
|
+
| `bin.pnpm` | `pnpm` | Override the pnpm executable path |
|
|
43
|
+
| `bin.yarn` | `yarn` | Override the Yarn executable path |
|
|
44
|
+
| `proxy.nb-cli-root` | CLI root, usually the current user's home directory | Override the root path visible to the generated proxy config when the proxy process and CLI do not see the same filesystem root |
|
|
45
|
+
| `proxy.upstream-host` | `127.0.0.1` | Override the host used when the proxy forwards traffic back to the NocoBase app |
|
|
46
|
+
| `proxy.nginx-driver` | `local` | Default runtime driver used by `nb proxy nginx` |
|
|
47
|
+
| `proxy.caddy-driver` | `local` | Default runtime driver used by `nb proxy caddy` |
|
|
43
48
|
|
|
44
49
|
## Usage
|
|
45
50
|
|
|
@@ -49,12 +54,12 @@ nb config <command>
|
|
|
49
54
|
|
|
50
55
|
## Subcommands
|
|
51
56
|
|
|
52
|
-
| Command
|
|
53
|
-
|
|
|
54
|
-
| [`nb config get`](./get.md)
|
|
55
|
-
| [`nb config set`](./set.md)
|
|
56
|
-
| [`nb config delete`](./delete.md) | Delete an explicitly set configuration key
|
|
57
|
-
| [`nb config list`](./list.md)
|
|
57
|
+
| Command | Description |
|
|
58
|
+
| --------------------------------- | ------------------------------------------------------------- |
|
|
59
|
+
| [`nb config get`](./get.md) | Read the effective value of a configuration key |
|
|
60
|
+
| [`nb config set`](./set.md) | Set a configuration key |
|
|
61
|
+
| [`nb config delete`](./delete.md) | Delete an explicitly set configuration key |
|
|
62
|
+
| [`nb config list`](./list.md) | List the configuration keys that are currently set explicitly |
|
|
58
63
|
|
|
59
64
|
## Examples
|
|
60
65
|
|
|
@@ -69,6 +74,9 @@ nb config set proxy.nginx-driver docker
|
|
|
69
74
|
nb config set proxy.caddy-driver local
|
|
70
75
|
nb config get docker.network
|
|
71
76
|
nb config set docker.network nocobase
|
|
77
|
+
nb config get nb-image-registry
|
|
78
|
+
nb config set nb-image-registry aliyun
|
|
79
|
+
nb config set nb-image-variant full-no-nginx
|
|
72
80
|
nb config set bin.nginx /usr/sbin/nginx
|
|
73
81
|
nb config set bin.git /usr/bin/git
|
|
74
82
|
nb config set bin.pnpm /usr/local/bin/pnpm
|
|
@@ -79,6 +87,9 @@ nb config delete docker.container-prefix
|
|
|
79
87
|
|
|
80
88
|
- `bin.nginx` and `bin.caddy` only affect the `local` driver for `nb proxy nginx` and `nb proxy caddy`
|
|
81
89
|
- `bin.pnpm` is used when commands need to run pnpm directly, such as updating a pnpm-managed global CLI install with `nb self update`
|
|
90
|
+
- `nb-image-registry` only affects official NocoBase image defaults used by the CLI. `dockerhub` maps app images to `nocobase/nocobase`, while `aliyun` maps them to `registry.cn-shanghai.aliyuncs.com/nocobase/nocobase`
|
|
91
|
+
- `nb-image-variant` only affects official NocoBase app image tags. With version tag `1.7.14`, the CLI resolves `standard` to `1.7.14`, `no-nginx` to `1.7.14-no-nginx`, `full` to `1.7.14-full`, and `full-no-nginx` to `1.7.14-full-no-nginx`
|
|
92
|
+
- When `nb-image-registry=aliyun`, the CLI also switches the default built-in database images to the official Aliyun mirrors for PostgreSQL, MySQL, MariaDB, and Kingbase
|
|
82
93
|
- `proxy.nginx-driver` and `proxy.caddy-driver` store the default driver used by each provider
|
|
83
94
|
- `proxy.nb-cli-root` and `proxy.upstream-host` are advanced proxy overrides. Most CLI-managed `local` or `docker` envs can use the defaults directly
|
|
84
95
|
- If you only want to switch the active proxy driver, using `nb proxy nginx use` or `nb proxy caddy use` is usually clearer than setting the config key manually
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
4
|
-
keywords:
|
|
2
|
+
title: 'nb config set'
|
|
3
|
+
description: 'nb config set command reference: set a CLI configuration item.'
|
|
4
|
+
keywords: 'nb config set,NocoBase CLI,set configuration'
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# nb config set
|
|
@@ -16,10 +16,10 @@ nb config set <key> <value>
|
|
|
16
16
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
|
-
| Parameter | Type
|
|
20
|
-
|
|
|
21
|
-
| `<key>`
|
|
22
|
-
| `<value>` | string | Configuration value, cannot be empty
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| --------- | ------ | --------------------------------------------------------------------------- |
|
|
21
|
+
| `<key>` | string | Configuration item name. See [`nb config`](./index.md) for supported values |
|
|
22
|
+
| `<value>` | string | Configuration value, cannot be empty |
|
|
23
23
|
|
|
24
24
|
## Examples
|
|
25
25
|
|
|
@@ -29,6 +29,10 @@ nb config set update.policy auto
|
|
|
29
29
|
nb config set license.pkg-url https://pkg.nocobase.com/
|
|
30
30
|
nb config set docker.network nocobase
|
|
31
31
|
nb config set docker.container-prefix nb
|
|
32
|
+
nb config set nb-image-registry dockerhub
|
|
33
|
+
nb config set nb-image-registry aliyun
|
|
34
|
+
nb config set nb-image-variant full
|
|
35
|
+
nb config set nb-image-variant full-no-nginx
|
|
32
36
|
nb config set bin.docker /usr/local/bin/docker
|
|
33
37
|
nb config set bin.caddy /opt/homebrew/bin/caddy
|
|
34
38
|
nb config set bin.git /usr/bin/git
|
|
@@ -43,7 +47,9 @@ nb config set bin.yarn yarn
|
|
|
43
47
|
|
|
44
48
|
## Notes
|
|
45
49
|
|
|
46
|
-
`update.policy` supports `prompt`, `auto`, and `off`, and the default value is `prompt
|
|
50
|
+
- `update.policy` supports `prompt`, `auto`, and `off`, and the default value is `prompt`
|
|
51
|
+
- `nb-image-registry` supports `dockerhub` and `aliyun`, and the default value is `dockerhub`
|
|
52
|
+
- `nb-image-variant` supports `standard`, `no-nginx`, `full`, and `full-no-nginx`, and the default value is `full`
|
|
47
53
|
|
|
48
54
|
## Related commands
|
|
49
55
|
|
|
@@ -9,6 +9,8 @@ Local Storage does not support private access. After a file is uploaded, NocoBas
|
|
|
9
9
|
|
|
10
10
|
If you need to store contracts, identity documents, internal materials, or other files that should not be public, use [S3 Pro](./s3-pro). If historical files already exist, see [Migrate to S3 Pro](./migrate-to-s3-pro.md).
|
|
11
11
|
|
|
12
|
+
If you are not using Docker or the official nginx configuration and access local uploaded files through a custom proxy, make sure the `/storage/uploads/` path sets `X-Content-Type-Options: nosniff` and returns active content files such as `html`, `svg`, `xhtml`, and `pdf` as attachments. For details, see [Security guide: File storage](../../security/guide.md#file-storage).
|
|
13
|
+
|
|
12
14
|
:::
|
|
13
15
|
|
|
14
16
|
## Configuration Parameters
|
|
@@ -26,4 +28,4 @@ This section only introduces parameters specific to the local storage engine. Fo
|
|
|
26
28
|
Represents both the relative path for file storage on the server and the URL access path. For example, "`user/avatar`" (without leading or trailing slashes) represents:
|
|
27
29
|
|
|
28
30
|
1. The relative path on the server where uploaded files are stored: `/path/to/nocobase-app/storage/uploads/user/avatar`.
|
|
29
|
-
2. The URL prefix for accessing the files: `http://localhost:13000/storage/uploads/user/avatar`.
|
|
31
|
+
2. The URL prefix for accessing the files: `http://localhost:13000/storage/uploads/user/avatar`.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Docker Installation (External Caddy)"
|
|
3
|
+
description: "Install NocoBase with Docker and use an external Caddy container as the entry point."
|
|
4
|
+
keywords: "Docker,NocoBase,Caddy,installation,reverse proxy"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Docker Installation (External Caddy)
|
|
8
|
+
|
|
9
|
+
In this setup, the NocoBase app container and the Caddy container run separately. You can start with [Docker Installation (Built-in Nginx)](./docker.mdx) and then switch the entry service to an external Caddy container.
|
|
10
|
+
|
|
11
|
+
## When to use this setup
|
|
12
|
+
|
|
13
|
+
- You want to deploy NocoBase and the web server separately
|
|
14
|
+
- You want to simplify reverse proxy and HTTPS configuration with Caddy
|
|
15
|
+
- You want to expose only the proxy container to the public network
|
|
16
|
+
|
|
17
|
+
## docker-compose.yml example
|
|
18
|
+
|
|
19
|
+
If you need the `full` image, replace `latest-no-nginx` with `latest-full-no-nginx`.
|
|
20
|
+
|
|
21
|
+
The `13000:80` mapping is only for convenient local testing, so it does not occupy the standard host ports directly. In production, you usually do not keep using `13000:80`; instead, let the external Caddy container map directly to the host `80` and `443` ports.
|
|
22
|
+
```yml
|
|
23
|
+
networks:
|
|
24
|
+
nocobase:
|
|
25
|
+
driver: bridge
|
|
26
|
+
|
|
27
|
+
services:
|
|
28
|
+
app:
|
|
29
|
+
image: nocobase/nocobase:latest-no-nginx
|
|
30
|
+
restart: always
|
|
31
|
+
depends_on:
|
|
32
|
+
- postgres
|
|
33
|
+
networks:
|
|
34
|
+
- nocobase
|
|
35
|
+
environment:
|
|
36
|
+
- APP_KEY=your-secret-key
|
|
37
|
+
- DB_DIALECT=postgres
|
|
38
|
+
- DB_HOST=postgres
|
|
39
|
+
- DB_PORT=5432
|
|
40
|
+
- DB_DATABASE=nocobase
|
|
41
|
+
- DB_USER=nocobase
|
|
42
|
+
- DB_PASSWORD=nocobase
|
|
43
|
+
- TZ=Etc/UTC
|
|
44
|
+
- NOCOBASE_EXTRACT_CLIENT_ASSETS=true
|
|
45
|
+
- NOCOBASE_PROXY_PROVIDER=caddy
|
|
46
|
+
- NOCOBASE_PROXY_STORAGE_PATH=/app/nocobase/storage
|
|
47
|
+
- NOCOBASE_PROXY_UPSTREAM_HOST=app
|
|
48
|
+
volumes:
|
|
49
|
+
- ./storage:/app/nocobase/storage
|
|
50
|
+
|
|
51
|
+
caddy:
|
|
52
|
+
image: caddy:2
|
|
53
|
+
restart: always
|
|
54
|
+
depends_on:
|
|
55
|
+
- app
|
|
56
|
+
networks:
|
|
57
|
+
- nocobase
|
|
58
|
+
volumes:
|
|
59
|
+
- ./storage:/app/nocobase/storage
|
|
60
|
+
command: >
|
|
61
|
+
/bin/sh -c '
|
|
62
|
+
while [ ! -f /app/nocobase/storage/.nocobase/proxy/caddy/nocobase.caddy ]; do
|
|
63
|
+
echo "waiting for nocobase.caddy..."
|
|
64
|
+
sleep 1
|
|
65
|
+
done
|
|
66
|
+
ln -sf /app/nocobase/storage/.nocobase/proxy/caddy/nocobase.caddy /etc/caddy/Caddyfile
|
|
67
|
+
caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
|
|
68
|
+
'
|
|
69
|
+
ports:
|
|
70
|
+
# This is only a local testing example.
|
|
71
|
+
- "13000:80"
|
|
72
|
+
# In production, usually change it to:
|
|
73
|
+
# - "80:80"
|
|
74
|
+
# - "443:443"
|
|
75
|
+
|
|
76
|
+
postgres:
|
|
77
|
+
image: postgres:16
|
|
78
|
+
restart: always
|
|
79
|
+
command: postgres -c wal_level=logical
|
|
80
|
+
environment:
|
|
81
|
+
POSTGRES_USER: nocobase
|
|
82
|
+
POSTGRES_DB: nocobase
|
|
83
|
+
POSTGRES_PASSWORD: nocobase
|
|
84
|
+
volumes:
|
|
85
|
+
- ./storage/db/postgres:/var/lib/postgresql/data
|
|
86
|
+
networks:
|
|
87
|
+
- nocobase
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Key points
|
|
91
|
+
|
|
92
|
+
- `NOCOBASE_EXTRACT_CLIENT_ASSETS=true` extracts client assets and generates proxy config
|
|
93
|
+
- `NOCOBASE_PROXY_PROVIDER=caddy` tells the app to generate Caddy config
|
|
94
|
+
- `NOCOBASE_PROXY_UPSTREAM_HOST=app` lets the Caddy container reach the `app` service through the Compose network
|
|
95
|
+
- `./storage` must be mounted into both the `app` and `caddy` containers so they can share proxy config, static assets, and uploaded files
|
|
96
|
+
- The `caddy` container should wait until `nocobase.caddy` is generated, then link it to `/etc/caddy/Caddyfile` with `ln -sf`
|
|
97
|
+
- Expose only the Caddy container port to the host. For testing, you can start with `13000:80`; in production, you usually expose the host `80` and `443` ports directly, while the `app` service does not need to expose its port to the host
|
|
98
|
+
|
|
99
|
+
## If you use a local host Caddy
|
|
100
|
+
|
|
101
|
+
If your Caddy is installed directly on the host instead of running in a Docker container, it is better to use a separate `docker-compose.yml`. In this setup, the `app` service must expose a host port directly, and the proxy-related environment variables should use host-side values.
|
|
102
|
+
|
|
103
|
+
You can use a `docker-compose.yml` like this:
|
|
104
|
+
|
|
105
|
+
```yml
|
|
106
|
+
networks:
|
|
107
|
+
nocobase:
|
|
108
|
+
driver: bridge
|
|
109
|
+
|
|
110
|
+
services:
|
|
111
|
+
app:
|
|
112
|
+
image: nocobase/nocobase:latest-no-nginx
|
|
113
|
+
restart: always
|
|
114
|
+
depends_on:
|
|
115
|
+
- postgres
|
|
116
|
+
networks:
|
|
117
|
+
- nocobase
|
|
118
|
+
environment:
|
|
119
|
+
- APP_KEY=your-secret-key
|
|
120
|
+
- DB_DIALECT=postgres
|
|
121
|
+
- DB_HOST=postgres
|
|
122
|
+
- DB_PORT=5432
|
|
123
|
+
- DB_DATABASE=nocobase
|
|
124
|
+
- DB_USER=nocobase
|
|
125
|
+
- DB_PASSWORD=nocobase
|
|
126
|
+
- TZ=Etc/UTC
|
|
127
|
+
- NOCOBASE_EXTRACT_CLIENT_ASSETS=true
|
|
128
|
+
- NOCOBASE_PROXY_PROVIDER=caddy
|
|
129
|
+
- NOCOBASE_PROXY_STORAGE_PATH=/path/to/your-project/storage
|
|
130
|
+
- NOCOBASE_PROXY_UPSTREAM_HOST=127.0.0.1
|
|
131
|
+
- NOCOBASE_PROXY_UPSTREAM_PORT=13000
|
|
132
|
+
volumes:
|
|
133
|
+
- ./storage:/app/nocobase/storage
|
|
134
|
+
ports:
|
|
135
|
+
- "13000:13000"
|
|
136
|
+
|
|
137
|
+
postgres:
|
|
138
|
+
image: postgres:16
|
|
139
|
+
restart: always
|
|
140
|
+
command: postgres -c wal_level=logical
|
|
141
|
+
environment:
|
|
142
|
+
POSTGRES_USER: nocobase
|
|
143
|
+
POSTGRES_DB: nocobase
|
|
144
|
+
POSTGRES_PASSWORD: nocobase
|
|
145
|
+
volumes:
|
|
146
|
+
- ./storage/db/postgres:/var/lib/postgresql/data
|
|
147
|
+
networks:
|
|
148
|
+
- nocobase
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
In this variant:
|
|
152
|
+
|
|
153
|
+
- `NOCOBASE_PROXY_STORAGE_PATH` should be the absolute host path of your `storage` directory
|
|
154
|
+
- `NOCOBASE_PROXY_UPSTREAM_HOST` should be `127.0.0.1`
|
|
155
|
+
- The `app` service must keep `ports`, so the local Caddy can reach the app through `127.0.0.1:13000`
|
|
156
|
+
|
|
157
|
+
After the `app` container starts, wait for the config file to be generated, then link it into the local Caddy config path:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
while [ ! -f ./storage/.nocobase/proxy/caddy/nocobase.caddy ]; do
|
|
161
|
+
echo "waiting for nocobase.caddy..."
|
|
162
|
+
sleep 1
|
|
163
|
+
done
|
|
164
|
+
|
|
165
|
+
sudo ln -sf "$(pwd)/storage/.nocobase/proxy/caddy/nocobase.caddy" /etc/caddy/Caddyfile
|
|
166
|
+
sudo caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile
|
|
167
|
+
sudo systemctl reload caddy
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
If your host Caddy does not use `/etc/caddy/Caddyfile`, replace the link target with your own config path. Usually it is safer to keep `nocobase.caddy` as the main entry file instead of copying its content manually.
|
|
171
|
+
|
|
172
|
+
## Related links
|
|
173
|
+
|
|
174
|
+
- [Docker Installation (Built-in Nginx)](./docker.mdx) — Start with the single-container setup
|
|
175
|
+
- [Caddy Static Resource Proxy](../deployment/static-resource-proxy/caddy.md) — Learn more about the generated Caddy config
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Docker Installation (External Nginx)"
|
|
3
|
+
description: "Install NocoBase with Docker and use an external Nginx container as the entry point."
|
|
4
|
+
keywords: "Docker,NocoBase,Nginx,installation,reverse proxy"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Docker Installation (External Nginx)
|
|
8
|
+
|
|
9
|
+
In this setup, the NocoBase app container and the Nginx container run separately. You can start with [Docker Installation (Built-in Nginx)](./docker.mdx) and then switch the entry service to an external Nginx container.
|
|
10
|
+
|
|
11
|
+
## When to use this setup
|
|
12
|
+
|
|
13
|
+
- You want to deploy NocoBase and the web server separately
|
|
14
|
+
- You want to manage the Nginx config and exposed ports yourself
|
|
15
|
+
- You want to expose only the proxy container to the public network
|
|
16
|
+
|
|
17
|
+
## docker-compose.yml example
|
|
18
|
+
|
|
19
|
+
If you need the `full` image, replace `latest-no-nginx` with `latest-full-no-nginx`.
|
|
20
|
+
|
|
21
|
+
The `13000:80` mapping is only for convenient local testing, so it does not occupy the standard host ports directly. In production, you usually do not keep using `13000:80`; instead, let the external Nginx container map directly to the host `80` and `443` ports.
|
|
22
|
+
```yml
|
|
23
|
+
networks:
|
|
24
|
+
nocobase:
|
|
25
|
+
driver: bridge
|
|
26
|
+
|
|
27
|
+
services:
|
|
28
|
+
app:
|
|
29
|
+
image: nocobase/nocobase:latest-no-nginx
|
|
30
|
+
restart: always
|
|
31
|
+
depends_on:
|
|
32
|
+
- postgres
|
|
33
|
+
networks:
|
|
34
|
+
- nocobase
|
|
35
|
+
environment:
|
|
36
|
+
- APP_KEY=your-secret-key
|
|
37
|
+
- DB_DIALECT=postgres
|
|
38
|
+
- DB_HOST=postgres
|
|
39
|
+
- DB_PORT=5432
|
|
40
|
+
- DB_DATABASE=nocobase
|
|
41
|
+
- DB_USER=nocobase
|
|
42
|
+
- DB_PASSWORD=nocobase
|
|
43
|
+
- TZ=Etc/UTC
|
|
44
|
+
- NOCOBASE_EXTRACT_CLIENT_ASSETS=true
|
|
45
|
+
- NOCOBASE_PROXY_PROVIDER=nginx
|
|
46
|
+
- NOCOBASE_PROXY_STORAGE_PATH=/app/nocobase/storage
|
|
47
|
+
- NOCOBASE_PROXY_UPSTREAM_HOST=app
|
|
48
|
+
volumes:
|
|
49
|
+
- ./storage:/app/nocobase/storage
|
|
50
|
+
|
|
51
|
+
nginx:
|
|
52
|
+
image: nginx:latest
|
|
53
|
+
restart: always
|
|
54
|
+
depends_on:
|
|
55
|
+
- app
|
|
56
|
+
networks:
|
|
57
|
+
- nocobase
|
|
58
|
+
volumes:
|
|
59
|
+
- ./storage:/app/nocobase/storage
|
|
60
|
+
command: >
|
|
61
|
+
/bin/sh -c '
|
|
62
|
+
while [ ! -f /app/nocobase/storage/.nocobase/proxy/nginx/nocobase.conf ]; do
|
|
63
|
+
echo "waiting for nocobase.conf..."
|
|
64
|
+
sleep 1
|
|
65
|
+
done
|
|
66
|
+
rm -f /etc/nginx/conf.d/default.conf
|
|
67
|
+
ln -sf /app/nocobase/storage/.nocobase/proxy/nginx/nocobase.conf /etc/nginx/conf.d/default.conf
|
|
68
|
+
nginx -g "daemon off;"
|
|
69
|
+
'
|
|
70
|
+
ports:
|
|
71
|
+
# This is only a local testing example.
|
|
72
|
+
- "13000:80"
|
|
73
|
+
# In production, usually change it to:
|
|
74
|
+
# - "80:80"
|
|
75
|
+
# - "443:443"
|
|
76
|
+
|
|
77
|
+
postgres:
|
|
78
|
+
image: postgres:16
|
|
79
|
+
restart: always
|
|
80
|
+
command: postgres -c wal_level=logical
|
|
81
|
+
environment:
|
|
82
|
+
POSTGRES_USER: nocobase
|
|
83
|
+
POSTGRES_DB: nocobase
|
|
84
|
+
POSTGRES_PASSWORD: nocobase
|
|
85
|
+
volumes:
|
|
86
|
+
- ./storage/db/postgres:/var/lib/postgresql/data
|
|
87
|
+
networks:
|
|
88
|
+
- nocobase
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Key points
|
|
92
|
+
|
|
93
|
+
- `NOCOBASE_EXTRACT_CLIENT_ASSETS=true` extracts client assets and generates proxy config
|
|
94
|
+
- `NOCOBASE_PROXY_PROVIDER=nginx` tells the app to generate Nginx config
|
|
95
|
+
- `NOCOBASE_PROXY_UPSTREAM_HOST=app` lets the Nginx container reach the `app` service through the Compose network
|
|
96
|
+
- `./storage` must be mounted into both the `app` and `nginx` containers so they can share proxy config, static assets, and uploaded files
|
|
97
|
+
- The `nginx` container should wait until `nocobase.conf` is generated, then link it to `/etc/nginx/conf.d/default.conf` with `ln -sf`
|
|
98
|
+
- If you use an external Nginx container, let the `nginx` container handle the host port mapping. For testing, you can start with `13000:80`; in production, you usually expose the host `80` and `443` ports directly, while the `app` service does not need to expose its port to the host
|
|
99
|
+
|
|
100
|
+
## If you use a local host Nginx
|
|
101
|
+
|
|
102
|
+
If your Nginx is installed directly on the host instead of running in a Docker container, it is better to use a separate `docker-compose.yml`. In this setup, the `app` service must expose a host port directly, and the proxy-related environment variables should use host-side values.
|
|
103
|
+
|
|
104
|
+
You can use a `docker-compose.yml` like this:
|
|
105
|
+
|
|
106
|
+
```yml
|
|
107
|
+
networks:
|
|
108
|
+
nocobase:
|
|
109
|
+
driver: bridge
|
|
110
|
+
|
|
111
|
+
services:
|
|
112
|
+
app:
|
|
113
|
+
image: nocobase/nocobase:latest-no-nginx
|
|
114
|
+
restart: always
|
|
115
|
+
depends_on:
|
|
116
|
+
- postgres
|
|
117
|
+
networks:
|
|
118
|
+
- nocobase
|
|
119
|
+
environment:
|
|
120
|
+
- APP_KEY=your-secret-key
|
|
121
|
+
- DB_DIALECT=postgres
|
|
122
|
+
- DB_HOST=postgres
|
|
123
|
+
- DB_PORT=5432
|
|
124
|
+
- DB_DATABASE=nocobase
|
|
125
|
+
- DB_USER=nocobase
|
|
126
|
+
- DB_PASSWORD=nocobase
|
|
127
|
+
- TZ=Etc/UTC
|
|
128
|
+
- NOCOBASE_EXTRACT_CLIENT_ASSETS=true
|
|
129
|
+
- NOCOBASE_PROXY_PROVIDER=nginx
|
|
130
|
+
- NOCOBASE_PROXY_STORAGE_PATH=/path/to/your-project/storage
|
|
131
|
+
- NOCOBASE_PROXY_UPSTREAM_HOST=127.0.0.1
|
|
132
|
+
- NOCOBASE_PROXY_UPSTREAM_PORT=13000
|
|
133
|
+
volumes:
|
|
134
|
+
- ./storage:/app/nocobase/storage
|
|
135
|
+
ports:
|
|
136
|
+
- "13000:13000"
|
|
137
|
+
|
|
138
|
+
postgres:
|
|
139
|
+
image: postgres:16
|
|
140
|
+
restart: always
|
|
141
|
+
command: postgres -c wal_level=logical
|
|
142
|
+
environment:
|
|
143
|
+
POSTGRES_USER: nocobase
|
|
144
|
+
POSTGRES_DB: nocobase
|
|
145
|
+
POSTGRES_PASSWORD: nocobase
|
|
146
|
+
volumes:
|
|
147
|
+
- ./storage/db/postgres:/var/lib/postgresql/data
|
|
148
|
+
networks:
|
|
149
|
+
- nocobase
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
In this variant:
|
|
153
|
+
|
|
154
|
+
- `NOCOBASE_PROXY_STORAGE_PATH` should be the absolute host path of your `storage` directory
|
|
155
|
+
- `NOCOBASE_PROXY_UPSTREAM_HOST` should be `127.0.0.1`
|
|
156
|
+
- The `app` service must keep `ports`, so the local Nginx can reach the app through `127.0.0.1:13000`
|
|
157
|
+
|
|
158
|
+
After the `app` container starts, wait for the config file to be generated, then link it into the local Nginx config directory:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
while [ ! -f ./storage/.nocobase/proxy/nginx/nocobase.conf ]; do
|
|
162
|
+
echo "waiting for nocobase.conf..."
|
|
163
|
+
sleep 1
|
|
164
|
+
done
|
|
165
|
+
|
|
166
|
+
sudo ln -sf "$(pwd)/storage/.nocobase/proxy/nginx/nocobase.conf" /etc/nginx/conf.d/nocobase.conf
|
|
167
|
+
sudo nginx -t
|
|
168
|
+
sudo systemctl reload nginx
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
If your host Nginx does not use the `conf.d` directory, replace the link target with your own config path. Usually it is safer to keep `nocobase.conf` as a file included from the `http {}` context instead of copying its content manually.
|
|
172
|
+
|
|
173
|
+
## Related links
|
|
174
|
+
|
|
175
|
+
- [Docker Installation (Built-in Nginx)](./docker.mdx) — Start with the single-container setup
|
|
176
|
+
- [Nginx Static Resource Proxy](../deployment/static-resource-proxy/nginx.md) — Learn more about the generated Nginx config
|