Why Decidim scheduled tasks decide whether processes run on time
Decidim does not move a participatory process to its next phase or publish its open data files on its own unless someone schedules the work. Phase changes depend on the decidim_participatory_processes:change_active_step scheduled task, and open data files depend on running bundle exec rake decidim:open_data:export on a recurring basis. An operator who has published a process with set phase dates and a public commitment to release data can have a platform that looks correct in the admin panel while the phase never advances and the export files never refresh. Participants then see a stale stage, and the organization discovers the gap when someone asks why nothing changed.
Teams should treat this as part of the installation itself, not as a later tuning step. The schedule belongs on the list before a launch, because the first process with real dates will depend on it. It also needs checking after a server move, since a new host, container or scheduler configuration may not carry the old crontab or task definitions across. After any upgrade, confirm the schedule still runs against the new release, because the rake task and its environment may change between versions. Before launch, ask your engineering lead to show where the schedule is defined, which user runs it, and what log or record proves that the last run succeeded.
The rest of this page explains how to schedule these tasks with cron or the whenever gem, what the commands expect from the environment, and what symptoms appear when a task is missing or failing. Confirm the exact task names and their current behavior against the version you run, using the Decidim process phases documentation and the Decidim open data documentation, because a missed schedule is easy to overlook until a deadline passes.
Which recurring Decidim tasks an install needs
A Decidim install depends on a small set of recurring tasks that run outside the web request cycle. The two supported by the docs are the phase change task for participatory processes and the open data export, and each one fails quietly when it is missing. Set both up before participants arrive, then confirm the exact cadence against the docs for your version.
Phase change task for processes
The task decidim_participatory_processes:change_active_step moves a participatory process from one phase to the next when its scheduled time arrives. Without it, phases stay where an administrator last left them, so a proposal period can stay open after its deadline or a voting phase may never start. Participants see stale dates, and administrators end up changing phases by hand. Check that the task runs on the schedule you chose and that a test process changes phase as expected.
Open data export
The command bundle exec rake decidim:open_data:export produces the open data files that Decidim publishes about the platform's public content. Those files are not refreshed on their own, so a missing schedule means the published data drifts from the live site. Decide how often the export should run based on how often your public data changes, and confirm the output location and file names for your version before you publish links to them.
Choosing the scheduler
You can run these tasks with cron, the whenever gem, or the scheduler your container platform provides. Whichever you pick, the job must run in the application environment with the same database and environment variables as the web process, or it will fail silently. Use a single scheduler instance, because two schedulers running the same task can apply a phase change twice or write the export twice.
Logging and failure checks
A scheduled task that fails leaves no visible error for participants, so you need your own record of each run. Route task output to a log file or your log platform, and check it after each scheduled time. Ask your team to confirm how a failed run is reported and who receives the alert, since the phase change and export only show problems when someone looks.
Cadence and version checks
The right frequency depends on your processes, your publishing needs and your Decidim version, so none is fixed here. Write down the cadence you chose for each task, and recheck both entries whenever you upgrade, because the task names and output paths can change between minor versions. Confirm the current instructions in the docs for the version you run before you rely on them.
How to schedule Decidim tasks with cron or whenever
This sequence turns the recurring Decidim tasks into scheduled jobs that run under the right environment, and each step closes with a check that proves the job works before it is left unattended.
Confirm the install path and runtime
Your platform engineer confirms whether Decidim runs as a manual Rails application or in Docker, because the working directory, environment file and command wrapper differ between the two. Record the Ruby and Node versions for your release line, the application path on the host or the container name, and the user the scheduler will run as. Done means the team can open a shell in the same environment the web process uses and run
bundle exec rails -vthere without errors. Confirm the exact install path against the Decidim installation documentation for your version before you write any job definitions.Set the production environment and working directory
Your platform engineer sets RAILS_ENV to production and changes into the application directory before every job, so the tasks read the same database, secrets and mailer settings as the web application. Cron starts with a minimal environment, so variables such as the database URL, secret key base and the path to Ruby must be loaded explicitly, usually from an environment file the job sources. Done means a one-line test job that prints the environment and working directory writes the expected values to a log file.
Identify the rake tasks the install needs
Your platform engineer lists the tasks the install depends on: the participatory process phase change task named decidim_participatory_processes:change_active_step, and the open data export task decidim:open_data:export. Each task is run as bundle exec rake followed by the task name, from the application directory, with production as the environment. Check the Decidim phases and open data documentation for your release to confirm task names and any arguments before copying them into a schedule. Done means the team has a written list of commands with the environment and working directory for each.
Run each task once by hand
Your platform engineer runs each command once from the scheduler's environment, not from an interactive session with different variables, and captures the full output to a file. The run should finish with an exit status of zero and no stack traces. For the phase task, check the output shows which processes were evaluated; for the export task, check that the command completes without writing errors to the log. Done means each command has a recorded clean run that the team can compare against later scheduled runs.
Verify the phase change in the admin panel
A process administrator checks the participatory process in the admin panel after the manual phase run. If a process has a phase whose start date has passed, the active step should now match the scheduled phase. If nothing changes, the process may not have dates set, the phase may already be active, or the task may be pointing at the wrong environment. Done means the admin panel shows the expected active phase and the team has a test process to reuse when checking future changes.
Confirm the open data export files
Your platform engineer runs the open data export manually and checks that the export files appear in the location the application writes them to, and that the files are readable by the application user. Confirm the storage location for your setup, since a container without a persistent volume loses files on restart, and check that object storage or a mounted directory receives the output. Done means the export files exist, open correctly and match what the admin panel or documentation describes for your release.
Add the schedule with cron or whenever
Your platform engineer adds each verified command to the system crontab or to a schedule.rb file managed by the whenever gem, which writes cron entries from Ruby configuration. Both approaches should call the same wrapper script that sets the environment and changes directory, and both should redirect output to a log file. Choose the frequency for each task based on your own requirements and the way participants use the platform. Done means the crontab or whenever output lists every job, and the team has recorded who owns each entry.
Review logs after the first scheduled runs
Your operations team reviews the log files after the first scheduled runs of each job, checking for the same clean exit and output seen during the manual runs. Look for missing environment variables, permission errors and database connection failures, which are common when the scheduler's environment differs from the web process. Add a monitoring check or alert that fires when a job has not produced a successful log entry within the expected window. Done means each job has a confirmed successful scheduled run and a documented way to detect future silent failures.
Cron, whenever or an external scheduler: which fits your install
System cron is the most direct option on a bare Rails server. You add a line to the crontab of the account that runs Decidim, and the line calls the rake task from the application directory with the production environment set. It suits a single application server managed by a platform or systems team that already monitors cron on the host. Because the schedule lives outside the application code, it is easy to miss when a new environment is built.
- Environment fit: Works well on a bare Rails server with a single app host. Containers need the cron entry to run inside an image that also runs the web process, which is often awkward.
- Operator needs: Someone must write the entries, set the environment variables cron does not inherit, and log output to a known file.
- Upgrade review: Check the crontab on every host after each upgrade, since the task names can change between minor versions.
- Drift risk: Schedules set by hand on one server are hard to reproduce on staging or a replacement host.
- Failure visibility: Cron sends failures only where you configure mail or log collection, so define alerting for failed runs.
Before relying on cron, confirm the exact task names for your Decidim version in the phases and open data documentation and test each one manually.
The whenever gem lets you describe schedules in a Ruby file kept in the application repository, then generates the matching crontab entries. The schedule is versioned with the code, so a staging copy and a production install can share the same definition. It fits Rails deployments that already use a deployment pipeline and want schedules reviewed like any other change. It still relies on cron on the host, so it does not remove the need to check the host.
- Environment fit: Suits bare Rails servers and virtual machines managed through automation. In containers, the generated crontab still needs a process that runs cron, so a separate scheduler container is often simpler.
- Operator needs: Someone must install the gem, maintain the schedule file, and run the update command on each host after a change.
- Upgrade review: Diff the schedule file in each upgrade branch so changed or removed tasks are caught in code review.
- Environment variables: Confirm the generated entries load the production environment and secrets, since cron starts with a minimal environment.
- Ownership: Name who approves schedule changes so the file does not drift from what is running.
When you adopt this approach, confirm the gem version is compatible with your Ruby version and that the generated crontab matches the file you reviewed.
An external scheduler or container orchestrator starts the rake tasks as one-off jobs on a timer, outside the web process. Options include a scheduler built into a Kubernetes distribution, a managed job service from a cloud provider, or a dedicated workflow engine your organization already runs. This model fits container-based installs and managed hosting, where the platform team wants schedules, retries and logs visible in one place. The task definition, image version and secrets must match the running release, so it needs the same care as the application itself.
- Environment fit: Matches Docker and Kubernetes deployments, where job containers can reuse the Decidim image. Managed hosting may expose a job feature, but confirm it can run a rake task in the application environment.
- Operator needs: Someone must define each job, supply secrets and the database connection, and set concurrency rules so two runs do not overlap.
- Upgrade review: Update the job image tag together with the web and worker images, and check task names against the new release notes.
- Observability: Confirm your scheduler's history, alerting and retention features with its own documentation before you depend on them.
- Ownership: Agree whether the platform team or the Decidim team owns each job definition.
Before choosing this route, confirm that the scheduler can run the task with the same image, environment and network access as the web application.
What breaks when scheduled tasks are missing
When the recurring tasks are missing, the most damaging failure is that processes stay in the wrong phase. A participatory process only moves to its next step when the decidim_participatory_processes:change_active_step task runs, so a phase that should have closed can stay open to contributions, and a phase that should have opened can stay closed. Participants see the public page and may assume the process is working normally, while the administrators who planned the timeline have no visible signal that anything went wrong. The same pattern applies to open data: if bundle exec rake decidim:open_data:export is not scheduled, the export files are never generated or quietly go stale, and anyone relying on them for reuse or reporting receives outdated data.
Because the site still loads, these failures rarely raise an alarm on their own. Start with a manual check: compare each active process's current phase in the admin panel against the dates you published, and confirm that the open data files carry a recent modification time on the server or in storage. Then read the logs of the scheduler and the application for the task names and their exit status, and confirm that a run actually happened rather than assuming it did. Make these checks part of your launch and upgrade routine, and decide who owns the response when a phase is late.
The scheduler is a common source of silent breakage. Cron and whenever run jobs under a specific system user with their own PATH, working directory and environment, so the task may fail to find Ruby, the bundle, the database connection or the variables set for the web process. Confirm that the scheduled job runs as the same user that owns the application and loads the same environment variables, and test each task by running it once by hand under that user before relying on the schedule. Check the exact command line against the Decidim process phases documentation and the open data documentation, since a mistyped task name or a missing environment variable can fail without any obvious error in the browser.
How the scheduler, rake tasks and Decidim data fit together
The scheduler, either cron or whenever, starts on the server and runs a command inside the Rails environment of the Decidim application. That command calls the rake task that changes the active phase of a participatory process, or the task that writes open data exports. Phase state is read and written in the PostgreSQL database, while export files land in file storage. The admin panel and the public site then read these results, so a missed job shows up as a stale phase or a missing export. Check the schedule output and the database after each run.
Scheduled commands flow through Rails and rake to the database and file storage.
Security and operational risks of running jobs on the server
Scheduled tasks run with server privileges, touch participant data and sit outside the normal request path, so they are easy to leave under-controlled. The cards below cover the four failure points we see most often and the controls that address each one.
Running tasks as the wrong user
Cron jobs run under the user who owns the crontab, and that user often has sudo rights or write access to the whole application tree. Run the Decidim tasks as the same unprivileged account that runs the application, with read access to the code and write access only to the directories the tasks need, such as the export output and log paths. Check with crontab -l and ps that the jobs run under that account, not root.
Exported files holding participant data
Open data exports contain information about participants and contributions, so a world-readable export directory or a web-served path turns a routine task into a data exposure. Keep the export directory outside the public web root, set restrictive permissions (owner read and write, no group or world access), and confirm the web server cannot serve it. Decide how long exports stay on disk and who may retrieve them before the first run.
Open data docsSecrets stored in crontab
Inline database passwords, SMTP credentials or secret key values in a crontab line are visible to anyone who can run crontab -l, and they often end up in shell history and process listings. Load secrets from an environment file readable only by the application user, or from your secrets manager, and reference them from the job wrapper. Rotate any credential that has ever been pasted into a crontab.
Schedules lost during a redeploy
Crontab entries live on one host, so a rebuilt server, a new container image or a fresh deployment can silently drop the phase-change and export jobs. Phases then stop advancing and open data goes stale without any error in the web application. Keep the schedule definition in version control, apply it as part of deployment, and verify after each release that the expected jobs are present and have recent run logs.
Silent failures and log exposure
A failing cron job usually produces no visible symptom for participants until a phase fails to change or an export is missing. Redirect output to a log file with a fixed location and rotation, alert on non-zero exit codes, and make sure logs do not record personal data or full command lines containing secrets. Review the job logs as part of routine operations.
Aligning data handling with backups and privacy
Export files, job logs and any temporary copies are personal data stores in their own right, and they must follow the same retention and access rules as the database. Include them in your backup scope or explicitly exclude them, and set deletion rules for old exports. Follow the Decidim backup and restore and privacy and compliance guidance so these copies are governed, not forgotten.
Limits to confirm for your Decidim version and environment
Do the scheduled task names match my Decidim version?
Confirm them against the docs for your exact release before you configure anything. The phase task is named decidim_participatory_processes:change_active_step and the export is bundle exec rake decidim:open_data:export, but task names and arguments can change between minor versions, and Decidim supports only its last two minor branches with security updates. Run bundle exec rake -T on your installed code and compare the output with the docs for that release. If a name differs, use the one your version provides and record the change in your runbook so the next upgrade does not silently drop the job.
How is the schedule managed on my container platform?
Find out where the schedule lives before you write any cron entry. On a single server, cron or the whenever gem can run the tasks. In containers, the schedule usually sits outside the web container, as a Kubernetes CronJob, a scheduler in your platform, or a dedicated job container. Confirm which component runs the task, which image and environment variables it uses, whether it can reach the database, and whether concurrent runs are prevented if one export runs long. Also confirm who owns the schedule definition, since it is easy to lose when the platform is rebuilt.
How long do open data exports take on my data volume?
Measure this on a staging copy with realistic data volume, because the time depends on your data, not on a figure published for Decidim. Export duration grows with the number of records, participant contributions, comments and attached files included in the export, and with database load at the time it runs. Record the duration of each run, check that the export finishes before the next scheduled run starts, and confirm where the generated files are written and whether they are public. Ask whether your schedule needs to be spaced around peak participation periods.
Does the server time zone change when phases start and end?
It can, so test it rather than assume it. Cron evaluates schedules in the host or container time zone, while Rails applications may store and compare times in UTC or a configured zone. Confirm the time zone of the scheduler, the application server and the database, then create a test phase with a boundary a few minutes ahead and watch when it changes. Daylight saving transitions are a common source of an hour's error, so repeat the test near a transition date. Document the zone you chose so that participants and administrators read phase dates consistently.
Who should confirm that scheduled tasks still run after an upgrade?
The team that runs the upgrade should confirm it, and the check should be written into the upgrade plan. Decidim's update guide asks operators to follow each release's upgrade instructions, because some releases change database structures and task behavior can change with them. After each upgrade, list the scheduled tasks, run each one manually in staging, and confirm the expected result in the admin interface and the open data output. Keep the check in the same runbook as your backup step so that it is not skipped.
Can we run these checks ourselves or do we need a partner?
Most organizations with a Rails operations team can run these checks in-house, provided they have a staging environment and someone who can read the release notes for their version. A partner adds value when the schedule spans several containers, when several organizations share one installation, or when audit evidence of scheduled control runs is needed. DeployOpen implements and documents self-hosted platforms in the client's own infrastructure on a fixed scope agreed in writing, so the scope of any check can be defined before work starts. Ask any provider which checks are included, who keeps the runbook current, and what evidence is delivered.
What should we ask a provider to confirm in a quote?
Ask for a written list of the tasks in scope, the Decidim version they were verified against, the environment they were tested in, and the method used to verify each run. A useful quote also states what is one-time work, such as building the schedule and documenting it, and what recurs, such as rechecking after each upgrade or when the platform changes. Cost depends on the number of tasks, the number of environments and how many organizations share the install, so ask for the components priced separately. No Decidim-published figure applies to these costs, so the quote should come from the written scope.
How DeployOpen sets up and supports Decidim scheduled tasks
DeployOpen plans, implements and supports self-hosted open-source platforms inside the client's own infrastructure, and that includes the recurring jobs a Decidim install depends on. We agree the scope in writing first, then configure, test and document the scheduled tasks so your team can run them after handover.
How we scope
- We list every recurring task your install needs, including phase changes and open data exports.
- We record which scheduler runs each task, whether system cron, whenever or your platform's job tooling.
- We agree the scope, deliverables and timeline in writing before work starts, as engagements are fixed-scope.
- We confirm which Decidim version and Ruby and Node runtime your install uses before choosing commands.
How we build
- We configure the phase change task and the open data export rake task under the service account that runs Decidim.
- We set schedules, log locations and output paths for exported files, and check file permissions for the web server.
- We test each task on a staging copy and confirm that phases advance and export files update as expected.
- We check that scheduled jobs run in the same environment and with the same database settings as the web application.
How we hand over
- We document each scheduled task, its command, schedule, owner, expected output and the log entries that show success.
- We write a runbook for what to check when a phase does not change or an export file is stale.
- We walk your operations team through monitoring, manual re-runs and how to pause or edit a schedule safely.
- We provide the configuration as files your team can keep in version control with the rest of the deployment.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so scheduled tasks are re-verified after each upgrade.
- We review the task list when Decidim's upgrade instructions change, since upgrades may alter tasks or database structures.
- We confirm with you which alerts and log reviews your team wants for failed or missed scheduled runs.
- We can include scheduled-task checks in security testing of the deployed platform when you request it.

