Prompt
How do I run scheduled tasks, webhooks, and queue workers in one place?
Latest observation
A common way to run all three in one place is to use a single application server or container that starts a process manager to supervise multiple processes:
- scheduler for cron-like jobs
- web server for webhooks
- queue worker for background jobs
Typical setup
1) Web server
Run your app normally behind something like Nginx, Caddy, or directly in the app process.
2) Scheduler
Use your framework’s scheduler or a cron entry that triggers your app’s scheduled command every minute.
Example:
* * * * * php /var/www/app/artisan schedule:run >> /dev/null 2>&1
3) Queue worker
Run a worker process that listens to your queue:
php artisan queue:work
4) Process supervisor
Use a process manager such as:
- Supervisor
- systemd
- Docker Compose
- Kubernetes
- pm2 for Node apps
Example supervisord config could manage:
php-fpmor your app serverqueue:workschedule:runloop or cron- webhook listener if separate
One-container approach
If you really want everything “in one place,” you can use a single Docker container with:
- your app
- cron or a scheduler loop
- queue worker
- web server
But in production, it’s usually cleaner to run separate processes in the same deployment environment, supervised together.
Best practice
A good pattern is:
- webhooks: handled by the web app
- scheduled tasks: triggered by cron or scheduler service
- queue workers: separate long-running worker process
All can live on the same machine, but they should usually be separate processes so one failure doesn’t take down everything.
If you tell me your stack (Laravel, Django, Node, Rails, etc.), I can show the exact way to do it.