docs/docs/en/get-started/installation/env.md
create-nocobase-app Installation MethodSet environment variables in the .env file in the project's root directory. After modifying the environment variables, kill the application process and restart it.
Modify the docker-compose.yml configuration and set the environment variables in the environment parameter. Example:
services:
app:
image: nocobase/nocobase:latest
environment:
- APP_ENV=production
You can also use env_file to set environment variables in the .env file. Example:
services:
app:
image: nocobase/nocobase:latest
env_file: .env
After modifying the environment variables, rebuild the app container:
docker-compose up -d app
Used to set the application's time zone, with the default being the system's time zone.
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
:::warning Time-related operations will be handled according to this time zone. Changing TZ may affect date values in the database. For more details, refer to Date & Time Overview. :::
Application environment, default is development, options include:
production production environmentdevelopment development environmentAPP_ENV=production
The application's secret key, used for generating user tokens, etc. Change it to your own application key and ensure it is not leaked.
:::warning If APP_KEY is changed, old tokens will become invalid. :::
APP_KEY=app-key-test
Application port, default is 13000.
APP_PORT=13000
NocoBase API address prefix, default is /api/.
API_BASE_PATH=/api/
v1.6.0+
The multi-core (cluster) mode for starting app. If this variable is configured, it will be passed to the pm2 start command as the -i <instances> parameter. The options are consistent with the pm2 -i parameter (refer to PM2: Cluster Mode), including:
max: Use the maximum number of CPU cores-1: Use the maximum number of CPU cores minus one<number>: Specify the number of coresThe default value is empty, meaning it is not enabled.
:::warning{title="Attention"} This mode requires the use of plugins related to cluster mode. Otherwise, the functionality of the application may encounter unexpected issues. :::
For more information, see Cluster Mode.
Plugin package prefix, default is @nocobase/plugin-,@nocobase/preset-.
For example, to add the hello plugin to the my-nocobase-app project, the plugin's full package name would be @my-nocobase-app/plugin-hello.
PLUGIN_PACKAGE_PREFIX can be configured as:
PLUGIN_PACKAGE_PREFIX=@nocobase/plugin-,@nocobase-preset-,@my-nocobase-app/plugin-
The correspondence between plugin name and package name is as follows:
users plugin package name is @nocobase/plugin-usersnocobase plugin package name is @nocobase/preset-nocobasehello plugin package name is @my-nocobase-app/plugin-helloDatabase type, options include:
mariadbmysqlpostgresDB_DIALECT=mysql
Database host (required when using MySQL or PostgreSQL databases).
Default is localhost.
DB_HOST=localhost
Database port (required when using MySQL or PostgreSQL databases).
DB_PORT=3306
Database name (required when using MySQL or PostgreSQL databases).
DB_DATABASE=nocobase
Database user (required when using MySQL or PostgreSQL databases).
DB_USER=nocobase
Database password (required when using MySQL or PostgreSQL databases).
DB_PASSWORD=nocobase
Data table prefix.
DB_TABLE_PREFIX=nocobase_
Whether database table and field names are converted to snake case style. Default is false. If using a MySQL (MariaDB) database with lower_case_table_names=1, then DB_UNDERSCORED must be set to true.
:::warning
When DB_UNDERSCORED=true, the actual table and field names in the database will not match what is displayed in the UI. For example, orderDetails will be stored as order_details in the database.
:::
Database log switch, default is off, options include:
on onoff offDB_LOGGING=on
Maximum number of connections in the pool. Default is 5.
Minimum number of connections in the pool. Default is 0.
The maximum time, in milliseconds, that a connection can be idle before being released. Default is 10000 (10 seconds).
The maximum time, in milliseconds, that the pool will try to get a connection before throwing an error. Default is 60000 (60 seconds).
The time interval, in milliseconds, after which the connection pool will remove idle connections. Default is 1000 (1 second).
The number of times a connection can be used before it is discarded and replaced. Default is 0 (unlimited).
Log output method, multiple values separated by ,. Default is console in development, console,dailyRotateFile in production.
Options:
console - console.logfile - Output to a filedailyRotateFile - Output to daily rotating filesLOGGER_TRANSPORT=console,dailyRotateFile
Output log level. Default is debug in development and info in production. Options:
errorwarninfodebugtraceLOGGER_LEVEL=info
The database log output level is debug, controlled by DB_LOGGING, and is unaffected by LOGGER_LEVEL.
Maximum number of log files to keep.
LOGGER_TRANSPORT is file: Default is 10.LOGGER_TRANSPORT is dailyRotateFile: Use [n]d to represent days. Default is 14d.LOGGER_MAX_FILES=14d
Log rotation by size.
LOGGER_TRANSPORT is file: Unit is byte. Default is 20971520 (20 * 1024 * 1024).LOGGER_TRANSPORT is dailyRotateFile: Use [n]k, [n]m, [n]g. Default is not set.LOGGER_MAX_SIZE=20971520
Log print format. Default is console in development and json in production. Options:
consolejsonlogfmtdelimiterLOGGER_FORMAT=json
Reference: Log Format
Unique identifier for the caching method, specifying the server's default cache. Default is memory. Built-in options include:
memoryredisCACHE_DEFAULT_STORE=memory
Maximum number of items in the memory cache. Default is 2000.
CACHE_MEMORY_MAX=2000
Redis connection URL, optional. Example: redis://localhost:6379
CACHE_REDIS_URL=redis://localhost:6379
Enable telemetry data collection. Default is off.
TELEMETRY_ENABLED=on
Enabled monitoring metric collectors. Default is console. Other values should refer to the names registered by corresponding collector plugins, such as prometheus. Multiple values are separated by ,.
TELEMETRY_METRIC_READER=console,prometheus
Enabled trace data processors. Default is console. Other values should refer to the names registered by corresponding processor plugins. Multiple values are separated by ,.
TELEMETRY_TRACE_PROCESSOR=console
Whitelist of allowed targets for server-initiated outbound HTTP requests, used to prevent SSRF (Server-Side Request Forgery) attacks. Accepts a comma-separated list of exact IPs, CIDR ranges, exact hostnames, and single-level wildcard subdomains.
SERVER_REQUEST_WHITELIST=1.2.3.4,10.0.0.0/8,api.example.com,*.trusted.com
Applies to: Workflow "HTTP Request" nodes and Custom Request action buttons. Relative-path requests (calls to the NocoBase API itself) are not affected.
When not set: All http/https outbound requests are allowed (existing behaviour). When set: Only requests whose host matches a whitelist entry are permitted; non-matching requests will raise an error.
Supported formats:
| Format | Example | Matches |
|---|---|---|
| Exact IPv4 | 1.2.3.4 | That IP only |
| IPv4 CIDR | 10.0.0.0/8 | All IPs in the subnet |
| Exact hostname | api.example.com | That hostname only |
| Wildcard subdomain | *.example.com | One subdomain level, e.g. foo.example.com; does not match example.com or a.b.example.com |
Used to append preset local plugins. The value is the package name (the name parameter in package.json), with multiple plugins separated by commas.
:::info
node_modules directory. For more details, see Plugin Organization.nocobase install) or upgrade (nocobase upgrade).:::
APPEND_PRESET_LOCAL_PLUGINS=@my-project/plugin-foo,@my-project/plugin-bar
Used to append built-in plugins that are installed by default. The value is the package name (the name parameter in package.json), with multiple plugins separated by commas.
:::info
node_modules directory. For more details, see Plugin Organization.nocobase install) or upgrade (nocobase upgrade).:::
APPEND_PRESET_BUILT_IN_PLUGINS=@my-project/plugin-foo,@my-project/plugin-bar
The installation of NocoBase can be assisted by setting temporary environment variables, such as:
yarn cross-env \
INIT_APP_LANG=en-US \
[email protected] \
INIT_ROOT_PASSWORD=admin123 \
INIT_ROOT_NICKNAME="Super Admin" \
nocobase install
# Equivalent to
yarn nocobase install \
--lang=en-US \
[email protected] \
--root-password=admin123 \
--root-nickname="Super Admin"
# Equivalent to
yarn nocobase install -l en-US -e [email protected] -p admin123 -n "Super Admin"
Language at the time of installation. Default is en-US. Options include:
en-USzh-CNyarn cross-env \
INIT_APP_LANG=en-US \
nocobase install
Root user email.
yarn cross-env \
INIT_APP_LANG=en-US \
[email protected] \
nocobase install
Root user password.
yarn cross-env \
INIT_APP_LANG=en-US \
[email protected] \
INIT_ROOT_PASSWORD=admin123 \
nocobase install
Root user nickname.
yarn cross-env \
INIT_APP_LANG=en-US \
[email protected] \
INIT_ROOT_PASSWORD=admin123 \
INIT_ROOT_NICKNAME="Super Admin" \
nocobase install
Workflow JavaScript node available modules list. For details, see "JavaScript Node: Using External Modules".
Maximum loop count limit for workflow loop nodes. For details, see "Loop Node".