Environment Variables
The default configuration in GrowthBook is optimized for trying things out quickly on a local dev machine. Beyond that, you can customize behavior with Environment Variables.
Domains and Ports
This is used to generate links to GrowthBook and enable CORS access to the API.
- APP_ORIGIN - default http://localhost:3000
- API_HOST - default http://localhost:3100
If you want to run GrowthBook on a different host than localhost, you need to add the above environment
variables to your docker-compose.yml
file.
growthbook:
...
environment:
- APP_ORIGIN=http://<my ip>:3000
- API_HOST=http://<my ip>:3100
Important: In order for authentication cookies to work correctly, both the app and api domains must be considered the "same site". They can be on different subdomains or ports, but the root domain must be the same.
- Works:
gb.example.com
andgb-api.example.com
- Breaks:
gb-example.com
andgb-api-example.com
If you need to change the ports on your local dev environment (e.g. if 3000
is already being used),
you need to update the above variables AND change the port mapping in docker-compose.yml
:
growthbook:
ports:
- "4000:3000" # example: use 4000 instead of 3000 for the app
- "4100:3100" # example: use 4100 instead of 3100 for the api
...
environment:
- APP_ORIGIN=http://<my ip or url>:4000
- API_HOST=http://<my ip or url>:4100
Production Settings
- NODE_ENV - Set to "production" to turn on additional optimizations and API request logging
- MONGODB_URI - The MongoDB connection string
- JWT_SECRET - Auth signing key (use a long random string)
- ENCRYPTION_KEY - Data source credential encryption key (use a long random string)
If you change the ENCRYPTION_KEY
, you will need to migrate any existing data sources using the following script:
# If you didn't have an ENCRYPTION_KEY before, leave OLD_KEY blank below
docker-compose run growthbook yarn migrate-encryption-key OLD_KEY
NODE_ENV
to to "production" and change the JWT_SECRET
to a random string. Using the production
node environment and the default JWT_SECRET
will throw an error.Email SMTP Settings
This is required in order to send experiment alerts, team member invites, and reset password emails.
- EMAIL_ENABLED ("true" or "false")
- EMAIL_HOST
- EMAIL_PORT
- EMAIL_HOST_USER
- EMAIL_HOST_PASSWORD
- EMAIL_FROM
Google OAuth Settings
Only required if using Google Analytics as a data source
- GOOGLE_OAUTH_CLIENT_ID
- GOOGLE_OAUTH_CLIENT_SECRET
File Uploads
The UPLOAD_METHOD environment variable controls where to store uploaded files
and screenshots. The supported values are local
, s3
, and google-cloud
.
local
This is the default value. Uploads are stored in the GrowthBook docker container at
/usr/local/src/app/packages/back-end/uploads
. In production, you should mount a volume here to persist uploads across container restarts.
s3
Store uploads in an AWS S3 bucket.
- S3_BUCKET
- S3_REGION (defaults to
us-east-1
) - S3_DOMAIN (defaults to
https://${S3_BUCKET}.s3.amazonaws.com/
) - AWS_ACCESS_KEY_ID (not required when deployed to AWS with an instance role)
- AWS_SECRET_ACCESS_KEY (not required when deployed to AWS with an instance role)
google-cloud
Store uploads in a Google Cloud Storage bucket.
- GCS_BUCKET_NAME
- GCS_DOMAIN (defaults to
https://storage.googleapis.com/${GCS_BUCKET_NAME}/
) - GOOGLE_APPLICATION_CREDENTIALS (not required when deployed to GCP with an instance service account)
Enterprise Settings
Some features in self-hosted GrowthBook are only available with an Enterprise license key. Reach out to sales@growthbook.io to learn more.
- LICENSE_KEY - Your signed license key provided by the GrowthBook team
- SSO_CONFIG - A JSON-encoded string that configures SSO (using OpenID Connect). It should be an object with the following keys:
clientId
(string)clientSecret
(string)emailDomain
(string, optional) - Allow auto-joining from a specified email domainmetadata
(object)issuer
(string)authorization_endpoint
(string)jwks_uri
(string)id_token_signing_alg_values_supported
(array of strings)token_endpoint
(string)code_challenge_methods_supported
(array of strings)logout_endpoint
(string, optional)
extraQueryParams
(object, optional) - Dictionary of extra query params to be passed along with the/authorize
OAuth calladditionalScope
(string, optional) - Additional scopes to include, along with the default value:openid profile email
For SSO, make sure the following callback URL is whitelisted:
{APP_ORIGIN}/oauth/callback
For the best SSO user experience, enable offline access and refresh tokens in your Identity Provder.
Other Settings
- EXPERIMENT_REFRESH_FREQUENCY - Default update schedule for experiment results. Update when stale for X hours (default
6
). - QUERY_CACHE_TTL_MINS - How long (in minutes) to cache and re-use SQL query results (default
60
) - DEFAULT_CONVERSION_WINDOW_HOURS - How many hours after being put into an experiment does a user have to convert. Can be overridden on a per-metric basis. (default
72
) - DISABLE_TELEMETRY - We collect anonymous telemetry data to help us improve GrowthBook. Set to "true" to disable.