Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Creating a queue worker for laravel app?

    LAMP
    3
    14
    801
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • X
      XevoTech last edited by

      Hi!
      I've developed a Laravel app, but I can't get the queue worker to work, as I'm unable to create the file...

      # APPNAME Queue Worker File
      # ----------------------------------
      
      [Unit]
      Description=APPNAME Queue Worker
      After=redis-server.service
      
      [Service]
      # On some systems the user and group might be different.
      # Some systems use `apache` or `nginx` as the user and group.
      User=www-data
      Group=www-data
      Restart=always
      ExecStart=/usr/bin/php /var/www/app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
      
      [Install]
      WantedBy=multi-user.target
      

      I'm aware of that the ExecStart path is wrong, but I can't create this file 😕 Any ideas?

      girish 1 Reply Last reply Reply Quote 0
      • girish
        girish Staff @XevoTech last edited by

        @xevotech Is this the LAMP app?

        X 2 Replies Last reply Reply Quote 0
        • X
          XevoTech @girish last edited by

          @girish Yes

          1 Reply Last reply Reply Quote 0
          • X
            XevoTech @girish last edited by

            @girish Any ideas?

            girish 1 Reply Last reply Reply Quote 0
            • girish
              girish Staff @XevoTech last edited by

              @xevotech You cannot put in a systemd service file because the app is running in a container and the container itself has no systemd inside it.

              Not an expert on laravel but there are two ways:

              • In the startup script, start the queue worker in the background - https://docs.cloudron.io/apps/lamp/#custom-startup-script . So, sudo -u www-data /usr/bin/php /var/www/app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 &

              • Alternately, you can put this in the crontab - https://docs.cloudron.io/apps/lamp/#cron-support . So, 0 * * * * sudo -u www-data /usr/bin/php /var/www/app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 --stop-when-empty (the stop-when-empty is needed so that the queue worker quits when the queue is empty).

              Would either of the above work?

              X 2 Replies Last reply Reply Quote 0
              • X
                XevoTech @girish last edited by

                @girish said in Creating a queue worker for laravel app?:

                udo -u www-data /usr/bin/php /var/www/app/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 &

                Not sure, but I'll try. I'll report what I find

                1 Reply Last reply Reply Quote 0
                • X
                  XevoTech @girish last edited by

                  @girish I'm getting an error with LAMP's PHP.ini. Chaning the PHP.ini in the data dir doesn't fix it. What do I do?

                  The error as following:

                  May 07 22:10:38 PHP: syntax error, unexpected $end in /etc/php/7.4/cli/conf.d/99-cloudron.ini on line 5
                  May 07 22:10:38
                  May 07 22:10:38 ErrorException
                  May 07 22:10:38
                  May 07 22:10:38 pcntl_async_signals() has been disabled for security reasons
                  May 07 22:10:38
                  May 07 22:10:38 at /app/data/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:639
                  May 07 22:10:38 635â–• * @return void
                  May 07 22:10:38 636â–• */
                  May 07 22:10:38 637â–• protected function listenForSignals()
                  May 07 22:10:38 638â–• {
                  May 07 22:10:38 ➜ 639▕ pcntl_async_signals(true);
                  May 07 22:10:38 640â–•
                  May 07 22:10:38 641â–• pcntl_signal(SIGTERM, function () {
                  May 07 22:10:38 642â–• $this->shouldQuit = true;
                  May 07 22:10:38 643â–• });
                  May 07 22:10:38
                  May 07 22:10:38 +17 vendor frames
                  May 07 22:10:38 18 /app/data/artisan:37
                  May 07 22:10:38 Illuminate\Foundation\Console\Kernel::handle()
                  May 07 22:10:38 box:tasks 6710: {"percent":100,"message":"Done"}
                  May 07 22:10:39 box:apptask xevoid.com updating app with values: {"installationState":"installed","error":null,"health":null}
                  May 07 22:10:39 box:taskworker Task took 24.15 seconds
                  May 07 22:10:39 box:tasks setCompleted - 6710: {"result":null,"error":null}
                  May 07 22:10:39 box:tasks 6710: {"percent":100,"result":null,"error":null}
                  May 07 22:10:43 ==> Do not override existing index file
                  May 07 22:10:43 ==> Source custom startup script
                  May 07 22:10:43 PHP: syntax error, unexpected $end in /etc/php/7.4/cli/conf.d/99-cloudron.ini on line 5
                  May 07 22:10:43
                  
                  girish 1 Reply Last reply Reply Quote 0
                  • girish
                    girish Staff @XevoTech last edited by

                    @xevotech What are the contents of /app/data/php.ini ? It seems there is some syntax error. Note that you have to restart the app for the php.ini changes to take effect.

                    X 1 Reply Last reply Reply Quote 0
                    • X
                      XevoTech @girish last edited by

                      @girish

                      ; Add custom PHP configuration in this file
                      ; Settings here are merged with the package's built-in php.ini
                      
                      
                      disable_functions = ;
                      
                      girish 1 Reply Last reply Reply Quote 0
                      • girish
                        girish Staff @XevoTech last edited by

                        @xevotech There is no ";" in the end for php.ini settings, maybe that is the problem. So, just:

                        disable_functions = 
                        
                        X ? 2 Replies Last reply Reply Quote 0
                        • X
                          XevoTech @girish last edited by

                          @girish Now it doesn't output any errors, but I can't access the page:
                          b11a0364-56a1-412b-be8f-f6864c675b4a-image.png

                          girish 2 Replies Last reply Reply Quote 1
                          • girish
                            girish Staff @XevoTech last edited by

                            @xevotech is there anything new in the logs now? Maybe this is quicker if you can drop me an email on support@cloudron.io and I can take a look as to how to make it work with the LAMP app.

                            1 Reply Last reply Reply Quote 0
                            • girish
                              girish Staff @XevoTech last edited by

                              @xevotech I made a proper article to run laravel apps - https://docs.cloudron.io/guides/lamp-laravel/

                              1 Reply Last reply Reply Quote 0
                              • ?
                                A Former User @girish last edited by A Former User

                                @girish Hah this actually helps me with the Humhub app. Thanks! My solution was to use sed to delete line 312 in /etc/php/7.4/cli/php.ini lmao. Jank to the extreme.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post
                                Powered by NodeBB