Configuration

Smarter is a Docker-based Django web application and REST API that is highly configurable via environment variables, configuration files, and infrastructure-as-code templates. This document outlines the various configuration options available for Smarter. The guidelines that follow assume that you are deploying Smarter using the recommended approach of AWS EKS with the provided Helm chart and Terraform modules.

How the settings are initialized

Each setting value originates from one of a few places: in Kubernetes, the GitHub Actions secrets, the Kubernetes Secrets that smarter-infrastructure creates, and the Helm chart’s values. Locally these originate from .env and overrides/settings.yaml. The deploy action and the Helm release, or Docker Compose, turn these into the process’s environment variables. Each kind of pod gets a Secret of its own, with only the settings and credentials that its code uses (ADR-038), and the tool workers get no credential but their own Redis user’s. The LLM providers’ and services’ api keys never become environment variables: they are bootstrap secrets, files that only the init Job reads, and that it turns into Smarter Secrets (bootstrapSecrets, below). smarter_settings reads each of its fields from its environment variable, else uses the default declared on the field, then validates and freezes its final settings. Django’s settings modules derive their settings from smarter_settings where possible. Last, the deployment’s overrides overwrite them: the overrides/settings.yaml file locally, then DJANGO_* environment variables.

Sources (GitHub Actions secrets, the Kubernetes Secrets mysql-smarter, mysql-root, smarter-admin, aws-ses-config, smarter-django-secret-key, smarter-redis-password and smarter-redis-users, the Helm chart's values, .env and overrides/settings.yaml) become environment variables through the deploy action and the Helm release's Secret for each kind of pod, or Docker Compose. The api keys go to the Secret smarter-bootstrap-secrets, which only the init Job mounts, as files. smarter_settings reads each of its fields from its variable, else uses the default declared on the field, and validates them. Django's settings modules, base.py, base_aws.py and the environment's module, derive from smarter_settings; the overrides file and DJANGO_* variables overwrite them. The startup logs, the initialize commands and the web console read the result.

1. AWS Infrastructure Configuration

See Cloud Infrastructure for details on configuring the necessary AWS resources using Smarter-supported Terraform modules. The official Smarter Terraform modules favor simplicity, paradoxically making them conducive to customization. You should be able to fork and modify these modules to suit your specific infrastructure requirements.

2. Django Settings

In certain cases, Smarter uses a superseding singleton settings module (hereon, smarter_settings; see Smarter Settings) to establish configuration values. This module leverages Pydantic to implement enhanced validation and type checking for configuration settings. You are STRONGLY recommended to avoid modifying this module directly unless you are fully aware of the implications. Many of Smarter’s configuration settings are programmatically derived from environment variables set in the Docker container or Kubernetes pod. Modifying this logic can lead to unexpected behavior.

Note

The smarter_settings module also leverages Pydantic’s SecretStr type to securely handle sensitive configuration values such as API keys, tokens, and passwords. This ensures that sensitive information is not inadvertently exposed in logs or error messages.

Usage:

from smarter.common.conf import smarter_settings

print(smarter_settings.environment_cdn_domain)
smarter_settings.subsystem_smtp_password.get_secret_value()  # a SecretStr, None where this pod doesn't hold it
smarter_settings.dump

In all other cases, Smarter uses standard Django settings located in smarter/settings/: base.py for every environment, base_aws.py for the environments on AWS, and one module per environment (local.py, alpha.py, beta.py, next.py, prod.py).

Django defines many more settings than Smarter sets. See Django Settings for every one, and the next section for how a deployment overrides them.

3. Overrides

A deployment can override any Django setting, without changing Smarter’s code: a session’s lifetime, the administrators’ email addresses, a Content Security Policy, or a setting of a Django package that you add. The override overwrites Smarter’s own value, in every environment.

Danger

An override is a hammer. It replaces Smarter’s value of that setting outright, in every environment, however carefully Smarter’s value was built, and Smarter does nothing to stop you or warn you.

  • Many of Smarter’s settings are computed, per environment, from other settings and from smarter_settings: the database, the caches and their separate Redis databases for sessions and Celery, storage on S3 or disk, allowed hosts, CORS and CSRF origins, cookie security, the Content Security Policy. Yours replaces the result, and nothing that was derived from the old value is computed again.

  • A list or a dictionary is replaced whole, not merged. A LOGGING or CACHES that leaves out one of Smarter’s entries removes it.

  • Smarter checks only that a value has the right type, not that it is sensible. A wrong value can stop the platform, or quietly weaken its security: a cookie sent without HTTPS, a host that should be refused.

Before you override a setting, read how Smarter sets it in smarter/settings/, prefer a SMARTER_* setting where one exists, change as few settings as you can, and try the change locally before you deploy it. To undo one, delete it: Smarter’s own value applies again.

Important

Where your overrides go depends on where Smarter runs.

  • Local development (Docker Compose, make run): overrides/settings.yaml, in the repository’s root. This is for your own computer only. The file is never built into the Docker image, and no deployed environment reads it.

  • alpha, beta, next, prod, and every other environment on AWS (Kubernetes): an environment variable named DJANGO_<SETTING> in env in the Helm chart’s values. To change prod, change the Helm values that prod’s deployment uses, never overrides/.

The file is a YAML map of upper case setting names to values. A variable sets one setting, and a list or a dictionary is written as JSON:

# overrides/settings.yaml, locally
SESSION_COOKIE_AGE: 3600
ADMINS:
  - ops@example.com
# the Helm chart's values, on Kubernetes
env:
  DJANGO_SESSION_COOKIE_AGE: "3600"
  DJANGO_ADMINS: '["ops@example.com"]'

DJANGO_* variables work locally too, in .env.

Settings supersede each other in this order, from lowest to highest priority:

  1. smarter/settings/base.py

  2. smarter/settings/base_aws.py, in the environments on AWS

  3. the environment’s own module, e.g. prod.py

  4. the overrides file, overrides/settings.yaml, locally

  5. your DJANGO_* environment variables

Your value replaces Smarter’s whole setting: a dictionary such as LOGGING is not merged with Smarter’s. Where a SMARTER_* setting exists for what you want to change (see the previous section), prefer it, since Smarter derives other settings from it.

See Overrides for the full explanation: the steps for local development and for the Helm chart, how to write each kind of value, the rules, and how to check what applied.

Turning resource types off

Each family of resources can be turned off with its own environment variable, e.g. so that a course’s students see only the resources that it teaches. Every flag defaults to true.

Environment variable

Resource kinds

SMARTER_APP_CONNECTION_ENABLE

ApiConnection, SqlConnection

SMARTER_APP_GUARDRAIL_ENABLE

Guardrail

SMARTER_APP_LLMCLIENT_ENABLE

LLMClient, CustomDomain

SMARTER_APP_LLMHOST_ENABLE

LLMHost, LLMHostCompute

SMARTER_APP_LLMTOOL_ENABLE

Plugin, ApiPlugin, ImageSearchPlugin, SkillPlugin, SqlPlugin, WebsearchPlugin, and Extensions

SMARTER_APP_MCPCLIENT_ENABLE

MCPClient

SMARTER_APP_ORCHESTRATOR_ENABLE

Orchestrator

SMARTER_APP_PROVIDER_ENABLE

Provider

SMARTER_APP_PROXY_ENABLE

Proxy

SMARTER_APP_SECRET_ENABLE

Secret

SMARTER_APP_VECTORSEARCH_ENABLE

Vectorsearch

SMARTER_APP_VECTORSTORE_ENABLE

Vectorstore

A resource type that is off is off everywhere:

  • its web console pages, its web console api (/api/web/) and its REST api (/api/v1/) answer 404, and the session api reports its flag as false, so the console leaves out its sidebar link;

  • the cli api refuses its manifests, e.g. smarter apply of a Guardrail answers 400, with the environment variable that turns it on, and smarter validate reports a disabled_kind error;

  • initialize_platform skips its example manifests;

  • its app connects none of its signal receivers;

  • with SMARTER_APP_LLMCLIENT_ENABLE=false, deployed LLMClients answer 404.

Accounts, users, budgets, API keys and prompts have no flag: the platform doesn’t work without them.

Resources that refer to each other need their types on together: an LLMClient’s plugins need SMARTER_APP_LLMTOOL_ENABLE, a Proxy’s provider SMARTER_APP_PROVIDER_ENABLE. manage.py check warns about each such reference to a type that is off (smarter.W003), from the models’ relations, and manage.py check --database default about a type that is off and still has rows in the database (smarter.W004), which nothing can read or delete through Smarter until it is on again. See smarter.lib.manifest.sam_apps and smarter.lib.manifest.checks.

4. Asynchronous Task Queue Configuration

Smarter uses Celery as its asynchronous task queue. Celery’s settings are the CELERY_* settings in smarter/settings/base.py. Celery relies on a message broker and result backend, both of which can be configured via environment variables. By default, Smarter is configured to use Redis as both the message broker and result backend. This is known to work well for most use cases. However, you can configure Celery to use other brokers and backends as needed.

If you are not running at scale then the default Celery configuration should suffice.

See smarter/workers/celery.py for more details on how Celery is configured in Smarter.

5. Beat Scheduler Configuration

Smarter uses Celery Beat to schedule periodic tasks. The schedule is defined in code, in smarter/workers/celerybeat.py, not in the database, so it can’t be edited in the Django admin. Like asynchronous task queue configuration, the Beat scheduler relies on the same message broker as Celery. In AWS, Beat keeps its schedule state in Redis with RedBeat (CELERY_BEAT_SCHEDULER), so that a restarted Beat pod picks up where the last one stopped. Locally it uses Celery’s default file-based scheduler.

6. Helm Chart Configuration

The Smarter cloud platform is deployed using Smarter’s official Helm chart. Configuration options for this Helm chart can be found in the values.yaml file. Additional documentation on this Helm chart can be found in the Helm Chart Documentation.

Warning

Kubernetes is a complex topic with a substantial learning curve. The Helm chart, as published is known to work well for most use cases. That is, installations that are running in production, at scale, or otherwise mission critical. It is EXCEEDINGLY UNLIKELY that you will need to modify the Helm chart configuration to suit your needs. Therefore, you are STRONGLY recommended to avoid modifying the Helm chart itself, beyond providing the pre-programmed values.yml data, unless you know what you are doing, and you are fully aware of the implications.

7. Dockerfile Configuration

The official Docker container image for Smarter (hub.docker.com/r/mcdaniel0073/smarter) is built using the Dockerfile from the main branch of Smarter’s main code repository, https://github.com/smarter-sh/smarter.

This Docker image favors simplicity over configurability, hence, there are limited configuration options.

8. GitHub Actions Secrets Configuration

If you intend to use the provided GitHub Actions workflows for CI/CD, you will need to a.) fork the repository, and b.) configure several GitHub Secrets in your repository. See CI/CD for details on the required secrets and their configuration.

