Published on

Supervisor / "Pseudo Cron Jobs" in DDEV

Authors

Recently I needed an easy way to run background workers and scheduled tasks inside a DDEV setup without adding more services. DDEV already ships with supervisord in the web container — we can leverage that to:

  • Run long-running processes (e.g., messenger:consume)
  • Emulate simple cron intervals (e.g., run TYPO3 Scheduler every minute)

1) Copy supervisor config out of the container

# inside the project root
ddev ssh
mkdir supervisor_temp
cp /etc/supervisor/conf.d/* /var/www/html/supervisor_temp/
exit

2) Create a supervisor folder in .ddev and move the files

mkdir -p .ddev/supervisor
mv supervisor_temp/* .ddev/supervisor/
rm -rf supervisor_temp

3) Mount the folder into the web container

Create .ddev/docker-compose.supervisor.yml with:

version: '3.6'

services:
  web:
    volumes:
      - ./supervisor:/etc/supervisor/conf.d

Restart DDEV so the new conf directory is used by supervisord.

4) Example: Symfony Messenger worker

Create .ddev/supervisor/symfony-messenger-consume.conf:

[program:symfony-consumer]
command=/usr/bin/php /var/www/html/bin/console messenger:consume default
autorestart=true
startretries=10

After restarting DDEV, the consumer starts automatically and is restarted on failure.

Check it:

ddev ssh
ps x | grep consume

5) Example: TYPO3 Scheduler as a "pseudo" cron job

For periodic execution, use a small bash loop. Create .ddev/supervisor/typo3-scheduler.sh and make it executable (chmod +x):

#!/usr/bin/env bash

while true
do
  sleep 60
  /var/www/html/vendor/bin/typo3 scheduler:run
done

Then register it via .ddev/supervisor/typo3-scheduler.conf:

[program:typo3-scheduler]
command=/etc/supervisor/conf.d/typo3-scheduler.sh
autorestart=true
startretries=10

Restart DDEV. The script keeps running and triggers the TYPO3 scheduler every minute.

Note: This is a lightweight replacement for cron in local dev; for production, prefer real cron/supervised services.