Running CKAN on managed PostgreSQL: what it covers and when to use it
Yes, a team can move CKAN's databases onto a cloud provider's managed PostgreSQL, as long as the service runs PostgreSQL 12 or newer, the minimum CKAN's source install documentation requires. Choose a version that is still in its support window, though: under the PostgreSQL versioning policy, version 14 is supported only until November 12, 2026, and version 15 until November 11, 2027, so a service that offers only 14 needs an upgrade plan now. CKAN needs two databases: the main metadata database and a separate DataStore database that holds structured resource data and is reached through a write user and a read-only user. Create both on the managed instance before the first install, and set up the roles in the same change so neither database is ever run under an administrator account.
A managed service takes host operating system patching, underlying storage and some backup mechanics off your team, but the database design stays with you. You still own the schema, so confirm that the role CKAN uses can create and alter its tables without superuser rights, and decide which role runs migrations during upgrades. Roles are yours too: keep the metadata role, the DataStore write role and the DataStore read-only role in your own access model, and keep the provider's administrative account out of application configuration. Restore testing is also yours. A backup the provider reports as successful has not shown that CKAN can be rebuilt, so run point-in-time recovery into a separate instance and confirm that the portal loads and that DataStore queries return rows. Network access is the last control: limit inbound connections to the CKAN web and worker hosts and to named administrator addresses.
Version lifecycle is the item teams most often defer. PostgreSQL ships minor releases at least once every three months, and applying one only replaces executables and needs a restart, so put them on a fixed schedule. Major upgrades are a separate project: the PostgreSQL upgrading documentation covers dump and restore, pg_upgrade and logical replication, and logical replication can keep downtime to several seconds. Ask the provider which major versions and upgrade paths it supports, how much notice it gives before forcing a change, and what happens to instances that run past end of support. A managed service suits a team that lacks database operations capacity and can work within the settings the provider exposes. It is a poor fit if CKAN needs extensions, parameters or replication topology the provider does not expose. Confirm each point in writing before you commit.
Only the Data API uses the read-only user, and every other connection writes
The diagram starts with the CKAN web app and background workers inside the client's cloud network, which is the trust boundary for this setup. Both write to the CKAN database on the managed PostgreSQL instance through the write user. XLoader, a background worker, loads uploaded or linked files into the DataStore database with the write user. The Data API reads the DataStore database through the read-only user, so public queries cannot change rows. An optional connection pooler can sit between the web app and the instance. When you review the setup, confirm that each role holds only the grants it needs and that nothing outside the network reaches the instance directly.
Connections inside the client's cloud network, labeled by database role.
Which PostgreSQL version, databases and connection choices fit your portal
This table compares the four decisions a team makes before creating a managed PostgreSQL instance for CKAN: major version, database layout, connection handling and network exposure. Read each row for when the option fits, what it adds to daily operations and what to confirm with the provider. The main takeaway is that PostgreSQL 15 or newer is the practical starting point, because 14 reached its published end of support date on November 12, 2026.
| Decision | Choose it when | Operations cost | Confirm with the provider |
|---|---|---|---|
| PostgreSQL 12 or 13 | Only when a planned migration must match an existing environment and a major upgrade is already scheduled. | Both versions are unsupported, so security and bug fixes stop and the upgrade becomes urgent. | Whether the provider still offers these versions and the last date it will run them. |
| PostgreSQL 14 | Only for an existing instance that you are upgrading away from now. | Its published end of support date, November 12, 2026, has passed, so an upgrade is needed soon. | Whether the provider still offers version 14 and its date for retiring it. |
| PostgreSQL 15 or newer | New deployments and upgrade targets. Version 15 is supported until November 11, 2027, and versions 16 to 18 are supported later. | Plan the next major upgrade before the current version's end of support, using pg_upgrade or logical replication. | CKAN compatibility with the chosen major version for your release, and the provider's upgrade method and window. |
| One managed instance | A small or early portal where one team owns CKAN and DataStore and the query load is modest. | One backup schedule and maintenance window, but a restore or heavy DataStore query affects both databases. | Whether point-in-time recovery can restore one database without affecting the other. |
| Separate instances | DataStore holds large tables, public query traffic is heavy, or the two databases need different owners or recovery targets. | Two sets of sizing, patching, backups and monitoring, and two bills to forecast. | Per-instance pricing, storage and connection limits, and whether each instance has its own maintenance window. |
| Direct connection | A small portal with few concurrent web and worker processes. | Every uWSGI process and worker opens connections, so the instance's connection limit becomes your ceiling. | Maximum connections for your instance size and how the limit changes when you scale. |
| Connection pooler such as PgBouncer | Process counts or worker concurrency push connections toward the instance's limit. | One more service to deploy, monitor and patch. Pooling modes can change session behavior, so test DataStore access. | Whether a built-in pooler exists, which pooling modes it offers and how it handles session settings. |
| Private network access | CKAN runs in the same network as the database, or policy forbids public database endpoints. | Routing, DNS and a secured admin path such as a VPN or bastion must be built and maintained. | Private endpoint setup, enforced TLS and whether the instance can be reached only from the CKAN network. |
| Public endpoint | Rarely a fit for production. Limited to a time-boxed admin or migration task with strict allowlists. | A larger attack surface that depends on allowlists, TLS, strong credentials and connection logging. | Whether the endpoint can be turned off after use, which allowlist options exist and what connection logs are available. |
How to set up the CKAN and DataStore databases on managed PostgreSQL
This sequence takes a new managed PostgreSQL instance to a CKAN portal with two separate databases, a DataStore write user and a read-only user, and privileges no broader than CKAN needs. Each step ends with a check you can run yourself, so you know the database is ready before CKAN and its DataStore depend on it.
Confirm PostgreSQL version and encoding
The platform team confirms that the managed instance runs a PostgreSQL version that CKAN supports, which the CKAN installation guide sets at PostgreSQL 12 or newer, and that the version is still inside PostgreSQL's support window. Connect with psql as the provider's administrative user and run
SHOW server_encoding;to read the cluster default. Note that the database you create in the next step sets its own encoding. Done when the version matches a supported release and the encoding reads UTF8.Create the CKAN owner role and database
Create a dedicated login role for CKAN that is not a superuser, then create the CKAN database, for example
ckan_default, with that role as owner, UTF8 encoding andtemplate0so the encoding is not inherited from a template. On most managed services the role is created through the provider's console or an administrative session. The owner should be the only account that changes this database's schema. Done when the database list shows the new owner and UTF8 encoding for the CKAN database.Create the DataStore database and users
Create a separate database for DataStore, such as
datastore_default, owned by the DataStore write user. Then create a read-only login role for the Data API, following the DataStore documentation for your CKAN version. Keep the two roles separate, and give neither of them superuser or database creation rights. Done when both roles can log in, the write user owns the DataStore database, and that database reports UTF8 encoding.Grant only the privileges each role needs
Apply DataStore permissions with the CKAN command that generates the grants for the read-only and write users, and review the generated SQL before running it as the database owner. The read-only user should only be able to read DataStore tables. Check the public schema privileges on your PostgreSQL version, since defaults differ between releases. Done when a test table created by the write user can be read by the read-only user, and an INSERT from the read-only user fails with a permission error.
Set CKAN's database connection settings
Set
sqlalchemy.urlto the CKAN owner role and CKAN database,ckan.datastore.write_urlto the DataStore write user, andckan.datastore.read_urlto the read-only user. Add TLS parameters if the provider requires encrypted connections. Keep passwords in your secrets store and out of version-controlled files. Done when the settings load without errors and the CKAN process starts without database connection errors in its log.Run CKAN's database initialization
Run
ckan db initfrom the CKAN environment, using the configuration file that holds the settings from the previous step. Run it against a fresh CKAN database only. For an existing portal, follow the upgrade guidance for your CKAN version instead. Done when the command finishes without errors and the CKAN database contains tables owned by the CKAN owner role.Confirm the Data API returns rows
Load a small test CSV through XLoader, the loader the CKAN DataStore documentation lists as officially supported, then call
datastore_searchfor that resource through the Data API. Include a non-ASCII value in the test file so you can confirm the UTF8 path works end to end. Use a test file that contains no personal data. Done when the API returns the expected row count and the values match the file.
Security controls for CKAN database roles and network access
These six controls work together: database roles limit what CKAN can do inside PostgreSQL, network rules limit who can reach it, and logging shows who changed either one. Each card names what the control protects and what the provider's console may still let administrators do, so you can confirm those points before go-live.
Separate owner, write and read-only roles
Give CKAN an owner role that holds schema objects, plus separate write and read-only logins for the DataStore. No application login should be a superuser, and you should test that the read-only login cannot write. The Data API depends on that read-only role for public queries. Ask the provider whether its console creates a superuser for each instance and whether your application receives it. Provider administrators can still reset passwords, change roles and read data, so this control limits application risk, not administrator reach.
CKAN DataStore docsPrivate network paths and allowed sources
Place the managed instance on private addressing and allow connections only from the hosts that run CKAN web, workers and Solr. Ask whether the provider offers a private endpoint, peering or a public endpoint that can be switched off, and whether allowed sources can be set by address range or only by group. Keep administrative access on a separate path from application traffic where the provider allows it. A public endpoint still exposes the login to the internet. Administrators can usually edit allowed sources or enable public access in the console, so alert on those changes.
TLS and the authentication method
Require TLS on every connection from CKAN, including web, worker and DataStore connections, and confirm the provider rejects unencrypted clients on the server side. PostgreSQL 18 deprecated MD5 password authentication in favor of SCRAM, so ask whether SCRAM is the default and whether MD5 can still be enabled. PostgreSQL also documents certificate and directory-based methods such as LDAP. Confirm with the provider which of these its managed service exposes before you design around them, and ask how server certificates are rotated.
PostgreSQL authentication docsSecrets handling for database credentials
Keep the passwords for the CKAN, DataStore write and DataStore read-only logins out of ckan.ini, container images and version control. Store one secret per login in the secret system your platform already runs, such as a Kubernetes secret or a vault, and inject it at runtime. Separate secrets let you rotate one login without changing the others. Confirm whether a password change disconnects open sessions, because web and worker processes hold connections. Console administrators can usually reset these passwords, so the change history matters as much as where the secret lives.
Audit logging and instance settings
Enable the connection and statement logging the provider supports, and send those logs to a store your security team reads. Check whether the logs record failed logins, role and grant changes, parameter changes and backup or restore actions. Limit who can change instance settings such as parameter groups, allowed sources and authentication options, and require a named identity for each change. Ask whether console actions are logged separately from database logs and how long each log is kept. Write the retention period into the scope before go-live.
Removing default and shared accounts
Managed services create an administrator account at provisioning, and shared logins often survive from testing. Remove or lock any login that CKAN does not use, and confirm that no shared login appears in CKAN's database URLs. Give each service its own role from the first control so log entries identify the caller. Check whether the provider's administrator role can be removed or must remain, and whether it has access to the CKAN and DataStore databases by default. Record the answer in your access review.
Backups and restore testing for CKAN and DataStore
A managed service's automated backups show that a copy exists. They do not show that your CKAN portal can be restored. Ask for a tested restore as the deliverable, and treat the backup setting as a prerequisite. Plan to restore the CKAN main database and the DataStore database together, because they hold different halves of the portal. The main database keeps datasets, organizations, users and resource metadata, while the DataStore database keeps the rows behind the Data API. The Solr search index and the FileStore sit outside both databases, so a restored pair can disagree with them. Decide in advance how the index will be rebuilt after a restore and how uploaded files will be recovered and checked.
PostgreSQL point-in-time recovery starts from a base backup and replays archived write-ahead log up to a chosen moment, as described in the PostgreSQL continuous archiving documentation. Your provider wraps that mechanism in its own controls, so confirm the exact behavior in writing. Ask whether point-in-time recovery is enabled for both the CKAN and DataStore databases, how far back recovery points are kept, whether the restore creates a new instance or overwrites the existing one, and how long a restore usually takes. Ask whether roles are restored along with the data, including the DataStore read-only role. Choose one target timestamp for both databases and record it, because a DataStore table restored to a different moment than the CKAN metadata that describes it will confuse users.
Write the restore test as a script with clear pass and fail checks, and run it on a separate instance. First, confirm that CKAN starts against the restored databases, that dataset pages load and that a sysadmin can log in. Second, confirm that the DataStore Data API returns rows: call datastore_search on a resource whose row count you recorded before the test, compare the count and a sample row, and confirm that the read-only DataStore user can read the same table. Third, confirm that the search index is rebuilt from the restored database or matched against it: a known dataset should be findable, and dataset counts should agree with the database. Record the results, the restore timestamp and the provider steps used, so the next test repeats the same path.
Choosing a path: new install, existing CKAN moving to managed PostgreSQL, or a major upgrade
A new install carries the least risk because no data has to move. Make the version and role decisions before anything is loaded, since changing the database layout or roles later means rebuilding structures that already hold data.
- Choose the CKAN minor line: Pick the current minor version or the one before it, since both receive security and bug fixes, and plan to apply each patch release as it ships. Older patch releases lose support once a newer patch is out, so the release policy belongs in the runbook. Confirm the current status in the CKAN release policy.
- Confirm the PostgreSQL version: CKAN needs PostgreSQL 12 or newer. Choose a version that the provider still offers and that the PostgreSQL versioning policy covers for the planned life of the portal.
- Create separate databases and roles: Plan one database for CKAN and one for the DataStore, each with its own owner. Plan a write user and a read-only user for the DataStore, and set UTF-8 encoding when the databases are created.
- Decide the DataStore loader: Plan on XLoader, the officially supported loader, and treat DataPusher as legacy. Confirm that the background worker setup runs XLoader jobs before the first load.
- Record the sign-off: Write down the database names, encodings, role names and who holds administrative access on the managed service, so the security and platform teams review the same list.
Before loading any data, check the CKAN version, PostgreSQL version, encodings and roles against the signed-off design.
Moving an existing portal changes where CKAN connects and which credentials it uses, but the CKAN code stays the same. The plan centers on the downtime window for the dump and restore, a check of the DataStore tables and a permissions review on the new service.
- Set the downtime window from a test run: A plain dump and restore requires the portal to stop writes from the start of the dump until the restored copy is verified. Time the dump and restore on a copy of production, and add room for checks.
- Dump both databases together: Export the CKAN database and the DataStore database from the same point in time, and keep checksums of the dump files. Use client tools that match the target PostgreSQL version.
- Verify the DataStore tables: Compare the list of DataStore tables and their row counts before and after the move. Then run Data API queries for a sample of resources, including full-text search and a SQL query, and confirm the results match the source.
- Re-check permissions after the move: Confirm that the write user and read-only user hold the grants described in the DataStore documentation, and that table owners match the new roles. Apply these grants without superuser access, using the roles the provider allows, and record each change.
- Keep the old database for rollback: Keep the source database in read-only mode until the new site passes its checks, so the team can point CKAN back if the cutover fails.
Before reopening the portal, check the downtime, the DataStore counts and the grants against the signed-off runbook.
A major upgrade changes the on-disk format, so it cannot be applied as a minor patch. The PostgreSQL upgrade documentation describes dump and restore, pg_upgrade and logical replication, and each one trades downtime against effort and rollback options.
- Dump and restore: The most straightforward method, using pg_dumpall and a restore into the new major version. Downtime grows with database size, so it suits portals whose window allows it.
- pg_upgrade: Upgrades an existing data directory to the new major version, with a shorter outage than a full dump. PostgreSQL 18 retains planner statistics across major upgrades and adds parallel jobs and a --swap option. It needs control of the server, so confirm whether the provider exposes it.
- Logical replication with short downtime: The PostgreSQL documentation states that logical replication works between major versions and can allow a cutover with only several seconds of downtime. The team must confirm how sequences and schema changes are handled and test the cutover on a copy.
- What the provider supports: Ask in writing which of these methods the provider supports, whether the upgrade happens in place or on a new instance, and how rollback works. Check the target version against the PostgreSQL versioning policy, since PostgreSQL 14 support ended on November 12, 2026.
- What the team must test: Restore a copy of production, run CKAN search, DataStore queries and a sign-in, and time the chosen method end to end. Repeat the test along the rollback path.
Before scheduling the upgrade, confirm the provider's supported method in writing and record the test results in the change record.
Limits and what to confirm in your environment
Managed PostgreSQL removes some work, but it also moves decisions into your provider's control. These six items decide whether the CKAN database setup works as planned, and each has a clear owner to ask: the provider's account or support team, its database administrators, or your own platform team.
Privileges without superuser access
CKAN needs its own database owner for the main database, and the DataStore needs a write user and a read-only user in a separate database. Ask the provider which role your account receives, whether it can create databases and roles, and whether it can grant the DataStore permissions without superuser access. Ask the platform team to test the permission step on a staging instance before production. If the provider's setup needs a superuser for that step, agree with their database administrators how it will run.
PostgreSQL versions and support dates
CKAN requires PostgreSQL 12 or newer, and PostgreSQL supports each major version for five years after its initial release. PostgreSQL 14 is already past its end of support, and later versions reach theirs on fixed dates, so check which major versions your provider offers before you choose one. Ask for the end-of-support date of the version you will run and the provider's schedule for moving to a newer major version. Plan that move early, because major upgrades need a dump and restore, pg_upgrade, or logical replication.
Versioning policyExtensions and authentication methods
Confirm that the provider installs every extension your CKAN and DataStore setup relies on, and ask for the full list available for your version. Then confirm that the authentication methods your security team requires are allowed on the instance. PostgreSQL 18 deprecated MD5 password authentication in favor of SCRAM, so ask whether SCRAM is the default and whether certificate-based or directory-based sign-in can be enabled. Ask whether the provider restricts any method you need, and get the answer in writing before you design the login flow.
Authentication methodsBackup retention and restore procedure
Ask how long the provider keeps backups and point-in-time recovery logs, and whether you can change that window. Ask who runs a restore, what the provider's steps are, and whether you can restore into a new instance for testing. CKAN's metadata and the DataStore live in separate databases, so ask whether a restore brings both back to the same point in time. Get the restore procedure in writing, then test a restore on a copy before you depend on it.
Continuous archiving docsFailover behavior
PostgreSQL does not detect a failed primary or promote a standby on its own, so automatic failover depends on tooling outside PostgreSQL. Ask whether the provider runs managed failover, how it detects a failed primary, and whether the standby replicates synchronously or asynchronously. Ask how much data could be lost in a switch, and whether the CKAN connection string follows the new primary automatically. Confirm the answers with a planned failover test in a staging environment before go-live.
Failover docsConnection limits for web and workers
Each CKAN web process and each background worker typically opens its own database connections, so the connection limit on the managed instance caps how many processes you can run. Ask the provider for the maximum connection count for the instance size you plan to buy, and whether that limit can be raised. Ask whether the provider offers a connection pooler such as PgBouncer. Count the uWSGI processes and workers you plan to run before you size the instance, and retest after any change to either.
PgBouncer siteQuestions teams ask before running CKAN on managed PostgreSQL
What drives the cost and effort of running CKAN on managed PostgreSQL?
Cost follows the scope agreed in writing, and the largest drivers are the number of environments, how much existing data must move, and how many extensions read from the database. Separate CKAN and DataStore databases, users and permissions add configuration work in every environment, and a DataStore holding large tabular resources adds load and validation testing. Existing managed PostgreSQL experience and a CKAN install that already works typically reduce the build work. Provider fees are paid to your cloud provider, not to the implementer. Ask the quote to separate one-time work (design, provisioning, permission setup, restore testing, cutover) from recurring work (patch windows, restore tests, support retainers), and to list the cost of each by environment.
How long does running CKAN on managed PostgreSQL take?
Duration depends on scope, the number of environments and how ready the target platform already is, so no single figure fits every portal. The main variables are whether the managed database is already provisioned with network access and settings in place, how large the DataStore is, and whether a major version upgrade or data migration is part of the work. Ask for the schedule as milestones in the written scope: provisioning, CKAN database and user setup, DataStore permission checks, backup restore test and cutover. Your provider may also have its own provisioning lead times, which sit outside the implementation work, so confirm them early.
What does the work need from our internal team?
The work needs an owner who can approve cloud account changes, network rules and database provisioning, plus someone who knows how CKAN is deployed today. Platform or database engineers should review database users, encryption settings, maintenance windows and the restore procedure, because those settings follow your own standards. Application owners should confirm which extensions read from the database and which DataStore resources must stay available during cutover. Security and compliance staff should review access logs and credential handling before go-live. Ask the quote to name the roles it assumes and the time it expects from each, so those assumptions are visible before work starts.
Can our team set up CKAN on managed PostgreSQL without a partner?
Yes, a capable team can do it without a partner, because CKAN and PostgreSQL are open source and their installation and release documentation is public. The deciding factors are whether your team has operated CKAN before, has administration experience with the managed service you chose, and can staff the testing needed before cutover. An in-house team still needs a tested backup restore, a DataStore permission check and a plan for the next CKAN patch release. A partner is most useful when those skills are thin or the deadline leaves no room to learn on production. Compare an internal estimate with a written fixed-scope quote, and include time for training and reviews.
Does managed PostgreSQL remove the need for database backups?
No. A managed service takes over part of the infrastructure, but it does not decide your recovery point or recovery time, and it does not cover everything CKAN stores. PostgreSQL's continuous archiving and point-in-time recovery describe what a recoverable backup needs. Confirm how your provider implements them, including the retention window, whether restores can target a specific time and who is allowed to run them. The FileStore for uploaded resources and the Solr search index sit outside the database, so each needs its own backup or rebuild plan. Restore copies of the CKAN and DataStore databases into a test environment on a schedule, and record how long each restore took and whether CKAN started against it.
Which PostgreSQL version should we pick for CKAN?
Choose the newest PostgreSQL major version your managed provider offers, which for a new build usually means version 17 or 18. CKAN's source install documentation requires PostgreSQL 12 or newer, but PostgreSQL's versioning policy lists version 14 as supported only until November 12, 2026, which has already passed, and versions 13 and earlier as unsupported. Version 15 is supported until November 11, 2027, version 16 until November 9, 2028, version 17 until November 8, 2029 and version 18 until November 14, 2030. Check your provider's retirement schedule too, because managed services can retire versions on their own dates. Plan the later major upgrade path before you choose.
Do we need a connection pooler in front of CKAN's PostgreSQL databases?
It depends on how many connections your CKAN processes open, so measure that before adding a pooler. CKAN runs web workers, background job workers and DataStore access, and each process can hold database connections, so the total grows with process counts across environments. A pooler such as PgBouncer can reduce the number of server-side connections, but it changes how sessions are reused. Confirm that CKAN and your extensions work with the pooling mode you choose, and that DataStore queries and session settings behave the same. Managed services sometimes include a built-in pooler, so check its mode and limits. Test under expected load, and review connection limits again whenever you add workers.
How do DataStore permissions differ from the main CKAN database?
The DataStore uses its own PostgreSQL database with a write user and a read-only user, separate from the main CKAN database that holds datasets, users and configuration. The main database user handles CKAN's application work, the DataStore write user loads tables from resources, and the read-only user serves the Data API's queries. On managed PostgreSQL you usually do not have superuser access, so the database owner must create these roles and grant only the privileges the DataStore needs, following the permission steps in CKAN's DataStore documentation. Check that the read-only user cannot write and that the write user cannot change the main database. Ask the implementer to show each grant and to test both users after provisioning and after every restore.
How DeployOpen scopes, delivers and supports CKAN database work
DeployOpen plans and builds the CKAN and DataStore databases on the managed PostgreSQL service in your cloud account, then hands over the configuration, runbooks and backup and restore checks your team needs to run them. Each engagement starts with a written scope that names the databases, roles, extensions and recovery requirements involved.
How we scope
- The written scope lists each database, its owner role and the DataStore read-only role before work starts.
- Confirm the managed service offers PostgreSQL 12 or newer, then choose a major version the PostgreSQL project still supports.
- A quote follows from the written scope, and ongoing support, upgrades and continuous testing are available as retainers.
How we build
- Create separate CKAN and DataStore databases with UTF-8 encoding and dedicated owner roles on the managed instance.
- Grant the DataStore write and read-only roles only the privileges needed, so CKAN never needs superuser access.
- Connect CKAN, XLoader and background workers, then test DataStore loads and restores from backup.
How we hand over
- Documentation covers connection settings, the role model, DataStore URLs and the PostgreSQL version in use.
- Runbooks explain backup schedules, restore steps, major upgrade steps and how to rotate database credentials.
- Handover includes a restore check you run yourself, so your team proves recovery before relying on it.
How we support
- Retainers can cover upgrades, PostgreSQL minor updates and planned major version moves, as agreed in scope.
- Continuous testing can recheck database permissions and access paths after CKAN or extension changes.
- Configuration records and backup evidence can be prepared for compliance reviews, while independent auditors issue any attestation.

