Running CKAN background job workers with Supervisor

Background workers run CKAN's harvesting, XLoader and email jobs, and jobs can sit queued when a worker stops. This page covers Supervisor layout, queue separation, job timeouts and worker sizing for a portal you run.

On this page

Why CKAN background workers need Supervisor in production

CKAN uses Redis as its queue backend for background jobs, and the install from source documentation lists Redis as a requirement. These workers must run as long-lived processes, and Supervisor can keep them alive across reboots and crashes. On a production portal, three kinds of work depend on this. Harvest jobs pull dataset metadata from remote catalogs and create or update local records. XLoader jobs fetch uploaded or linked files and load their rows into the DataStore so the Data API can query them. Email jobs send account and notification messages to users. If a worker stops, these jobs wait in the queue without an obvious error, so a stalled harvest or a missing password reset email may only surface when someone reports it.

The exact worker command, queue names and configuration keys depend on your CKAN version and on the extensions you run. Extensions such as harvesters and XLoader can register their own queues, and a command copied from an older example can start a worker that never consumes the jobs you care about. Before you write a Supervisor program definition, confirm the worker command, queue names and Redis connection settings against the documentation for your exact CKAN version and each extension's README. Keep the Supervisor configuration in the same version control as your deployment, so a CKAN upgrade comes with a reviewed change to the worker definitions. Ask whoever builds the setup to show which queues each worker consumes, and confirm that every queue carrying harvests, XLoader loads and emails has at least one consumer.

Supervisor also gives you the controls you need during upgrades and incidents. You can stop workers gracefully before a CKAN upgrade, restart only the harvest worker after a configuration change, and read each process's log without searching through web server output. Decide early which host or container runs the workers, whether they share the web application's environment file, and who is alerted when a process enters a fatal state, which Supervisor reports through supervisorctl. Plan a check that shows the queues are draining, using queue depth in Redis and recent worker logs, and test what happens when Redis restarts while a long XLoader job is running. Those checks show that the portal is actually completing its background work, which a running Supervisor process alone cannot confirm.

Every CKAN background job passes through Redis before a worker runs it

Jobs start in two places: the CKAN web app, when a user or API call triggers work such as a harvest or an XLoader upload, and scheduled tasks. Both push jobs into Redis, which holds separate RQ queues for default, harvest, XLoader and email work. The RQ worker processes on the worker host pull from those queues, and Supervisor starts them and restarts them when they stop. Workers then write to PostgreSQL, the DataStore database and Solr, send mail through the mail server, and fetch from harvest sources. Check that every queue has a worker listening on it, and confirm the network rules on the Redis zone and the outbound connections.

Jobs flow from enqueue through Redis to Supervisor-managed workers and their outputs.

Worker layout options and when each fits

This table compares four ways to arrange CKAN background job workers and the trade-offs of each. Read each row for the isolation it buys, the upkeep it adds and the portal size it suits. The main takeaway: separating queues or hosts stops a slow harvest from holding up email and XLoader jobs, but every split adds configuration you must monitor and restart.

LayoutIsolation gainedOperational overheadBest fit
One worker group listening to all queuesNone between extensions. A slow harvest can hold up email and XLoader jobs queued behind it.Lowest. One program to configure, monitor and restart, and one worker setting to tune.Small single-host portal with few extensions and light background load.
One Supervisor program per queueA slow harvest only occupies its own workers, so email jobs keep moving. Each queue can be restarted alone.One program block per queue, with separate logs, restart checks and worker settings to maintain.Multi-extension portal where harvesting, XLoader and email have different run times.
Dedicated worker host for heavy jobsHeavy jobs run off the web host, so harvests and large XLoader loads do not compete with page traffic.A second host to patch, monitor and back up, with the same code, config and access to Redis, PostgreSQL and file storage.Portal whose harvests or large file loads regularly slow page responses on the shared host.
Container restart policy instead of SupervisorEach worker group can run in its own container, so a crash affects only that container.Needs a container platform and images, and log, health and restart checks move to that platform.Portal already run with containers, such as ckan-docker or Kubernetes, rather than a package install.

Which CKAN job queues to separate

CKAN runs several kinds of background jobs on the same workers, and they do not all take the same time or fail the same way. The four job types below are the ones to plan for first, and each can hold a worker long enough to delay the rest when it is slow or broken. Deciding which jobs share a queue is a planning step to finish before you size the worker pool.