See GitHub Secrets Configuration for the list of currently configured GitHub Secrets in the main Smarter repository.

GitHub Actions Secrets Reference

Secret Name

Description

AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY

The deploy IAM user’s access key, with which the workflows push the image and run helm and kubectl in the environment’s namespace. No pod receives it where the environment has IAM roles

AWS_REGION

The AWS region of the environment

AWS_IAM_ROLE_ARN

The naming base of the pods’ IAM roles, <namespace>-smarter-irsa: the deploy derives each kind of pod’s role, <namespace>-smarter-<pod>-irsa, from it

AWS_BACKUP_IAM_ROLE_ARN

The IAM role of the nightly backup, which may only write backups

EKS_CLUSTER_NAME

The EKS cluster that the deploy runs helm against

DOCKERHUB_USERNAME, DOCKERHUB_PAT

The Docker Hub login of the image-pull Secret. No pod’s environment holds them

FERNET_ENCRYPTION_KEY

The key that encrypts Smarter Secrets in the database. The app, the workers and the init Job hold it

AUTHENTICATION_BACKENDS

Django’s AUTHENTICATION_BACKENDS, which turn the social sign-ins on

SOCIAL_AUTH_GITHUB_KEY, SOCIAL_AUTH_GITHUB_SECRET, SOCIAL_AUTH_GOOGLE_OAUTH2_KEY, SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET, SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY, SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET

