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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. LAMP
  3. Creating a queue worker for laravel app?

Creating a queue worker for laravel app?

Scheduled Pinned Locked Moved LAMP
14 Posts 3 Posters 2.6k Views 3 Watching
  • 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

    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?

    girishG Offline
    girishG Offline
    girish
    Staff
    wrote on last edited by
    #2

    @xevotech Is this the LAMP app?

    X 2 Replies Last reply
    0
    • girishG girish

      @xevotech Is this the LAMP app?

      X Offline
      X Offline
      XevoTech
      wrote on last edited by
      #3

      @girish Yes

      1 Reply Last reply
      0
      • girishG girish

        @xevotech Is this the LAMP app?

        X Offline
        X Offline
        XevoTech
        wrote on last edited by
        #4

        @girish Any ideas?

        girishG 1 Reply Last reply
        0
        • X XevoTech

          @girish Any ideas?

          girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #5

          @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
          0
          • girishG girish

            @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 Offline
            X Offline
            XevoTech
            wrote on last edited by
            #6

            @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
            0
            • girishG girish

              @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 Offline
              X Offline
              XevoTech
              wrote on last edited by
              #7

              @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
              
              girishG 1 Reply Last reply
              0
              • X XevoTech

                @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
                
                girishG Offline
                girishG Offline
                girish
                Staff
                wrote on last edited by
                #8

                @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
                0
                • girishG girish

                  @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 Offline
                  X Offline
                  XevoTech
                  wrote on last edited by
                  #9

                  @girish

                  ; Add custom PHP configuration in this file
                  ; Settings here are merged with the package's built-in php.ini
                  
                  
                  disable_functions = ;
                  
                  girishG 1 Reply Last reply
                  0
                  • X XevoTech

                    @girish

                    ; Add custom PHP configuration in this file
                    ; Settings here are merged with the package's built-in php.ini
                    
                    
                    disable_functions = ;
                    
                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #10

                    @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
                    0
                    • girishG girish

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

                      disable_functions = 
                      
                      X Offline
                      X Offline
                      XevoTech
                      wrote on last edited by
                      #11

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

                      girishG 2 Replies Last reply
                      1
                      • X XevoTech

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

                        girishG Offline
                        girishG Offline
                        girish
                        Staff
                        wrote on last edited by
                        #12

                        @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
                        0
                        • X XevoTech

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

                          girishG Offline
                          girishG Offline
                          girish
                          Staff
                          wrote on last edited by
                          #13

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

                          1 Reply Last reply
                          0
                          • girishG girish

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

                            disable_functions = 
                            
                            ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by A Former User
                            #14

                            @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
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Bookmarks
                            • Search