Harvesting jobs

Harvest jobs fetch datasets from remote catalogs, so their speed depends on servers you do not control. A source that times out or returns a very large catalog can hold a worker for a long stretch. One slow source can block every job behind it on a shared queue. Watch for sources that time out, scheduled runs that overlap, and catalogs that grow between runs. Confirm the job timeout and retry settings for your CKAN version before you choose worker counts.

XLoader loads

XLoader, the officially supported loader for the DataStore, parses uploaded or linked files and writes their rows to PostgreSQL. A large CSV or spreadsheet can keep one worker busy for a long time while the load runs. A few large files can keep the loader busy long enough to delay every other job. Watch for files near your size limits, malformed encodings that fail partway through, and bulk uploads that arrive all at once. Confirm the load time limit and the behavior after a failed load for your CKAN version, and check queue depth after large batches.

DataStore docs

Email notifications

Notification jobs send account and activity emails through your mail server. Each send is short until the server stops answering, and then every attempt waits for a connection to fail. A mail server outage can turn quick sends into repeated connection waits that tie up workers. Watch for SMTP outages, bulk membership changes that flood the queue with messages, and failed addresses that may be retried, depending on your version. Confirm how your version queues mail and retries failed sends, and test the mail path from the worker host before go-live.

Extension-specific queues

Extensions can add their own background jobs, such as the identity mapping in ckanext-saml2auth, and each job type has its own duration and failure profile. An extension that calls an external service can behave like a harvest job and starve the queue it shares. Watch for jobs added after an upgrade, extensions that do not document their queue names, and jobs that call identity or metadata services. Check each extension's documentation for the queue its jobs use, and retest that queue after every extension upgrade.

saml2auth repository

Setting up CKAN background workers under Supervisor

This sequence takes a worker host from a CKAN virtualenv to Supervisor-managed background workers that read their Redis queues and restart after a failure. Each step closes with a check you can run, so a problem shows up at the step that caused it. Confirm the exact worker command in the CKAN documentation for your version before you start.

  1. Confirm the virtualenv and service user

    Identify the CKAN virtualenv and the Linux account that will run the workers. Most teams use a dedicated service user that also owns the CKAN configuration file, so the workers can read the same settings as the web application. Run which ckan from the virtualenv's bin directory and id <service-user> on the worker host. You are done when the ckan command resolves to that virtualenv, the account exists, and it can read the ckan.ini file the workers will use.

  2. Confirm Redis is reachable from the worker host

    Run the check as the service user from the worker host, pointing at the same Redis host and port that the CKAN configuration uses for its job queue. A reply of PONG from redis-cli -h <redis-host> -p <port> ping means the network path, firewall rules and any Redis authentication work for that account. If the check fails, fix the network or Redis access before you create any Supervisor program, because workers that cannot reach Redis will write connection errors to their logs. Confirm the exact Redis setting name in the documentation for your CKAN version.

  3. Create one Supervisor program per worker group

    Create one file in the Supervisor configuration directory for each worker group, such as one for the default queue and one for a queue that an extension uses. Each [program:...] block sets the worker command from the CKAN documentation for your version, the directory, the user, and an environment value that includes the virtualenv's bin directory. Give each program its own stdout_logfile and stderr_logfile that the service user can write to, and set autostart and autorestart to true. You are done when each file reads back correctly and the worker command matches the documentation for your version.

  4. Reload Supervisor and start the programs

    Run sudo supervisorctl reread to load the new files, then sudo supervisorctl update to add the programs and start them. Each new program should appear in the output of both commands. Next, run sudo supervisorctl status. You are done when every worker group shows RUNNING with a process ID and an uptime. A FATAL or BACKOFF state usually means the command, user, directory or log path is wrong, and the log files configured in the previous step will show the reason.

  5. Check status, logs and a test job

    Read the stdout log for each program with tail -n 100 and look for startup lines showing that the worker connected to Redis and is listening on its queues. Then enqueue a test job from the CKAN side. Use a job your installation already triggers, such as processing an uploaded resource with XLoader, or a test job enqueued from a CKAN shell if your setup supports it. You are done when the job leaves the queue, completes, and appears in the log without a traceback.

  6. Test that Supervisor restarts a killed worker

    Record the process ID of one worker from sudo supervisorctl status, then stop that process with kill -9 <pid> to simulate a crash. Run sudo supervisorctl status again after Supervisor has had time to respond. You are done when the same program shows RUNNING with a new process ID, the log records the exit and the restart, and a fresh test job completes. If the program stays stopped, confirm that autorestart is true in its configuration file, then run the reread and update commands again.

