Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boomerang's avatar

How to keep long-running process working?

Hi there! I have an application based on laravel. This application is not a simple site, it's a bot for telegram. So bot - is a long-running process which either makes permanently requests to get last updates or stays connected through webhook feauture and listen telegram url and also handling new updates.

My question is - how to properly deploy (let's say in modern way) this bot application on production and keep this long running process permanently running OR at least restart it fast if it fails OR rapidly start new process on a different server... (or something else) How to organize this fault tolerance? Some provided links would be very appreciated.

PS. Laravel Forge and Envoyer can be useful (still actual) for such kind of problems? Is such task related to Docker somehow?

Thanks.

0 likes
4 replies
D9705996's avatar

I would recommend using supervisor if you are using a Linux OS

http://supervisord.org/

There is an example configuration for setting up with Horizon that you can use as a template for you needs

[program:horizon]
process_name=%(program_name)s
command=php /home/forge/app.com/artisan horizon
autostart=true
autorestart=true
user=forge
redirect_stderr=true
stdout_logfile=/home/forge/app.com/horizon.log
1 like
boomerang's avatar

Hey @d9705996, thank you for your response. I know about this tool, I used it long time ago for restarting my queue handler. But all work this tool does, it just restarts the process which had failed. But if for example there has fallen database or disk memory has ended, and this process works based on that, this means, that this process will be down, regardless on restarting... I'm searching tool which can get up automatically additional server and run there the same process, while I will be figuring out with first server. Is there something like that? I guess this is more like Dev-OPS work, but anyway some useful links will help me a lot.

Please or to participate in this conversation.