The OAuth clients of the GitHub, Google and LinkedIn sign-ins. Only the app holds them

SMARTER_EMAIL_ADMIN, DEPLOY_NOTIFY_EMAILS

The platform administrator’s address, and the addresses that the deploy notifies

SMARTER_LOGO, SMARTER_BRANDING_*

The platform’s branding: name, address, contacts, support hours, currency and time zone

SMARTER_EXTENSION_REGISTRY_PUBLIC_KEY

The public key that verifies the signed Extension registry

SMARTER_MYSQL_BACKUP_PASSWORD

(optional) Password of the read-only MariaDB account, smarter_backup, that the nightly backup dumps the database with. Unset: the backup dumps as root

SLACK_BOT_TOKEN

(optional) A Slack app’s bot token, xoxb-..., with the scopes chat:write and files:write. The init Job and the nightly backup post their outcome and log to Slack with it. See Smarter on Kubernetes

DEBUG_MODE, SMARTER_SETTINGS_OUTPUT

SMARTER_DEBUG_MODE, and whether the pods log their settings when they start

ANTHROPIC_API_KEY, COHERE_API_KEY, FIREWORKS_API_KEY, GEMINI_API_KEY, LLAMA_API_KEY, MISTRAL_API_KEY, OPENAI_API_KEY, TOGETHERAI_API_KEY