How many CKAN background workers a portal needs

A small portal with a few harvest sources and occasional uploads has a short, uneven job stream. Most of the time the queues are empty, and load arrives in bursts when a harvest runs or a user uploads a file. The default queue is usually the first to watch, because one long job can hold a worker and delay quick tasks waiting behind it. A small pool is a reasonable starting point, as long as no user-facing task waits long enough to be noticed.

  • Queue length between runs: An empty queue between harvest runs is normal. Growth that does not drain before the next run is the first signal to act on.
  • Late harvests: A scheduled harvest that starts or finishes later than expected usually points to a worker shortage or a stuck job, so compare enqueue time with start time in your logs.
  • Delayed notifications: Emails such as password resets that arrive late can share a queue with slow jobs. If your extensions let you move mail onto its own queue, that isolates the risk.
  • Job timeouts: A job that exceeds its timeout is stopped, so check failure logs before adding workers. More workers will not fix a job that never finishes.

Before you change any count, record queue length and start lag over a normal week, then confirm the new setting clears the queue after a scheduled run.

How CKAN jobs stall without an error on the page

The most common silent stall is a worker that has exited and was never restarted. The web interface keeps accepting dataset actions and enqueues jobs into Redis, so pages look normal while nothing consumes the queue. Supervisor reports the program as EXITED or FATAL in supervisorctl status, so check that state first. A second quiet failure is a worker started with an environment that differs from the web app: a different virtualenv, a different configuration file path, or a different set of environment variables passed through Supervisor's environment key. The worker may then load a different list of plugins, so jobs for an extension it does not load can fail only in its own log. Compare the worker's environment with the web app's before you trust either one.

Redis fails in two ways that leave the web interface untouched. If Redis reaches its memory limit, the maxmemory-policy setting decides whether it rejects writes or evicts keys, and evicted keys can remove queued job data. If Redis restarts with persistence disabled, every job held only in memory is gone, and nothing on the page says so. Check INFO memory and the maxmemory-policy value, then confirm with your platform team whether append-only or snapshot persistence is configured. Network changes cause the third failure. After a subnet move, DNS change or firewall update, workers can lose their connection to PostgreSQL or Solr while the web app, which may sit on a different network path, keeps working. Worker logs show connection errors on every job, but the browser shows nothing.

Detect these failures with checks that do not depend on the web interface. Run supervisorctl status to catch exited or fatal programs, and read each worker's stdout and stderr logs for database, Solr or Redis errors. Measure the length of each RQ queue in Redis and record the age of its oldest job. A queue that grows while its oldest job gets older means no worker is consuming it. Log retention belongs to the same check. Set stdout_logfile_maxbytes and stdout_logfile_backups in every Supervisor program block, or rotate the log directory with logrotate, so evidence from an incident is still on disk when you investigate. Ask your team to confirm these settings in a test environment, because a worker stuck in a restart loop can write enough output to push older history out of the rotation window.

Security and operational risks of worker hosts

Worker hosts hold database credentials, a message queue and portal data, so they need the same scrutiny as the web tier. Each card names one risk and the control you can inspect to confirm it is handled. Check them before the first production worker starts and again after every configuration change.

Redis bind address and authentication

CKAN queues RQ jobs in Redis, so anyone who can reach the Redis port can read pending payloads, add jobs or empty the queue. Check that the bind directive in redis.conf lists only the loopback address or the private interface your web and worker hosts use, that protected-mode is enabled, and that requirepass or ACL users are set. Confirm the result from a host outside the allowed network, where the connection should fail. Place Redis on a network segment that only the CKAN hosts can route to.

Worker service account permissions

Run workers under a dedicated system account that owns no CKAN source code and has no login shell. That account needs read access to the CKAN configuration file and write access only to the storage and log paths its jobs use. Confirm the process owner with ps -o user,pid,args on each worker host, then check that the configuration file is readable by that account and writable only by an administrator. Review group memberships during each access review, because membership in a group that reads secrets widens every worker's exposure.

Secrets in Supervisor environment settings

