Configuration and Environment Variables
Relevant source files
The following files were used as context for generating this wiki page:
- packages/backend-core/src/environment.ts
- packages/server/src/environment.ts
- packages/worker/src/environment.ts
- hosting/.env.sample
- charts/budibase/README.md
- hosting/portainer/template.json
- packages/client/src/components/MaintenanceScreen.svelte
- packages/builder/src/pages/builder/maintenance/index.svelte
Budibase utilizes environment variables to configure its various backend services, including the main app-server, the worker, and core shared components. This system allows for flexible deployments across different environments like Docker, Kubernetes, and Portainer by externalizing configuration for databases, security credentials, service ports, and feature flags.
Correctly setting these variables is crucial for the security, stability, and functionality of a Budibase installation. The configuration is loaded at startup by each service from the process.env object in Node.js. Different deployment methods, such as Docker Compose (.env file) or Helm (values.yaml), provide distinct ways to supply these variables to the running containers.
Core Concepts
The configuration is managed across several packages, with packages/backend-core providing the base set of variables that are inherited and extended by the server and worker packages.
This diagram shows how configuration is sourced from deployment-specific files and consumed by the various Budibase services.
Core Backend Configuration
These variables are defined in packages/backend-core/src/environment.ts and are available to all backend services. They form the foundation of the application's configuration.
| Variable | Description | Default |
|---|---|---|
NODE_ENV | The node environment. Determines if the application runs in development, test, or production mode. | "development" |
LOG_LEVEL | Sets the logging verbosity. | "info" |
PORT | The port the service will listen on. | 4001 |
JWT_SECRET | Secret key for signing JSON Web Tokens. CRITICAL for security. | undefined |
JWT_SECRET_FALLBACK | A fallback secret to allow for graceful key rotation. | undefined |
API_ENCRYPTION_KEY | Key for encrypting sensitive data like API keys in the database. | undefined |
API_ENCRYPTION_KEY_FALLBACK | A fallback key for graceful rotation of the encryption key. | undefined |
INTERNAL_API_KEY | An API key used for internal service-to-service communication. | undefined |
INTERNAL_API_KEY_FALLBACK | A fallback key for graceful rotation of the internal API key. | undefined |
COOKIE_DOMAIN | The domain to set on session cookies. | undefined |
Sources: packages/backend-core/src/environment.ts:8-33
Server Configuration
The main app-server extends the core configuration with variables for connecting to databases, object storage, and other services. These are defined in packages/server/src/environment.ts.
| Variable | Description | Default |
|---|---|---|
REDIS_URL | The connection URL for the Redis instance. | "redis://localhost:6379" |
COUCH_DB_URL | The connection URL for the CouchDB instance. | "http://localhost:5984" |
MINIO_URL | The URL for the MinIO object storage service. | "http://localhost:9000" |
MINIO_ACCESS_KEY | The access key for MinIO. | "minio" |
MINIO_SECRET_KEY | The secret key for MinIO. | "minio_dev" |
S3_BUCKET | The name of the S3/MinIO bucket to use for file storage. | "budibase" |
APPS_URL | The URL of the app service, used for internal communication. | "http://localhost:4002" |
WORKER_URL | The URL of the worker service, used for internal communication. | "http://localhost:4003" |
PLATFORM_URL | The public-facing URL of the Budibase installation. | undefined |
ENABLE_ANALYTICS | Toggles anonymous usage analytics. | true |
SMTP_HOST | SMTP server hostname for sending emails. | undefined |
SMTP_PORT | SMTP server port. | 587 |
SMTP_USER | SMTP username. | undefined |
SMTP_PASSWORD | SMTP password. | undefined |
SMTP_FROM | The "From" address for emails. | undefined |
GOOGLE_CLIENT_ID | Client ID for Google SSO. | undefined |
GOOGLE_SECRET | Client secret for Google SSO. | undefined |
Sources: packages/server/src/environment.ts:13-70
Worker Configuration
The worker service handles background jobs and automations. It shares many configuration variables with the server for connecting to backend services.
| Variable | Description | Default |
|---|---|---|
REDIS_URL | The connection URL for the Redis instance. | "redis://localhost:6379" |
COUCH_DB_URL | The connection URL for the CouchDB instance. | "http://localhost:5984" |
MINIO_URL | The URL for the MinIO object storage service. | "http://localhost:9000" |
MINIO_ACCESS_KEY | The access key for MinIO. | "minio" |
MINIO_SECRET_KEY | The secret key for MinIO. | "minio_dev" |
S3_BUCKET | The name of the S3/MinIO bucket to use for file storage. | "budibase" |
APPS_URL | The URL of the app service. | "http://localhost:4002" |
WORKER_URL | The URL of the worker service. | "http://localhost:4003" |
Sources: packages/worker/src/environment.ts:11-26
Deployment Scenarios
Docker Compose (.env.sample)
For Docker-based deployments, a .env file is used to provide configuration. The sample file highlights the most critical variables to set.
| Variable | Description |
|---|---|
PORT | The main port for the Budibase proxy service. |
JWT_SECRET | Required. A long, random string for session security. |
MINIO_ACCESS_KEY | Required. Access key for object storage. |
MINIO_SECRET_KEY | Required. Secret key for object storage. |
COUCH_DB_USER | Username for the internal CouchDB database. |
COUCH_DB_PASSWORD | Required. Password for the internal CouchDB database. |
REDIS_PASSWORD | Required. Password for the internal Redis instance. |
INTERNAL_API_KEY | Required. A secret key for internal API calls. |
Sources: hosting/.env.sample
Kubernetes (Helm Chart)
The Budibase Helm chart provides a highly configurable way to deploy to Kubernetes. Variables are set in a values.yaml file, which are then translated into Kubernetes secrets and environment variables for the pods.
Below is a selection of important configuration keys from the Helm chart.
Helm values.yaml Key | Corresponding Env Var | Description |
|---|---|---|
globals.jwtSecret | JWT_SECRET | Secret used for signing JWTs. |
globals.internalApiKey | INTERNAL_API_KEY | API key for internal Budibase API calls. |
globals.apiEncryptionKey | API_ENCRYPTION_KEY | Used for encrypting API keys and environment variables. |
globals.platformUrl | PLATFORM_URL | The public-facing URL of the installation. |
globals.smtp.host | SMTP_HOST | The hostname of your SMTP server. |
globals.smtp.password | SMTP_PASSWORD | The password for your SMTP server. |
services.redis.url | REDIS_URL | Overrides the in-cluster Redis with an external one. |
couchdb.adminPassword | COUCH_DB_PASSWORD | Sets the admin password for the CouchDB instance. |
services.objectStore.minio | N/A | Set to false to use an external object store like S3. |
services.objectStore.url | MINIO_URL | URL for an external object store. |
services.objectStore.accessKey | MINIO_ACCESS_KEY | Access key for an external object store. |
services.objectStore.secretKey | MINIO_SECRET_KEY | Secret key for an external object store. |
Sources: charts/budibase/README.md
Portainer
The Portainer template simplifies deployment by presenting a form to the user. These form fields are then mapped to the core environment variables required by the services.
| Portainer Label | Corresponding Env Var | Default |
|---|---|---|
Main port | MAIN_PORT | 10000 |
JWT secret | JWT_SECRET | change-me |
MinIO access key | MINIO_ACCESS_KEY | change-me |
MinIO secret key | MINIO_SECRET_KEY | change-me |
Couch DB password | COUCH_DB_PASSWORD | change-me |
Redis password | REDIS_PASSWORD | change-me |
Internal API key | INTERNAL_API_KEY | change-me |
| (preset) | BUDIBASE_ENVIRONMENT | PRODUCTION |
Sources: hosting/portainer/template.json
Special States: Maintenance Mode
Budibase can enter a maintenance mode if it detects a critical misconfiguration or an outdated dependency. One such case is when the CouchDB instance is missing the required SQS (Simple Queue Service) component, which is necessary for modern versions of Budibase.
When this SQS_MISSING state is detected, the system displays a maintenance screen. A more detailed message is shown to administrators within the builder, guiding them to the migration documentation.
This flow shows the logic for entering maintenance mode.