Choosing a Decidim background job backend for email and exports
Decidim background jobs run through ActiveJob, Rails' common interface for asynchronous work, so the backend you configure decides what extra infrastructure you operate and how you watch queues. Registration confirmations, notification emails, newsletters and data exports all leave the web request and wait in a queue. The backend choice determines whether that queue lives only in PostgreSQL or in a separate Redis service. Decidim's installation guide lists background jobs as part of a production setup, so this decision belongs in the launch plan rather than after the first complaint from a participant.
delayed_job stores jobs in a PostgreSQL table that Decidim already needs, so it adds no new service. It fits a single organization or a small installation with modest email volume, a team that wants fewer moving parts, and a database with capacity to absorb polling workers. Sidekiq keeps jobs in Redis and usually runs more throughput with separate worker processes, which suits large installations, many organizations on one install, or heavy export and notification traffic. The cost of Sidekiq is a second stateful service to back up, secure, patch and make highly available. Redis licensing has also changed across recent versions, so confirm which Redis edition and license your organization accepts at the Redis licenses page before you commit.
Whichever backend you pick, plan monitoring from day one. A stalled worker or a misconfigured queue fails quietly: the web app keeps accepting registrations while confirmation emails never leave. Ask your implementation partner or internal team to define an alert on queue depth and on jobs that fail or retry repeatedly, and to test a registration and an export in staging after every deployment. Confirm with your Decidim version's documentation which worker command and configuration keys apply to your release, because the setup differs between delayed_job and Sidekiq.
Sidekiq vs delayed_job: which backend fits which install
delayed_job stores each queued job as a row in PostgreSQL, the database your Decidim install already requires. No second service joins the stack. Worker processes poll the jobs table, lock the rows they handle and record the outcome.
- Extra services: None beyond PostgreSQL, which already holds participant data, proposals and votes.
- Where jobs live: In a jobs table in PostgreSQL, so queued work is included in the same database backups as the records it refers to.
- How workers run: As one or more long-running worker processes on the application host or in a dedicated job container, each polling the table.
- What to monitor: The number of waiting rows, failed attempts, the age of the oldest pending job and the last time a worker picked up work. Polling also adds database queries, so watch database load.
- Best fit: Single-node or small installs with moderate email and export volume, where operators want the fewest moving parts.
Before go-live, confirm that the worker process runs under your process manager and that failed jobs raise an alert instead of sitting unnoticed in the table.
Sidekiq keeps queued jobs in Redis, a separate in-memory data store, and runs threads that consume them. Redis becomes a service you must deploy, secure, monitor and back up next to PostgreSQL, and the job queue no longer shares a transaction with the database records it touches.
- Extra services: A Redis server, network access from the web and worker processes, and authentication and TLS wherever your network policy requires them.
- Where jobs live: In Redis queues. If Redis loses data or restarts without persistence, queued jobs can disappear, so persistence and replica settings belong in the design.
- How workers run: As a separate
sidekiqprocess per worker host or container, consuming named queues, with concurrency set per process. - What to monitor: Queue size and latency, the retry and dead job sets, worker process liveness, Redis memory use, connection counts and any failover events.
- Best fit: Installs with high notification or export volume, several worker hosts, or an existing Redis service that the team already operates, secures and backs up.
Before relying on Sidekiq for participant notifications, confirm how your Redis persistence and high availability settings handle queued jobs during a restart or failover.
Redis licensing changed across releases, so the license that applies depends on the exact Redis version you install. Check it before you standardize on Redis for job queues, and again when you upgrade Redis.
- Redis 8.0 and later: Redis Open Source can be used under a license of your choice among the Redis Source Available License v2, the Server Side Public License v1 and the GNU AGPLv3. This applies from the general availability release of Redis 8, which was published on May 2, 2025, according to the Redis licenses page.
- Redis 7.4.x to 7.8.x: These releases remain under the dual RSALv2 or SSPLv1 license, and neither license is OSI-approved.
- Redis 7.2.x and earlier: These releases remain under the BSD-3-Clause license.
- Modified code offered as a network service: The licenses FAQ says teams that offer modified Redis code as a network service must make the modified source available to that service's users. Teams running unmodified artifacts from 7.2 or earlier see no impact. Confirm with your legal team which terms apply to your install.
- Feature-level terms: Some Redis components carry their own terms. Check the license attached to any module or optimization you enable, even if the base server is AGPLv3.
Record the exact Redis version and its license in your software inventory, and include the check in your upgrade procedure.
The choice depends less on feature lists than on the operating capacity your organization already has. Answer these questions before you select a backend, and write the answers into the design record.
- Existing Redis: If a supported, secured and backed up Redis already serves other workloads, Sidekiq adds the least new operational work.
- Volume and worker count: Many worker hosts or large bursts of exports and notifications favor a dedicated queue service. Measure your own queue depth and timing in a staging environment before deciding.
- Recovery expectations: Decide whether queued jobs must survive a PostgreSQL restore, and how you would rebuild them after a Redis loss. The two stores fail and restore differently.
- Data in job arguments: Identify which store holds personal data such as email addresses, then bring that store into your backup, retention and access review scope.
- Version support: Confirm which ActiveJob backends your Decidim version and each installed module document and test, and which gem versions your install pins.
Assign an owner to the backend decision so that a later upgrade does not change it by accident.
Configuration options and when each fits
This table compares delayed_job on PostgreSQL, Sidekiq on Redis, and a hybrid where one backend is chosen per environment, across infrastructure, visibility, failover and fit. Read each row against your install size: a single organization and a multi-organization or high-volume platform put different weight on the same trade-offs. Confirm backend support and gem versions against the Decidim release you run before deciding.
| Option | delayed_job on PostgreSQL | Sidekiq on Redis |
|---|---|---|
| Extra infrastructure | None beyond the PostgreSQL database Decidim already requires | A Redis service to deploy, secure, back up and monitor, plus its own TLS and access settings |
| Job storage and visibility | Jobs stored as rows in the database, so they can be inspected with SQL and included in database backups | Jobs held in Redis memory and persistence settings; inspection happens through the Sidekiq web interface |
| Worker process model | Worker processes poll the database for due jobs; adding workers adds database load | Multi-threaded worker processes consume queues from Redis; concurrency is set per process |
| Failover approach | Relies on PostgreSQL failover; jobs survive a restart because they are already in the database | Relies on Redis persistence and, where used, Redis Sentinel; confirm how in-flight jobs behave after a Redis failover |
| Monitoring hooks | Query the job table for failed and locked jobs; alert on the failure count and on the age of the oldest pending job | Sidekiq web and its metrics; alert on queue latency, retry set size and dead set size |
| Fits a small single-organization install | Usually a good match when email volume is modest and the team wants fewer moving parts | Workable, but adds a service to run for a load the database could often carry |
| Fits a multi-organization or high-volume install | Watch database contention between job polling and application traffic; measure before scaling workers | Usually better suited when many organizations share queues and the team can operate Redis reliably |
| What to measure before deciding | Pending job count, oldest job age, failed job count and database load during bulk notifications and exports | Queue latency, memory use in Redis, retry and dead set growth, and time to drain a bulk send |
Setting up the job backend and worker processes
This sequence takes a Decidim install from a confirmed version and runtime to a verified background job backend, with dedicated workers, a tested notification or email, and a queue depth check in place. Each step ends with a check you can record before moving on.
Confirm the Decidim version and runtime
Your platform engineer or Decidim developer confirms the exact Decidim minor version you run and reads its installation and update documentation for that version. For v0.32 the documented requirements are Ruby 3.4.7 and Node 22.14.x, and for v0.31 they are Ruby 3.3.4 and Node 22.14.x. Record the installed Ruby and Node versions on every web and worker host. The step is done when
ruby -vandnode -vmatch the documented requirements for your release and the same versions appear on each host that will run jobs.Choose the ActiveJob adapter
Decide between delayed_job, which stores jobs in PostgreSQL and needs no extra service, and Sidekiq, which stores jobs in Redis and needs a Redis instance that you run, host or buy as a managed service. Weigh how many emails and exports you expect at peak, who will operate Redis, and whether your team already runs Redis for other purposes. Write the decision and its owner in your change record. The step is done when the chosen adapter is named in the environment configuration plan and the team has agreed on who supports it.
Provision PostgreSQL and Redis as needed
Provision the PostgreSQL database that Decidim uses. If you chose delayed_job, the job queue lives in this same database, so the PostgreSQL version named in the manual installation guide (17.4 or later on Ubuntu 24.04.3 LTS) applies to the queue as well as to the application data. If you chose Sidekiq, provision a Redis instance for the queue. Redis Open Source 8.0 and later is available under a license you select, and the Redis Sentinel documentation says a robust deployment needs at least three Sentinel instances for high availability. The step is done when each service accepts connections from the web and worker hosts and you can connect to it from both.
Set the adapter and connection settings
Configure the ActiveJob adapter and its connection values in the Decidim environment, following the installation documentation for your release. Store the Redis or database connection details in your secret store rather than in source control. Keep the same settings on web and worker hosts so both read the same queue. The step is done when the application boots on the web host with the chosen adapter and reports no connection errors in the application log.
Start worker processes separately from web
Run the job workers as their own processes or containers, separate from the web process that serves participants. Use your process manager or orchestrator to restart them on failure and to log their output to a location your team monitors. Start with one worker per host and scale only after you have measured queue behavior. The step is done when the worker process is running, its logs show it has picked up the queue, and stopping the web process does not stop the worker.
Send a test notification and email
Trigger a known notification or send a test email from an administrator account on a non-production organization, then confirm it was processed by a worker rather than sent inline. Check the worker log and the queue table or Redis queue for the job's entry and its completion. Confirm the message arrives at a test mailbox through your SMTP relay. The step is done when the test email is delivered and the job record shows it finished successfully, with the timestamp recorded in your runbook.
Set up a queue depth alert
Add a monitor that reports the number of waiting jobs and the age of the oldest job, and alerts when either stays above a threshold your team sets. For delayed_job, query the jobs table in PostgreSQL. For Sidekiq, read queue sizes from Redis or the Sidekiq web interface behind authentication. Send alerts to a channel someone watches, and include failed job counts. The step is done when a deliberately paused worker in staging triggers the alert within the window you configured, and the alert is confirmed to reach the on-call contact.
Document ownership and recovery steps
Write a short runbook that names who restarts workers, who owns the Redis or PostgreSQL service behind the queue, how to clear or retry failed jobs, and where the queue alert goes. Include the test email procedure so it can be repeated after upgrades or SMTP changes. Ask your Decidim provider or internal team to confirm these steps against your release before go-live. The step is done when the runbook is stored with your other operations documents and a second team member has walked through it once.
How a Decidim action reaches the mail server through a job queue
A participant action in the web tier enqueues an ActiveJob, and the configured backend holds it: a PostgreSQL table for delayed_job or Redis for Sidekiq. A separate worker tier picks the job up and either calls the SMTP relay or writes an export to ActiveStorage. The check points are queue depth and failed jobs in the queue store, because a stopped worker leaves the web tier looking healthy while emails wait.
Job path from web request to SMTP relay, with the queue monitoring point marked.
Monitoring queues so emails do not silently stop
A stopped worker rarely produces an error that participants see. Emails simply stop arriving, and the first sign is often a complaint from a registered user. The cards below cover what to measure inside the job system, what to log from SMTP, and why at least one check must run from outside the web process.
Queue depth and job age
Track how many jobs are waiting in each queue and how long the oldest one has waited. A growing count with an old oldest job usually means no worker is picking up work, or workers are stuck on something slow. For Decidim background jobs, set alerts on age for the mailer queue, since a rising wait there is the earliest sign that participant emails are delayed. Confirm how your chosen backend exposes these numbers, because the query differs between delayed_job tables and Sidekiq's Redis data.
Failed and retried job counts
Count jobs that failed and jobs that were retried, and alert when either rises above your normal baseline. A retry loop can keep a queue looking busy while no message is actually sent. Review the error text for repeated failures, such as authentication errors from the mail server, because they point to one configuration problem affecting every message. Decide in advance how long failed jobs are kept so the evidence is still available when someone investigates.
Worker process liveness
Confirm that at least one worker process is running and reporting in, and alert when none is. A worker can be killed during a deploy, run out of memory, or lose its database or Redis connection, and the web process will keep accepting registrations and queuing jobs that nothing runs. This check must come from a separate monitor, such as a process supervisor, container health check, or external probe, because the web process cannot report on workers that are not running. Confirm which tools fit your hosting setup.
SMTP errors in application logs
Send SMTP rejections, timeouts and connection failures from the mailer to your central log store, and alert on any pattern of them. Many mail providers reject messages with a code that the application records but does not show to the user, so the failure stays hidden unless someone reads the logs. Route these lines to a dedicated alert so they are not buried among routine request logs. Ask your mail provider which error codes mean suspended sending or rate limiting.
Scheduled end-to-end test email
Run a job on a fixed schedule that sends a test message through the full path: queue, worker, SMTP, and a mailbox you control. Check that the message arrives within an interval you define. This is the only check here that proves mail reaches recipients, because every internal metric can look healthy while the mail provider silently drops messages. Use a mailbox that is not used by real participants, and keep its address out of public listings.
Dashboards and alert routing
Place the queue, failure, liveness and SMTP signals on one dashboard, and route alerts to an on-call channel that someone reads outside working hours. An alert that goes to a shared inbox nobody watches is the same as no alert. Test the routing by stopping a worker in staging and confirming that the alert fires and reaches the right person. Choose the monitoring stack with your platform team, since Prometheus, Grafana, Graylog or a hosted service may already be in use.
Questions buyers ask about Decidim background jobs
Is delayed_job enough for a single Decidim organization?
For many single-organization installs, delayed_job backed only by PostgreSQL is a reasonable starting point, because it adds no second data store and uses the database you already back up and monitor. The deciding factors are volume and timing: how many emails, exports and notifications run at once, how quickly they must be delivered, and whether a slow export could delay sign-in emails. Test the expected peaks in staging before deciding. Confirm with your Decidim version which ActiveJob adapters and job settings your release documents, since these details change between minor versions.
What does adding Sidekiq and Redis change in effort and running cost?
Sidekiq adds a Redis service to build, secure, back up and monitor, and it adds configuration for worker processes and concurrency. The cost is mostly people time and infrastructure: a Redis instance, possibly a replica and Sentinel setup for high availability, and the monitoring that goes with them. Redis Sentinel documentation says a robust deployment needs at least three Sentinel instances, which is one driver of footprint if you need failover. Ask any partner to itemize hosting, setup, testing and the recurring support effort separately.
How long does migrating the job backend take, and what drives it?
The duration depends on the size of the codebase changes, the test suite coverage, how long the existing queue takes to drain, and when the change fits your upgrade calendar. Draining the queue means stopping new enqueues, letting pending jobs finish, and confirming nothing is stranded before switching adapters. Schedule the switch outside a release window and avoid combining it with a minor-version upgrade, since Decidim's update guide asks you to upgrade one minor version at a time and back up the database first. Ask for a written plan with those checkpoints before agreeing on a timeline.
What does the work need from our team after launch?
Someone must own PostgreSQL administration, and if you run Sidekiq, Redis administration as well. Monitoring must cover queue depth, failed and retried jobs, worker health and the age of the oldest pending email, with alerts routed to people who can act at the hours your participation periods run. Plan on-call coverage for registration and notification windows, and document what to do when a queue backs up. Ask your team which of these skills already exist internally before choosing a model.
Can our own team set this up without a partner?
Yes, if your team has Rails and PostgreSQL experience, can run Redis securely, and has time to test upgrades and monitoring. The hard parts are rarely the initial configuration. They are failure modes such as silent queue stalls, jobs that fail on upgrade, and backups that do not include the queue state you expect. A partner is useful when the team lacks these skills or needs an independent review before a launch. Decide based on who will carry the pager after go-live.
How do Redis license changes affect a Decidim deployment?
License terms depend on the Redis version you install. Redis 8.0 and later can be used under a license of your choice among RSALv2, SSPLv1 and AGPLv3, while Redis 7.4.x to 7.8.x remain under the dual RSALv2 or SSPLv1 license, which are not OSI-approved. Redis 7.2.x and earlier remain under BSD-3-Clause. Redis Ltd. has said it plans to keep Redis Open Source under AGPLv3. Ask your legal team to review the specific version and whether you modify Redis or offer it as a network service, since the licenses page describes source obligations in that case.
Does choosing Sidekiq change how we keep emails from silently stopping?
Neither backend prevents silent failures by itself. Both need monitoring that reports queue age, failed jobs and worker liveness, plus a scheduled check that sends a test email and confirms delivery. Sidekiq makes queue state visible through its own tooling, but it also adds a Redis dependency that can fail independently of PostgreSQL. Document the owner of each alert and test it during staging before any participant depends on the system.
How DeployOpen works on this
DeployOpen plans, implements, tests, documents and supports self-hosted open-source platforms inside your own infrastructure, including the ActiveJob backend that Decidim uses for emails, exports and notifications. We start by agreeing on which background job work matters to your organization, then build and verify the chosen backend in your environment.
How we scope
- We confirm which Decidim jobs your organization depends on, such as notification emails, data exports and scheduled work.
- We document your hosting model, expected job volume, and whether Redis is already approved in your environment.
- Engagements are fixed-scope, so the backend choice, deliverables and timeline are agreed in writing before work starts.
How we build
- We configure the ActiveJob backend, either delayed_job on PostgreSQL or Sidekiq with Redis, to match the scoped requirements.
- We set up worker processes, queue names and retry behavior, and confirm that mail and export jobs run end to end.
- We test failure cases such as a stopped worker or unavailable Redis, and record what operators will see in each case.
How we hand over
- We deliver runbooks covering worker startup, queue inspection, failed job handling and upgrade steps for each Decidim minor version.
- We document the monitoring alerts that show when queues stop draining, so email delivery problems are noticed early.
- Your team receives configuration files, a verification checklist and a short walkthrough with the people who will operate the jobs.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so job infrastructure keeps pace with Decidim releases.
- We can retest queue monitoring and job behavior after each Decidim upgrade or Redis change before those changes reach production.
- Support scope, response expectations and included services are defined in the written agreement, so you know what to ask for in a quote.

