sanwhere i have installed this but did not setup

we just need to add to these lines to extend.php right?

return [
    new Blomstra\Redis\Extend\Redis([
        'host' => '127.0.0.1',
        'password' => null,
        'port' => 6379,
        'database' => 1,
    ])
];

    Hari use different databases please. See the instructions.

    • Hari replied to this.

      luceos i have added this in extend.php file

      return [
          (new Blomstra\Redis\Extend\Redis([
              'host' => '127.0.0.1',
              'password' => null,
              'port' => 6379,
              'database' => 1,
          ]))
          ->useDatabaseWith('cache', 1)
          ->useDatabaseWith('queue', 2)
          ->useDatabaseWith('session', 3)
      ];

      if i run this command php flarum queue:work

      i am getting this result

      [2021-07-11 07:56:00][qByowZ3FOKSbh28b6wNoaYkztHZE9hBK] Processing: Flarum\Notification\Job\SendNotificationsJob
      [2021-07-11 07:56:00][qByowZ3FOKSbh28b6wNoaYkztHZE9hBK] Processed: Flarum\Notification\Job\SendNotificationsJob

      does this mean its working?

        Hari yes it is. Now you need to set the worker up as a daemon, using supervisor or systemd.

          Hari gb setup won't solve this. This step is required to have the queue process jobs in the background, unattended. To get this done it needs to run as a daemon, continuously and be restarted on failure. If you don't take care of this step, pending jobs will pile up without being processed.

            luceos I want to show cache pages to logged out users and spiders.

            Can I just go with redis cache without the quee and sessions? Will that requires daemon setup?

              Hari sessions and cache work perfectly fine without the queue. Make sure to use disable('queue') in your extend.php:

              return [
                  (new Blomstra\Redis\Extend\Redis([
                      'host' => '127.0.0.1',
                      'password' => null,
                      'port' => 6379,
                      'database' => 1,
                  ]))
                  ->useDatabaseWith('cache', 1)
                  ->useDatabaseWith('session', 3)
                  ->disable('queue')
              ];
              • Hari replied to this.

                Hari i don't have access, cloudways limit certain commands. its a long process to explain them regarding this. i will wait for GB setup

                If you don't have full access on the server because you have shared hosting, for example, then you can still use Redis Queue.
                What I did was to set up a cron for such a script:

                #set -x
                
                queue=`ps -aux | grep "flarum queue:work" | grep -v grep`
                if [[ -z $queue ]]; then
                while true :
                	do
                		[[ -z $queue ]] && { php flarum queue:work; }
                	done
                else
                exit 0
                fi

                When a process fails for some reason, cron will start it again.

                  luceos after updating this website is showing 500 error

                  rafaucau i do have access but its hard for me to setup daemon

                    luceos

                    edit : its working now - it happened due to cloudflare cache

                    edit2:

                    luceos This step is required to have the queue process jobs in the background, unattended. To get this done it needs to run as a daemon, continuously and be restarted on failure. If you don't take care of this step, pending jobs will pile up without being processed.

                    if i do not want queues i don't need deamon and need not to maintain anything right?

                      Hari if i do not want queues i don't need deamon

                      Correct. I can't answer the second question.

                      Hari I used this code to make it work.

                      Hari I am getting same output, so it means it is working. I have 1 database.

                      luceos I didn't add this, I get the think, but how can I do that, can you give me an example or clue so I can dig it.

                      • Hari replied to this.

                        sanwhere I didn't add this, I get the think, but how can I do that, can you give me an example or clue so I can dig it.

                        if you are a non-techqnical person ignore that step. (i have ignored) just go with below mentioned setup

                        return [
                            (new Blomstra\Redis\Extend\Redis([
                                'host' => '127.0.0.1',
                                'password' => null,
                                'port' => 6379,
                                'database' => 1,
                            ]))
                            ->useDatabaseWith('cache', 1)
                            ->useDatabaseWith('session', 3)
                            ->disable('queue')
                        ];

                        luceos To get this done it needs to run as a daemon, continuously and be restarted on failure. If you don't take care of this step, pending jobs will pile up without being processed.

                          Hari I am a technical person, I have a server and I am taking care of it. I would like to add it, otherwise it does not make any sense as @luceos said:

                          If you don't take care of this step, pending jobs will pile up without being processed.

                          @luceos

                          I tried to install it on flarum 15 using composer require blomstra/flarum-redis: ^ 0.2.4-beta
                          It installed successfully
                          Then i went inside public_html/vendor/blomstra/flarum-redis/extend.php

                          i updated it like this

                          return [
                              new Blomstra\Redis\Extend\Redis([
                                  'host' => '127.0.0.1',
                                  'password' => null,
                                  'port' => 6379,
                                  'database' => 1,
                              ])
                          ];

                          I activated it in admin panel and
                          then i run php flarum queue:work which i got this response There are no commands defined in the "queue" namespace.

                          I Ignored, and tried to surf my site but then it had already broken showing the HTTP/Server message. 😓

                          Inside storage/cache there were many folders populated

                          Maybe am missing something?

                          My flarum speed grade score is C. I want to make this one work and score A like @[deleted]

                            sanwhere after reinstalling it again and adding the code to flarum folder which is in public_html

                            I encountered HTTP ERROR 500

                            php flarum cache:clear and php flarum queue:work (became silent after http 500 error)

                              install supervisor with this command on your server:

                              sudo yum -y install supervisor (Cent-OS)

                              than run it and enable it on restart:

                              sudo systemctl start supervisord
                              sudo systemctl enable supervisord

                              add this after the last line of supervisord.conffile:

                              [program:any_name]
                              process_name=%(program_name)s_%(process_num)02d
                              command=php flarum queue:work sqs --sleep=3 --tries=3
                              directory=/path_to_flarum
                              autostart=true
                              autorestart=true
                              user=root
                              numprocs=1
                              redirect_stderr=true
                              stdout_logfile=/path_to_flarum/worker.log
                              stopwaitsecs=3600

                              after that, run this command:

                              systemctl restart supervisord

                              than this to see if it is active:

                              systemctl status supervisord

                              you can check the log file at /var/log/supervisor/supervisord.log and search for INFO success: at the last line. if you see that, supervisor is running and it will run your command on restart.

                              Braden did you add the lines exiting file or you created a new file?

                              exiting file need to be like below:

                              <?php
                              
                              /*
                               * This file is part of Flarum.
                               *
                               * (c) Toby Zerner <toby.zerner@gmail.com>
                               *
                               * For the full copyright and license information, please view the LICENSE
                               * file that was distributed with this source code.
                               */
                              
                              use Flarum\Extend;
                              
                              return [
                                  new Blomstra\Redis\Extend\Redis([
                                      'host' => '127.0.0.1',
                                      'password' => null,
                                      'port' => 6379,
                                      'database' => 1,
                                  ])
                              ];