Skip to content

Instantly share code, notes, and snippets.

@reanim8ed
Created April 6, 2021 18:19
Show Gist options
  • Save reanim8ed/468f3519be5146f477375a84e6b3b80a to your computer and use it in GitHub Desktop.
Save reanim8ed/468f3519be5146f477375a84e6b3b80a to your computer and use it in GitHub Desktop.
[Messenger supervisor config] #symfony

sudo apt-get install supervisor

Supervisor configuration files typically live in a /etc/supervisor/conf.d directory. For example, you can create a new messenger-worker.conf file there to make sure that 2 instances of messenger:consume are running at all times:

;/etc/supervisor/conf.d/messenger-worker.conf
[program:messenger-consume]
command=php /path/to/your/app/bin/console messenger:consume async --time-limit=3600
user=ubuntu
numprocs=2
startsecs=0
autostart=true
autorestart=true
process_name=%(program_name)s_%(process_num)02d

Change the async argument to use the name of your transport (or transports) and user to the Unix user on your server. Next, tell Supervisor to read your config and start your workers:

 sudo supervisorctl reread

 sudo supervisorctl update

 sudo supervisorctl start messenger-consume:*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment