Dmitry
Dmitry

Reputation: 2087

How to deploy on forge when using queue

I have a project on forge with one queue worker (with database driver). Currently I need manually restart queue worker after each deploy: enter image description here

My deployment script:

cd /home/forge/default
git pull origin master
git log -1
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force

How extend my script for automatic restart queue worker?

I tried php artisan queue:restart. But this command just truncate all items in queue. And uptime of worker didn't reset.

Perhaps I can use failed-table, but I don't know how.

Upvotes: 2

Views: 1499

Answers (2)

baqx0r
baqx0r

Reputation: 125

Running php artisan queue:restart would also restart supervisor and you won't need to do sudo supervisorctl as a forge user.

Upvotes: 1

Can Celik
Can Celik

Reputation: 2087

Since you're using Laravel forge, I'm assuming you are also using supervisor. You can restart supervisor in your deployment script which will restart all queue workers.

sudo supervisorctl restart all

If you don't want to restart all workers, supervisortctl restart has options too.

restart <name>      Restart a process
restart <gname>:*   Restart all processes in a group
restart <name> <name>   Restart multiple processes or groups
restart all     Restart all processes

Upvotes: 2

Related Questions