The built-in LLM providers’ api keys. Bootstrap secrets: each becomes the Smarter Secret of its name in lower case, e.g. openai_api_key

TAVILY_API_KEY, BRAVE_SEARCH_API_KEY

The search plugins’ api keys, bootstrap secrets tavily_api_key and brave_search_api_key. See Tavily and ImageSearchPlugin

GOOGLE_MAPS_API_KEY, GOOGLE_SERVICE_ACCOUNT_B64

Google’s: the weather Extension’s key, and a service account, base64 encoded, whose json becomes the bootstrap secret google_service_account

PINECONE_API_KEY

(optional) The Pinecone managed vector database’s key, bootstrap secret pinecone_api_key

The SMTP credentials and the database’s are not GitHub secrets: they are Kubernetes Secrets that smarter-infrastructure creates (aws-ses-config, mysql-smarter, mysql-root), which the chart and the deploy read.

9. Secrets Management

Smarter uses many kinds of secrets: api keys, database and Redis passwords, and encryption keys. Each is stored in one place, and each pod receives only the ones that its code uses.

  • GitHub Actions secrets, in each GitHub environment, for the deploy workflow, as described above.

  • Kubernetes Secrets that smarter-infrastructure generates with Terraform: mysql-smarter, mysql-root, smarter-admin, smarter-django-secret-key, aws-ses-config, smarter-redis-password and smarter-redis-users. The Helm chart reads them when it is installed or upgraded (infrastructureSecrets in its values.yaml), so they are never copied into a values file, and the deploy action reads some of them with .github/actions/k8s-get-secret. Rotate one by regenerating it in Terraform, then deploying.

  • A Secret for each kind of pod, <appName>-env-<pod>, which the chart builds from the two above and its env. Each holds only the settings and credentials that its kind of pod uses (helm/charts/smarter/files/credentials.json, and the lists smarter.podKeys in _helpers.tpl). The tool and Extension workers have Secrets of their own, with no credential but their own Redis user’s. See ADR-038.

  • Bootstrap secrets, the LLM providers’ and services’ api keys (bootstrapSecrets in values.yaml, filled by the deploy action from the GitHub secrets). The chart puts them in the Kubernetes Secret smarter-bootstrap-secrets, which only the init Job mounts, as files, and manage.py initialize_bootstrap_secrets turns each file into the Smarter admin’s Secret of its name. Every service then reads the Smarter Secret, encrypted in the database with the Fernet key, never an environment variable.

  • Locally, .env, your own copy of .env.example, which make creates for you, and bootstrap-secrets/, which make bootstrap-secrets fills from it. Docker Compose reads .env into every container but the tool workers.

    Danger

    .env is for local development only. Never use it in production, and never commit it.

  • Pydantic SecretStr, in the code: every credential setting of smarter_settings is one, which masks it in dumps, logs and errors (ADR-007).

10. Logging Configuration

Every process logs to its standard output, with Python’s logging module, configured in LOGGING in smarter/settings/base.py. There are no log files in the pods. SMARTER_LOG_LEVEL sets the level. On Kubernetes, the Helm chart’s Alloy collects the pods’ output, redacts credentials and personal data from it, and stores it in Loki for 72 hours (SMARTER_SUBSYSTEM_LOGGING_LOKI_URL), where the MCPServer’s staff tools search it. See Operating Smarter at Scale. A second handler streams each request’s records, through Redis, to the web console’s server logs and to Smarter Chat’s sandbox mode.

Smarter additionally provides more granular control over logging for specific application components via waffle switches. These are useful for real-time, in-flight debugging and troubleshooting without requiring application restarts or code changes. See Smarter Logging.

Smarter Django Admin Waffle Switches

11. Database Configuration

The database’s settings are smarter_settings’ SMARTER_SUBSYSTEM_SQL_* settings, from which DATABASES in smarter/settings/base.py and base_aws.py is built. They follow the precedence of every setting, above: the field’s default, then the environment variable. On Kubernetes, the host, port, database, user and password come from smarter-infrastructure’s Kubernetes Secret mysql-smarter, and the administrator’s from mysql-root, which only the init Job, the backup Job and the bastion hold. Locally, they come from .env.

SMARTER_SUBSYSTEM_SQL_HOST: mysql.example.com
SMARTER_SUBSYSTEM_SQL_PORT: "3306"
SMARTER_SUBSYSTEM_SQL_DATABASE: smarter_platform_prod
SMARTER_SUBSYSTEM_SQL_USER: smarter_platform_prod
SMARTER_SUBSYSTEM_SQL_PASSWORD: <from the Kubernetes Secret mysql-smarter, or .env locally>

