Laravel queue runner automatically stopping after upgrade to v2 app

Hi, I’ve been using fly to run jobs for my laravel app for some time now, however, upon upgrading to v2, it seems the queue runner process is auto stopping after some time?

2023-05-21T19:43:04.156 app[3d8d934eced528] iad [info] 2023-05-21 15:43:04 App\Jobs\ProcessVideo .................. 5,468.84ms DONE

2023-05-21T19:58:00.131 app[3d8d934eced528] iad [info] Starting clean up.

2023-05-21T19:58:00.132 app[3d8d934eced528] iad [info] Umounting /dev/vdb from /var/www/html/storage/app/data

2023-05-21T19:58:01.134 app[3d8d934eced528] iad [info] [ 903.178581] reboot: Restarting system

2023-05-21T19:58:01.355 runner[3d8d934eced528] iad [info] machine exited with exit code 0, not restarting 

Any ideas?

can you show fly.toml ?

Sure, here’s a cleaned up version of the app (removed some env and other things that shouldn’t change anything.)

app = "myapp"
primary_region = "iad"
kill_signal = "SIGINT"
kill_timeout = "5s"

[mounts]
  processes = ['worker']
  source="app_storage"
  destination="/var/www/html/storage/app/data"

[experimental]
  auto_rollback = true

[processes]
  worker = "php artisan queue:work sqs --sleep=1 --tries=1 --backoff=3 --max-time=900"

if you running version 1

app = "myapp"
primary_region = "iad"
kill_signal = "SIGINT"
kill_timeout = "5s"

[mounts]
  processes = ['app'] // change this
  source="app_storage"
  destination="/var/www/html/storage" // change this

[experimental]
  auto_rollback = true

[processes]
  app = "" // add this
  worker = "php artisan queue:work sqs --sleep=1 --tries=1 --backoff=3 --max-time=900"

This would be for running a normal laravel with a UI, no? I am not doing that as that is not what I am intending to do. On v1 this worked, but once I migrated it shuts down after some time or after a job is ran.

Hi there!

Try out using queue:listen instead of queue:work - I believe queue:work will exit when it’s done processing jobs, and the v2 platform (Machines) are designed to be able to shut down when a process exits with a non-error code - which is my guess as to what’s happening.

I’ll update our docs as I see our examples shows queue:work instead of queue:listen.

Let me know if that works or not!

If not, please also share your Dockerfile.

I was using queue:work based on the docs so that makes sense. Thanks that seems to have solved it.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.