Laravel supervisor queueing setup

iwatrouvePRO

6 months ago

How can I enable Laravel queueing on my Railway.app VPS for a mailing system and notification in a laravel backend? I don't know how to install and setup Supervisor as a background process for managing the laravel queueing on the Railway.app VPS.

Solved

24 Replies

6 months ago

Hello!

We actually have a guide for this!

https://docs.railway.app/guides/laravel

If you have any additional question you can ask them here and I will pass them along to Prosper, who wrote that guide.


Status changed to Awaiting User Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

Yeah, we already deployed the application as Iwa backend but now the problem is we do not know how to modify the supervisor configuration file for it to handle queueing.


Status changed to Awaiting Railway Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

Here is the official laravel queueing url documentation using supervisor https://laravel.com/docs/8.x/queues


6 months ago

If you are referring to supervisord, that is not something we can recommend deploying with on Railway, the optimal approach would be to break out the needed tasks into Railway services as that guide shows with the cron and worker services.

The guide luckily provides examples on how to do that, and they could be followed similarlly for the needed queueing service.


Status changed to Awaiting User Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

Yeah I understand but I do not have a choice please go to the link I sent to you regarding laravel queueing


Status changed to Awaiting Railway Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

I need to create a systemd service for managing the queueing with supervisor. I could use something else but there is no support from the laravel docs so that is why I need to stick to supervisor


6 months ago

May I ask why you aren't able to break it out into another Railway service? that would be by far the best solution.


Status changed to Awaiting User Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

https://laravel.com/docs/11.x/queues#supervisor-configuration


Status changed to Awaiting Railway Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

I am just following this guide above please go to the link in this guide and you will understand my issue better


6 months ago

I assure you, a single Railway service doing everything is not optimal.

I don't understand the need to use supervisor when you can run the needed task in another Railway service as our own guide recommends.


Status changed to Awaiting User Response railway[bot] 6 months ago


6 months ago

I looked at the docs you liked and it covers running queue:work with supervisor, the docs I linked also covers running queue:work but in another Railway service, thus achieving the same outcome, just far more optimized to how you want to architect your application when deployed on Railway to get the most out of your application.


iwatrouvePRO

6 months ago

We tried doing that and it keeps crashing


Status changed to Awaiting Railway Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

Using your recommended method


6 months ago

We are happy to work with you on the correct path forward, we want what's best for you and your application, and creating abstractions on top of abstractions with supervisor is not the way forward.

Try following the guide again, and let us know what you get stuck on!


Status changed to Awaiting User Response railway[bot] 6 months ago


6 months ago

I would also like to take the time to mention that Railway is not a VPS service, we run applications in containers.

Laravel's documentation assumes you are running a VPS, and for a VPS, supervisor is fine, but in a containerized environment, breaking the processes out into their own containers (services) is by far the best solution.


iwatrouvePRO

6 months ago

Yeah I just checked your documentation carefully and I finally understood what to do. I will explain all of this to the engineers tomorrow. Thanks again for taking the time to respond and guiding me through to a solution. I will give a positive review in the general chat


Status changed to Awaiting Railway Response railway[bot] 6 months ago


6 months ago

Thank you, I appreciate that, we are happy we can help.


Status changed to Awaiting User Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

Hello sir, I followed the instructions for the queue workers, but it's still not working, and I don't know why.

Attachments


Status changed to Awaiting Railway Response railway[bot] 6 months ago


6 months ago

Hello!

From the metrics on the worker service, something is definitely running, there are just no logs.

I'll ask my team member who would know better and get back to you.


Status changed to Awaiting User Response railway[bot] 6 months ago


6 months ago

We think you are having the worker log to a file, you should configure it to log to stdout / stderr.


iwatrouvePRO

6 months ago

Based on the metrics, the only thing that's working is the container startup, as shown in the image. i change my logs config to 'stderr' => [

'driver' => 'monolog',

'level' => env('LOG_LEVEL', 'debug'),

'handler' => StreamHandler::class,

'formatter' => env('LOG_STDERR_FORMATTER'),

'with' => [

'stream' => 'php://stderr',

],

],

Attachments


Status changed to Awaiting Railway Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

But it still does not work. So, what could be the cause of this issue?


unicodeveloperPRO

6 months ago

Hi, I can see that your QUEUE_CONNECTION is set to sync. That won't work because sync driver uses the main thread for execution of tasks which is useful for only when you are in development.

On production, the QUEUE_CONNECTION should be set to database or redis . So please set your QUEUE_CONNECTION to database or redis and ensure you have a database or redis service running.

Also set your LOG_CHANNEL to errorlog. to see the logs in the Railway console.


Status changed to Awaiting User Response railway[bot] 6 months ago


iwatrouvePRO

6 months ago

Okay thanks I will try that and contact you back in 1 hr. 30 mins


Status changed to Awaiting Railway Response railway[bot] 6 months ago


Status changed to Solved melissa 6 months ago


Laravel supervisor queueing setup - Railway Help Station