The password is a SecretStr: smarter_settings masks it in every dump, log and error, and the tool workers don’t receive it at all.

12. Email/Notification Configuration

Smarter sends email through AWS Simple Email Service (SES) by default, over SMTP on port 587, but you can configure it to use any SMTP server of your choice.

Tip

Use smarter-infrastructure’s Terraform to set up SES (see Cloud Infrastructure). It verifies the domain, creates an IAM user whose only permission is ses:SendRawEmail, and writes its SMTP credentials to the Kubernetes Secret aws-ses-config, which the Helm chart reads.

The settings are SMARTER_SUBSYSTEM_SMTP_*, from which Django’s EMAIL_* settings are built. On Kubernetes they come from aws-ses-config (its keys SMTP_HOST, SMTP_PORT, SMTP_USE_SSL, SMTP_USE_TLS, SMTP_USERNAME and SMTP_PASSWORD), and only the pods that send email receive the username and password. Locally, set them in .env:

SMARTER_SUBSYSTEM_SMTP_HOST: email-smtp.us-east-1.amazonaws.com
SMARTER_SUBSYSTEM_SMTP_PORT: "587"
SMARTER_SUBSYSTEM_SMTP_USE_SSL: "false"
SMARTER_SUBSYSTEM_SMTP_USE_TLS: "true"
SMARTER_SUBSYSTEM_SMTP_USERNAME: <a username generated in AWS SES>
SMARTER_SUBSYSTEM_SMTP_PASSWORD: <a credential generated in AWS SES>

You can test your SMTP configuration by sending a test email from the Django console:

python manage.py send_welcome_email --email john.doe@example.com

13. Static & Media Files Configuration

Media files, the files that users upload, are stored in the environment’s Amazon S3 bucket when AWS is configured, and served from its CloudFront CDN, cdn.<platform>; otherwise they are stored on the server’s file system.

Static files, the web console’s scripts, styles and images, are served by the server itself, with WhiteNoise, which needs no CDN and works on any installation. On AWS, set SMARTER_PLATFORM_STATIC_FILES_ON_CDN=true to serve them from the CDN instead: each deployment’s initialize_platform uploads them to the bucket, under static/, and the console’s pages load them from cdn.<platform>/static/ once that deployment’s upload is done. The pages, the api and the session stay on the platform’s own host. The deployment’s AWS user needs s3:PutObject, s3:PutObjectAcl, s3:GetObject and s3:ListBucket on the bucket. See Static Files on the CDN.

The storage settings are in smarter/settings/base.py. Avoid changing them unless you have a specific need.

Warning

When deploying Smarter in production environments, it is CRITICAL to ensure that static and media files are served securely using HTTPS. Failure to do so can lead to security vulnerabilities and data breaches. Always use Amazon CloudFront with SSL/TLS certificates for secure delivery of static and media files.

See Django Static Files Documentation for more details on how static and media files are configured in Smarter.

14. Smarter Settings Class Reference

The Smarter settings system is implemented as an immutable singleton object called smarter_settings. This object contains all validated, derived, and superseding configuration values for the platform. The smarter_settings class enforces a consistent set of rules for initializing configuration values from multiple sources, including environment variables, .env files, and class-defined defaults. All configuration values are strongly typed and validated. Where applicable, smarter_settings values take precedence over Django settings. You should use smarter_settings in preference to Django settings wherever possible, as Django settings are often initialized from values in smarter_settings.

Notes:

  • smarter_settings values are immutable after instantiation.

  • Every property or attribute in smarter_settings is guaranteed to have a value.

  • Sensitive values are stored as Pydantic SecretStr types to prevent accidental exposure.

  • Configuration values are initialized in the following order of precedence:

    1. Constructor (not recommended; prefer .env or environment variables)

    2. Environment variables, which include the .env file’s. Each field is read from its name in capitals with the SMARTER_ prefix, which is required: debug_mode from SMARTER_DEBUG_MODE. A list is comma-separated, and a boolean true or false. The exceptions keep the names that other tools use: AWS_PROFILE, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, GITHUB_TOKEN and DJANGO_SECRET_KEY.

    3. The default declared on each field. A default that depends on another setting, such as the SMTP sender at the root domain, is derived from that setting’s value.

  • The dump property returns a dictionary of all configuration values, which is useful for debugging and logging.

  • Always access configuration values via the smarter_settings singleton instance when possible.