CKAN environment variables for container deployments
Environment variable configuration lets one CKAN container image read its settings from the environment at startup, so the same build runs in development, staging and production with different hosts, URLs and credentials. A team needs it as soon as it runs CKAN in containers and wants to promote a tested image instead of rebuilding it for each environment. The settings still belong to ckan.ini, which CKAN reads for options such as the site title, database connection and search index address. The mechanism that maps environment variables onto those ckan.ini keys is provided by the ckanext-envvars extension, which uses a naming convention. Confirm that convention against the ckanext-envvars documentation and against the way your container image or Compose file passes variables, because a small mismatch leaves a setting at its file default without an obvious error.
Secrets need a separate decision. Database passwords, extension API keys and the application secret should not be baked into an image or committed to version control, so the container environment is the usual place to inject them at deploy time. Ask your platform team which secret store feeds those variables in each environment, how values are rotated, and whether any sensitive value is printed to container logs at startup. Also check that a setting is not defined in both ckan.ini and the environment with different values, because the winning value depends on the mapping in use and can differ between a local Compose stack and a cluster. Keep one inventory of every variable each environment must set, and review it whenever a CKAN release or an extension adds a new setting.
Verify the result before promotion. Start the same image in a staging environment with only environment variables supplied, then check the effective configuration from inside the running container by reading the values the application actually loads. Confirm that the site URL, database hosts and mail settings match that environment. Then test one deliberately wrong value in a throwaway environment to confirm that a bad setting fails visibly, instead of silently falling back to a default baked into the image. Record the variable inventory and the check results alongside each release, because security reviewers and auditors will ask how production configuration is controlled and who can change it. The exact checks depend on your deployment and on the CKAN version you run, so confirm the list with your own team before the first production release.
Which CKAN settings to move into environment variables
This table compares the main categories of CKAN configuration and shows when an environment variable suits a setting and when a mounted file suits it better. Read each row as a decision: the first two columns describe the conditions that favor each approach, and the last column lists what to check in your chosen image before you rely on it. The main takeaway is that secrets and per-environment endpoints usually belong in the runtime environment, while long, ordered or reviewed baselines are easier to manage as files.
| Setting category | Environment variable fits when | File or mounted config fits when | Confirm in your chosen image |
|---|---|---|---|
| Site identity and URLs | The same image runs in several environments, each with its own public hostname and site name. | The identity is fixed for one site and rarely changes, so a reviewed file is easy to audit. | Confirm which identity and URL settings the image maps to environment variables at startup. |
| Database connections | Connection endpoints come from a managed PostgreSQL service and differ between environments. | Connection options need extra parameters, such as certificate paths, that are awkward to pass one by one. | Confirm the DataStore write and read-only user settings are both exposed, and who creates the databases. |
| Solr and Redis connections | Service hostnames change between Compose, Kubernetes and managed services. | Service-specific options go beyond a simple host and port, or the team keeps one reviewed baseline. | Confirm the Solr version and schema match your CKAN release, and which Redis keys the image reads. |
| Plugin lists | The plugin list is identical across environments and is set by the build pipeline. | The list is long, order-sensitive or varies with extension-specific settings. | Confirm every listed plugin is installed in the image and that load order is preserved. |
| Storage and upload settings | Storage paths or size limits differ by environment but use the same volume layout. | A storage backend needs several linked settings that should be reviewed together. | Confirm uploads sit on a persistent volume shared by every container that serves them, and web server limits match. |
| Session keys and passwords | Values are injected at runtime from a secrets store and are never baked into an image. | The platform mounts secrets as files with restricted permissions and the image can read them. | Confirm values do not appear in logs, shell history or container inspection output, and how rotation works. |
| Debug and feature flags | Flags change between test and production without a rebuild. | Production needs a fixed, reviewed baseline that auditors can read as one document. | Confirm debug mode defaults to off in production and that nothing overrides it silently. |
| Changes at runtime | A container restart applies the change, which suits routine rollouts. | Changes must be versioned with the deployment and reviewed before they reach production. | Confirm whether the image reads settings only at startup, and what a restart needs to apply them. |
How environment variables reach the running CKAN processes
The diagram starts with two kinds of non-secret values: defaults kept in version control and per-environment overrides that replace those defaults. Secrets come from a separate secrets store or orchestrator secret. The container runtime combines these sources when it starts each container, and the CKAN web process, background workers and scheduled jobs all read their environment from the same image. The trust boundary marks where secrets leave the store and enter the runtime, so the image itself should hold no credentials. When you review the setup, check that each value has one clear source, that overrides cannot silently replace secrets, and that every process type receives the same set of variables.
Values flow from three sources through the runtime to every CKAN process.
Setting up environment variable configuration step by step
This sequence moves the settings in your ckan.ini file into environment variables that your container runtime supplies, with secrets kept apart from ordinary configuration. Each step ends with a check you can repeat, so you can show that the web process and the background workers read the same values in every environment. Run it in a non-production environment first.
Inventory settings in ckan.ini
Export every key set in the
ckan.inifile the portal uses today, including plugins, site URL, database and Solr connections, Redis, and FileStore settings. Include values that come from defaults so nothing is missed, and work from a copy taken from the running system. Compare the export across each environment to see which values differ before anything moves. Done when the platform owner has a reviewed list with each key, its current value and an accountable owner.Separate secrets from non-secret values
The platform owner labels each key as ordinary configuration or secret. Database passwords, mail and harvest source credentials, session and signing keys, and storage access tokens are secrets. Site title, public URL, plugin list and feature flags are usually ordinary, but confirm each label with the security team. Move secrets into your secrets manager or sealed deployment tool and keep them out of any file that goes into version control. Done when every key has one label, each secret has a named owner, and a search of the repository finds no secret values.
Map each setting to its variable name
Using the naming convention documented for ckanext-envvars, write a table that pairs each
ckan.inikey with the environment variable that will carry it. Confirm the exact pattern in the current ckanext-envvars documentation before writing the table, since a naming mismatch may leave a value unread. Flag any key with no documented mapping and decide with the CKAN team whether it stays in a file. Keep the table in version control beside the deployment manifests. Done when a script compares the table with the step one inventory and reports no unmapped keys.Load values into the container runtime
The platform team places non-secret variables in the Compose file or Kubernetes manifests and injects secrets through the secrets store the platform already uses, so they reach containers at start. Pass the same variable set to every CKAN container, web and workers alike. Then check the image itself: run
docker historyon the built image and search its layers and build arguments for known secret values. Done when the inspection finds no secret value in any layer and the web and worker containers list the same variable names.Start the stack and read effective configuration
Start the database, Solr, Redis, web and worker containers in the order your deployment defines, and wait for each health check to pass. Run the configuration check that your CKAN version provides inside the web container, and confirm the command in the CKAN documentation for that version. Compare each printed value with the expected value in the mapping table and flag any key that falls back to a default. Done when every mapped key matches its expected value and no unexpected default appears.
Confirm web and workers read the same values
Run the same configuration check inside a background worker container and compare its output with the web container's output. Then trigger one job that depends on configuration, such as a test email or a small resource upload that uses the FileStore, and check the worker logs for the expected settings and for errors about missing values. Done when non-secret keys match line for line across web and worker containers, and secret values are not printed in either output.
Check that secrets stay out of logs
Search startup output, the configuration check and recent web and worker logs for each secret value and for common patterns such as password or token assignments. Confirm the log level does not echo configuration at startup, and check the log platform that collects these streams, since copies can persist after a container is replaced. Done when a search of the collected logs returns no secret values, and the team records the search terms and date in the change record.
Handling secrets and access without leaking them
Each card names one place where CKAN configuration can expose credentials or drift from what the team approved. Work through them in order before the first production deployment, and record the owner and the check for each one. Most of these controls are easier to set up before launch than to retrofit once a portal is live and its credentials are in use.
Keep secrets out of images
CKAN images built with ckan.ini values or passwords written into a Dockerfile keep those values in every layer and in every registry copy. Anyone who can pull the image can read them, and rotating a value means rebuilding. Build images from configuration that contains no credentials, pass secrets at runtime, and check the image history and layers for strings such as database passwords and the beaker.session.secret value before pushing to a shared registry.
Protect logs and process listings
Secrets leak through places teams rarely review: a startup script that echoes the environment, a debug log that prints the database URL with its password, or a command line that passes a token as an argument, which ps shows to other users on the host. Inject secrets at start-up through your secret store, avoid passing them as command-line arguments, and confirm that container logs, uWSGI logs and error pages never print configuration values. Test by triggering an error and searching the logs for each secret.
Prevent drift between environments
Development, staging and production often differ in plugin lists, site URLs, Solr core names and DataStore settings, and the differences surface only after a release. Keep one set of variable names across environments, change only the values, keep the variable list under version control, and compare the effective configuration of each environment before promotion. Verify that ckan.site_url, ckan.plugins and the DataStore URLs point where each environment should, because a value copied from staging can send production traffic or writes to the wrong database.
Limit who reads environment definitions
In Kubernetes, Compose files and CI systems, anyone who can read a deployment object, a pipeline variable or a docker inspect result can usually read the environment values set on the workload, including passwords. Limit read access to the namespace or project that holds CKAN, separate the people who deploy from those who only view logs, and keep credentials in a secret store the orchestrator reads at start. Verify who holds read access to secrets and workload specs, and remove access left over from former staff and contractors.
Rotate database and session credentials
CKAN relies on several credentials that must change together: the main PostgreSQL connection, the DataStore write user and read-only user, and the session secret that signs login cookies. Changing the session secret usually signs out every user, and changing a database password without updating every consumer, including background workers, stops jobs from running. Write a rotation runbook for each credential, rotate the DataStore users separately, and test in staging that web processes and workers reconnect after a restart.
Audit configuration changes
A configuration change that no one recorded is the hardest incident to explain, especially when a plugin list or storage setting changes late on a Friday. Record who changed each variable, when, and through which pipeline, keep that history in version control or in the deployment platform's audit log, and require review for changes to authentication, plugin and storage settings. Verify that you can answer which value was live at a given time, and confirm that the audit trail is kept as long as your policy requires.
What changes between development, staging and production
Development is where values differ most from production, and where the team can accept looser settings. Site URLs point at a local hostname, the database and Solr endpoints run on a developer machine or a local Compose network, and debug output is switched on so errors are visible while code changes. These differences are expected. What should not change is the image itself: developers run the same image build that goes to staging, so the environment file is the only thing that swaps.
- Hostnames and URLs: Point the site address and internal service names at local addresses, but keep the variable names identical to the ones production uses.
- Debug settings: Enable debug output only in this environment, and confirm in your CKAN version's documentation which debug options can be set through environment variables.
- Credentials: Use throwaway database and API credentials generated for the local stack, never copies of production secrets.
- Plugin set: Load the extensions under development, and record any production extension that is missing locally so the gap is tested in staging.
Check that the variable names in the development file match the production file, so a misspelled key does not go unnoticed until deployment.
Staging exists to catch problems before production does, so it should match production as closely as your budget allows. Its hostnames, credentials and storage locations are separate, but the software path is the same: the same image tag, the same extension list, the same Solr and PostgreSQL versions and the same web server settings. Differences in those areas are where a staging test stops predicting production.
- Hostnames and URLs: Use a separate public name with its own TLS certificate, so redirects, cookies and the HTTPS scheme are tested the way users will meet them.
- Credentials: Issue separate database users, API tokens and SSO client registrations for staging, so a leak in one environment does not expose production.
- Storage locations: Point the FileStore and DataStore at separate volumes or buckets, and use sanitized or synthetic data when the source data is sensitive.
- Plugin set and versions: Keep the CKAN version, extension list and backing service versions identical to production, and record any intended difference in the release notes.
Confirm that every value that stays identical is listed in one place, so the team knows exactly what a passing staging run proves.
Production values carry live users and live data, so they are set once, stored in a secrets manager and changed only through the same reviewed process as the rest of the platform. The deployment system should inject them at runtime, so the exact image tag that passed staging is the image that runs. Promotion then means moving a tested tag forward and changing nothing else, and access to the production variable store should be limited to the people who operate the portal.
- Secrets: Inject database passwords, API keys and SSO client secrets at container start from a secrets store, so they do not sit in Compose files or version control.
- URLs and hostnames: Set the public site address and internal service names once, and confirm that the TLS termination and reverse proxy settings agree with them.
- Debug settings: Keep debug output off, and check each setting against the documentation for your CKAN version before release.
- Storage locations: Use the production FileStore and DataStore locations with backup and retention agreed in advance, and confirm that web server upload limits match the CKAN limits.
Before each release, compare the production variable names with staging and check that only the intended values differ.
Keeping configuration consistent across environments
Run one image and one configuration contract in every environment, and let only the values change. Keep the non-secret defaults in version control next to the Compose file or Kubernetes manifests, so the list of settings such as ckan.site_url and ckan.plugins is a file anyone on the team can read. Secrets such as database passwords and API keys stay out of that file. The repository records only their names and where they come from, such as an orchestrator secret or your secret store. When a new variable is added, it should appear in the defaults file first, with a documented default, so an environment that omits it fails in a predictable, visible way.
Treat changes to environment definitions like code changes. Every edit to a variable name, default or value source should go through pull request review by someone who owns the platform, and the history should show who changed a setting and when. Before a release, compare the effective configuration of staging and production: the variables the running containers actually receive, with secrets masked. A diff of names and non-secret values can expose a missing setting or a misspelled variable name, which would otherwise fall back silently to a CKAN default. Confirm which comparison method fits your deployment, since the approach differs between Compose and Kubernetes.
Configuration must be retested whenever the CKAN version moves, because the contract depends on the release. The CKAN release policy states that patch releases are intended not to break backwards compatibility and exclude schema changes and new features, while minor releases may include backwards-incompatible changes. CKAN targets about two minor releases a year, so a minor move, such as the move to 2.12.0 released on August 26, 2026, should trigger a full pass over every variable against that version's release notes. A patch move needs a lighter check: start the new image in staging, confirm it reads the same variables, and confirm the site loads. Record the CKAN version alongside each configuration diff so the next reviewer knows which contract was tested.
What to confirm before you rely on this pattern
Configuring CKAN with environment variables works only when the naming convention, the image, the extensions, the CKAN version and the secret path all line up in your environment. The six checks below cover what to verify before you depend on this pattern. Each card explains how to test its item, so you can confirm it in a staging deployment before production.
Naming convention and supported settings
Confirm the exact naming convention your ckanext-envvars version expects. Naming rules, supported settings and the mapping of nested keys can change between releases, so do not assume a name from another version or an older guide will load. Read the documentation for the version you plan to run, then start a test container with a distinct value for each setting you intend to move. Confirm each value appears in the effective configuration, and record the version you tested so the build can pin it.
Every setting read from the environment
Check whether the CKAN image and each extension you install read every setting from the environment as well as from ckan.ini. A setting missing from the mapping keeps its default or a value baked into the image, and the portal can start without an error. Dump the effective configuration from a running container and compare it with your list of expected values. Repeat the check after every image rebuild, because an upstream change can drop or rename a mapping.
Extensions that expect ini values
Some extensions read their settings from ckan.ini when the plugin loads and never check the environment. Those values can stay at defaults, or the file can hold a copy that drifts from the environment. Search each extension's documentation and source for its configuration keys, then test whether a changed environment value alters behavior after startup. For each file-only setting, decide whether to generate the ini file from environment values at container start or keep that key in the image with a documented reason.
Pinned CKAN version and patch
Confirm the exact CKAN version and patch level your image pins. A floating tag can pull in a newer minor release, which may include backwards-incompatible changes, and older patch releases lose support once a newer patch is published. Check that the tag names a specific patch, then compare it with the current support window in CKAN's release policy. Store the version next to your environment variable list, because a setting that works on one minor version may be renamed or ignored on another.
Release policySecrets store and orchestrator
Confirm how your secrets store delivers values to the CKAN containers. Environment variables can expose secrets through pod specifications, process listings, crash dumps and logs, while mounted files require the application or entrypoint to read them at start. Check which delivery method your orchestrator supports, who can read the secret objects, whether rotation triggers a restart, and whether every credential in your configuration is covered, including database and API keys. Test a rotation in a non-production environment before you rely on it.
Compliance acceptance of secret handling
Ask your compliance team whether the chosen secret handling meets its requirements before go-live. Assessors usually want to see where each secret is stored, who can read it, how access is logged, and how secrets are rotated and revoked. Provide a written data flow for each secret, the control owner for each step, and the evidence you will keep. DeployOpen can prepare these artifacts, but independent auditors and certification bodies make the final determination, so obtain written sign-off before you rely on the pattern.
Questions teams ask before moving CKAN configuration to environment variables
What does it cost to move CKAN configuration to environment variables?
Cost depends on how many settings your portal uses, how many environments share them and how many extensions add their own. Internal staff pay in hours spent mapping ckan.ini keys to variables, handling secrets, rebuilding images and testing each environment. An outside partner is paid against a written scope. The biggest drivers are the number of settings, the number of environments, the extensions that read configuration, and whether secrets already live in a managed store or in files. Most of the effort is one-time. Each new setting added later recurs as a small change that needs a variable name, a secret entry and a review. Ask any provider for the settings list in scope, the environments covered, the extensions included and the handover documents before comparing quotes. DeployOpen works under fixed-scope agreements, and its quote follows from that written scope.
How long does moving CKAN configuration to environment variables take?
Duration depends mainly on how much configuration exists, how many environments run it and how much of it already sits in a managed place. A single portal with one ckan.ini, one staging copy and a secrets store already in use moves faster than a multi-site estate where production, staging and test each carry hand-edited files and extensions keep their own settings files. Time goes into inventory, mapping keys to variables, moving secrets, rebuilding images, and then restarting and comparing each environment against the previous configuration. Schedule time for a parallel run before cutover so you can roll back. Production change approval also adds lead time. No duration is meaningful until the inventory is complete, so ask for a schedule only after the settings list is confirmed with your team.
What must our team provide before a configuration move starts?
Before work starts, your team should provide the current configuration, the container setup that runs CKAN, access to the secrets store, and an environment inventory. Each item lets the work begin without guessing.
- The current
ckan.iniand any extension configuration files, with a note of which version is in use. - The container definitions, such as Compose files or Kubernetes manifests, plus the image tags in use.
- Access to the secrets store, or a documented decision on where secrets will live, with rights for the people making the change.
- An environment inventory listing each development, staging and production instance, its hosts, its owner and who approves changes.
Your team also owns the decisions about which settings may change in production and who signs off. These lists must be accurate, because they become the scope of any written agreement.
Can an internal team move CKAN configuration to environment variables alone?
Yes, an internal team with CKAN, container and secrets experience can do it alone. The question is whether that team has the time and an independent reviewer for each change. The work needs someone who understands how CKAN reads configuration at startup, someone who manages the container platform, and someone who controls the secrets store. Without that mix, the most common gaps are missed settings in less-used extensions and secrets copied into images or logs. An internal team keeps knowledge in-house but carries the testing and documentation load itself. An outside partner brings a fixed scope, a written checklist and a handover, and is paid for the agreed work. Decide based on the skills you have, your release calendar and how much staff time you can release.
How should we handle CKAN extensions that read settings from files?
Extensions that read their own settings files need a separate decision, because an environment variable only helps if the extension's code reads it. Check each extension's documentation and source to see whether it reads values through CKAN's configuration object or opens its own file. Where it opens its own file, you have three options: keep that file and mount it into the container, change the extension to read from the environment, or ask the maintainer for support. Record the choice for each extension. Test that every setting changes behavior after a restart, because a silent fallback to a default is one of the most common failures. Confirm each mapping against the CKAN version you run, since the behavior can differ between releases.
Does moving CKAN configuration to environment variables affect upgrades?
The change does not alter CKAN's upgrade path, but it adds one more item to check at each upgrade. CKAN patch releases do not break backwards compatibility and exclude schema changes and new features, while minor releases can include backwards-incompatible changes. Those changes may rename or remove settings, so a variable mapping that worked on one minor version may need updates on the next. Keep the variable list under version control next to the configuration it replaces, and review it against the release notes before each upgrade. Test every upgrade in staging with the same variables used in production. Extension compatibility is a separate check that the variable list does not solve. Read the CKAN release policy before planning your next upgrade.
Where should secrets go when CKAN settings move to environment variables?
Put secrets in the secrets store your organization already controls, and inject them into the container at runtime. Keep them out of the image, the Compose file and version control. The main groups to plan for are:
- Database passwords, with separate DataStore write and read-only users so the read path has fewer privileges.
- Session and signing secrets, which should differ between environments.
- Mail, identity provider and extension credentials, including client secrets used for single sign-on.
Check that CKAN logs and admin pages do not print secret values. Rotate keys by updating the store and restarting the services that use them. Document who can read each secret and how changes are approved, because that record is what auditors and security reviewers usually ask to see.
How DeployOpen scopes and delivers CKAN configuration work
DeployOpen approaches configuring CKAN with environment variables as a fixed-scope piece of work inside your own infrastructure. We map each ckan.ini setting to an environment variable, keep secrets out of container images, and check that every environment reads the same configuration in the same way. The written scope defines which settings, secrets and environments are included before any change is made.
How we scope
- The written scope lists every
ckan.inisetting to move, and which ones stay in files. - We agree which secrets the portal needs, where they are stored and who may read them.
- Environments such as development, staging and production are named in scope so values can be compared.
How we build
- Settings are mapped to environment variables using the
ckanext-envvarsnaming convention, then checked against the generated configuration. - Secrets are injected at runtime from your chosen secret store and kept out of container images.
- Each container image is started in a test environment to confirm the portal reads every expected value.
How we hand over
- A configuration reference lists each variable, its default, whether it is secret and the file it replaced.
- Deliverables include the environment files or Compose definitions, a runbook for changing values, and the test results.
- Your team receives a walkthrough of how to add, rotate and review values in each environment.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers for portals that change often.
- Configuration changes after handover go through the same review, testing and documentation steps.
- Upgrade work checks which variable names and defaults change between CKAN releases.