Supervisor's environment setting in a program block passes values into the worker process, and the same user can read them through /proc. Secrets placed on the command line are more exposed, because every local user can list them with ps. Check that program blocks hold no literal passwords or tokens, that secrets load from a file readable only by the service account (for example through a wrapper script that exports them before starting the worker), and that ps -ef output on the host shows no credentials.

Separate DataStore write and read users

XLoader must write into DataStore tables, while the Data API and any public query path only need to read them. Give the workers the write connection and keep the read-only user for the web tier, so a compromised query path cannot change stored resources. Check that ckan.datastore.write_url and ckan.datastore.read_url point to different database roles, that the read role has SELECT rights only, and that neither role is a superuser. Confirm the exact grants against the DataStore documentation for your CKAN version.

DataStore docs

Log retention and sensitive job payloads

Email jobs carry recipient addresses and message content, and harvest jobs can carry credentials for remote catalogs, so job payloads can persist in Redis, Supervisor log files and error traces. Check how long Supervisor's stdout and stderr logs are kept and whether logrotate covers them. Confirm that debug logging does not print job arguments in production, and that harvest source settings hold references to a secret store. Set a schedule for clearing failed jobs from Redis, because they keep their payloads until someone removes them.

Change control for Supervisor configuration

Queue names, timeouts and environment values for each worker live in files under the Supervisor configuration directory, and a small edit can silently stop a queue or change which secrets a process sees. Keep those files in version control, review changes through the same process as application code, and apply them with supervisorctl reread followed by supervisorctl update. Compare the deployed files with the last approved commit on a regular schedule, and keep a record of who ran each reload.

What running CKAN workers with Supervisor costs and needs

What drives the cost of setting up CKAN workers under Supervisor?

The cost is set by the written scope, and DeployOpen does not publish a price list. Most of the effort sits in four places: reviewing your queues and hosts, writing and testing the Supervisor program definitions, checking the CKAN and Redis configuration on each host, and handing over runbooks. Costs grow with the number of hosts, the number of queues per extension, how many CKAN environments need the same setup, and whether your current workers already have failure history that must be investigated. Setup work is one-time. Log review, upgrades and queue monitoring recur if you buy a retainer or run them internally. Ask any quote to list each host, each queue, each environment, the test passes included and what the handover contains.

How long does setting up and testing CKAN workers take?

Duration depends on the queue and host inventory, so a schedule is only set once a written scope exists. The main drivers are the number of hosts and queues, whether each extension's jobs need their own queue and timeout settings, how many environments must match production, and how quickly your team approves access and change windows. Testing often takes longer than configuration because each queue needs a test job, a failure case and a restart check. A test window in which jobs can be drained and replayed shortens the calendar. Ask for a schedule that lists each stage and the client dependency it waits on.

What does our team need to provide for CKAN worker setup?

Your team provides the access and information that the work cannot create on its own. The list usually includes:

  • Shell access to each worker host, with sudo or an equivalent change path, and the Supervisor and Python environment details
  • Redis connection details and a network path from each worker host, plus the CKAN database and Solr endpoints the workers use
  • The CKAN configuration for each environment, either ckan.ini or environment variables, with secrets handled through your own process
  • A test window in which jobs can be queued, failed on purpose and drained without affecting users
  • Named contacts who approve changes, and access to worker logs

Confirm the CKAN version and that Python 3.10 or newer, PostgreSQL 12 or newer, Solr 9 (recommended) or Solr 8 and Redis are in place, as the CKAN install from source guide lists them.

Can an internal team set up CKAN workers without an outside partner?

Yes, an internal team can do it alone if it already owns Linux service management, Supervisor and CKAN operations, and it has a staging copy of the portal to test against. The work is mostly configuration, verification and documentation. The gaps that usually slow internal teams are limited familiarity with how RQ workers take jobs from named queues, no safe place to test failing jobs, and little time to watch logs after the change. A partner is worth comparing when those gaps or a deadline apply. Ask your team who will own the workers after handover and whether they can read logs and queue state without outside help. Either way, the written scope should name who does each step.

How do we scope a CKAN worker quote from our queues and hosts?

Start with a written list that a reviewer can check line by line, then the quote follows from that scope. The list should contain:

  • Each environment, such as development, staging and production, and which ones the work covers
  • Each worker host, its role, operating system, Python environment path and current Supervisor version
  • Each queue, the extension or job type that uses it (for example, harvesting, XLoader or email jobs), and the expected job timeout
  • The Redis instance and the CKAN configuration location for each environment
  • Current worker counts, recent failure logs and any known problems
  • The test window and the people who approve changes

