Configure Unleash
This guide explains how to configure your self-hosted Unleash instance when running it via Docker Compose or the Docker CLI.
When running Unleash using Docker, configuration is managed through environment variables.
Configuration method
Docker Compose
Docker CLI
Configure the database
Unleash requires a PostgreSQL database to store its data. You must provide connection details using environment variables.
Database environment variables
For detailed PostgreSQL SSL configuration options via environment variables, refer to the node-postgres documentation on SSL. Ensure file paths for certificates (DATABASE_SSL_*_FILE) are accessible inside the running container (for example, via Docker volumes).
Troubleshooting
Database connection issues
If you experience intermittent database connection errors or timeouts, particularly after periods of inactivity, a network component (like a firewall or load balancer) between the Unleash server and the PostgreSQL database may be closing idle TCP connections. If the network component’s idle timeout is shorter than the connection pool’s idle timeout (DATABASE_POOL_IDLE_TIMEOUT_MS), the pool may try to use a connection that the network device has already terminated.
Solution:
- Determine the idle connection timeout value configured on any relevant network devices (firewalls, load balancers) between Unleash and its database.
- Ensure the Unleash database pool idle timeout, set via the
DATABASE_POOL_IDLE_TIMEOUT_MSenvironment variable (default:30000ms), is configured to be less than the network device’s idle timeout setting. For instance, if your firewall closes idle connections after 60 seconds, consider keeping or settingDATABASE_POOL_IDLE_TIMEOUT_MSto30000(30 seconds).
Back up and restore the database
It is highly recommended to back up your Unleash database, especially before upgrades or significant changes. When running PostgreSQL within a Docker container, use docker exec to run the standard pg_dump (backup) and psql (restore) commands inside the container.
-
Identify container name: Find your PostgreSQL container’s name or ID (for example, using
docker ps). -
Create a backup: Run the following command on your host machine. It executes
pg_dumpinside the container and saves the output to a.dumpfile on your host. -
Restore from backup: Run the following command on your host machine. It executes
psqlinside the container, reading the specified backup file from your host.
Migrate an instance
If you are moving an instance (for example, to a new cloud provider or cluster) and need full fidelity, use a database dump and restore instead of API export/import.
This is the safest way to keep data parity. Use export/import primarily for ongoing synchronization of feature flags, not full migrations.
Enable self-signed certificates
To connect to a PostgreSQL database using a self-signed certificate, you need to:
- Set the
DATABASE_SSL_REJECT_UNAUTHORIZEDenvironment variable tofalse. Disabling this check bypasses validation that the server certificate is signed by a trusted CA; only use this when you fully trust the network path and the server identity. - Provide the self-signed certificate itself as the Certificate Authority (CA) for Unleash to trust. Use either the
DATABASE_SSL_CA_FILEvariable (pointing to the certificate file mounted inside the container) or include the certificate string within the JSON object passed toDATABASE_SSL_CA_CONFIG.
Configure the Unleash instance URL
Set the public URL where your Unleash instance can be accessed using the environment variable UNLEASH_URL. For example, https://unleash.mycompany.com or https://app.mycompany.com/unleash. This URL is used for creating password reset links, signup links for new users, and links within integrations, such as Slack or Datadog.
Configure an email server
Configure an SMTP server to enable password resets and user welcome emails. If not configured, self-service password resets will not be available.
Troubleshooting
If emails fail to send or contain errors:
- Verify configuration: Double-check all
EMAIL_*environment variables are correctly set for your SMTP provider. - Check email links: Ensure
UNLEASH_URLis the complete public URL for your instance, including thehttp://orhttps://protocol prefix. - Fix SSL/TLS errors:
- Confirm
EMAIL_PORTandEMAIL_SECUREmatch your SMTP server’s requirements (for example, port 587 or 465 often requiresEMAIL_SECURE=true).
- Confirm
- Custom CA certificates for SMTP: If using a custom SMTP CA certificate with
EMAIL_SECURE=true, ensure it’s trusted by mounting the PEM file into the container and setting theNODE_EXTRA_CA_CERTSenvironment variable to its path inside the container.
Other configuration options
Authentication and authorization
Initial setup
Server behavior
Security and sessions
Logging and monitoring
Feature and API behavior
Rate limiting
Controls requests per minute per IP for specific API endpoints.
HTTP proxy support
If your Unleash server needs to make outgoing requests (for example, for integrations, webhooks, version checks) through an HTTP/HTTPS proxy, you can configure this using standard proxy environment variables.
HTTP_PROXY: URL of the HTTP proxy (for example,http://proxy.mycompany.com:8080).HTTPS_PROXY: URL of the HTTPS proxy (for example,http://secureproxy.mycompany.com:8081).NO_PROXY: Comma-separated list of hosts or domains that should bypass the proxy.
Set these environment variables when starting your Unleash container.
Resource recommendations
While specific minimums depend heavily on usage patterns (number of flags, frequency of requests, number of connected SDKs), a general starting point for the Unleash server container could be:
- CPU: 0.5 - 1 vCPU
- Memory: 512 MiB - 1 GiB RAM
For the PostgreSQL database, consider:
- CPU: At least 1 vCPU
- Memory: At least 1 GiB RAM
- Storage: At least 5 GiB SSD storage
For example, you might consider some of the following managed PostgreSQL services and machine types:
- AWS RDS for PostgreSQL:
db.t4g.small(2 vCPU / 2 GiB RAM). - Azure Database for PostgreSQL (Flexible Server):
B2s(Burstable, 2 vCPU / 4 GiB RAM). - GCP Cloud SQL for PostgreSQL:
db-n1-standard-1(1 vCPU / 3.75 GiB RAM) as the starting point.
Monitor resource usage and adjust based on your specific load.
Next steps
Securing Unleash
Password requirements
By default, Unleash uses password-based login. When using passwords, Unleash enforces strong passwords:
- Minimum 10 characters long
- Contains at least one uppercase letter
- Contains at least one number
- Contains at least one special character
Configure SSO and access controls
To learn more about managing users, implementing single sign-on instead of passwords, setting up access controls, and using audit logs, read the User Management, Access Controls and Auditing guide.
Scaling Unleash
As your feature flag usage grows, ensuring your Unleash setup can handle the load is crucial. To learn how to implement high availability, improve resilience, and apply other scaling strategies, read the Scaling Unleash guide.