Fixed-scope work is agreed in writing before it starts, so deliverables, the test passes and handover documents should be named in the same list. Ask for each item to be marked included or excluded.

What ongoing work follows a CKAN worker setup with Supervisor?

Ongoing work keeps the workers healthy as CKAN, Supervisor and the extensions change. The recurring tasks are:

  • Reviewing worker logs for failed, stalled or timed-out jobs, and deciding which ones need a fix
  • Watching queue depth and worker counts so backlogs show up before users notice them
  • Applying Supervisor updates and retesting the program definitions after each change
  • Planning CKAN upgrades, where patch releases and minor releases carry different compatibility risk, as described in the CKAN release policy
  • Retesting extension queue settings whenever an extension is added or updated

These tasks can stay in-house, run under a retainer, or be split between both. A retainer covers ongoing support, upgrades and continuous testing, and the written scope should name who receives alerts and who acts on them.

Limits to confirm before you commit to a worker layout

A worker layout depends on four moving parts, and each one sets its own limits. Confirm every item against the version you run, because a setting that works on one CKAN line may not carry over to the next. Use the cards below as a checklist before you write any configuration.

Worker command, queues and timeouts

The worker command, queue names and job timeout settings are the parts most likely to differ between releases. CKAN 2.12.0 was released on August 26, 2026, and maintenance releases 2.11.6 and 2.10.11 shipped the same day, so the 2.11 and 2.10 lines can carry different defaults. Read the configuration and release notes for the exact version you run, then list every queue name your portal consumes. A worker that listens on the wrong queue still shows as running in Supervisor, so jobs can wait without any error.

CKAN release policy

Supervisor version and syntax

Supervisor runs each worker as a program with its own command, user, working directory, environment and log files. Its configuration syntax and option names depend on the Supervisor version your operating system packages, so a file written for a newer release can fail to load on an older host. Confirm the version on each target host, check the program section against the Supervisor project documentation for that version, and validate it on a staging server before production. Also confirm how long Supervisor waits before it stops a job in progress, because that setting decides whether a deploy interrupts a running import.

Redis version, memory and persistence

CKAN's install from source documentation lists Redis among the components a portal needs, and the background job queues depend on it, so its version and sizing affect every worker. Confirm the Redis version against the CKAN release you run and the operating system package you install. Set a memory limit and an eviction policy on purpose, because an eviction policy that removes keys under memory pressure can delete queued jobs. Decide persistence too: whether queued jobs must survive a Redis restart, and how you back up or accept loss. Redis's own documentation covers each setting for your version.

CKAN install docs

Extensions and their queues

Harvesting, XLoader and email are the extensions this page covers, and each may register a queue of its own. List every extension in your configuration and deployment image, then read each extension's documentation to see whether it adds a queue, a timeout or a dedicated worker. XLoader is the officially supported tool for loading files into the DataStore, and DataPusher is legacy, so confirm the queue XLoader uses in your version. A queue that no worker consumes leaves its jobs waiting, so map every queue to the process that reads it before you draw the layout.

DataStore docs

How DeployOpen scopes and supports CKAN worker setups

DeployOpen treats CKAN background workers as a core part of the portal. We plan the worker processes for harvesting, XLoader and email jobs in your infrastructure, then build the Supervisor configuration, queue layout and job timeouts together and document them for your operators. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we scope

  • The written scope lists each worker queue, the extensions that feed it, and the hosts that run it.
  • We confirm which jobs run on the portal today, including harvesting, XLoader and email, before estimating build work.
  • Scope also records the process manager, log locations and restart behavior your operators expect.

How we build

  • We write Supervisor program definitions, one per queue, and set worker counts on the planned hosts.
  • Separate queues per extension keep a slow harvest from delaying email jobs, and job timeouts are set per queue.
  • Each worker start, restart and failure path is tested on a staging copy before production changes.

How we hand over

  • You receive the configuration files, a queue map and runbook steps for restarting, draining and reading worker logs.
  • Documentation explains how to judge worker counts as harvest and XLoader volume changes.
  • Your operators get a walkthrough of the setup, so the portal stays supportable after the engagement ends.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers.
  • Worker configuration is reviewed when CKAN upgrades or extensions change their job queues.
  • Retainers can cover queue reviews as harvest, XLoader and email volume grows over time.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.