Skip to content

Instantly share code, notes, and snippets.

@burnz
Forked from ankurk91/laravel_horizon.md
Created August 26, 2019 00:06
Show Gist options
  • Select an option

  • Save burnz/77c98e3e5e73f34078024c1a1d4bb6dd to your computer and use it in GitHub Desktop.

Select an option

Save burnz/77c98e3e5e73f34078024c1a1d4bb6dd to your computer and use it in GitHub Desktop.

Revisions

  1. @ankurk91 ankurk91 revised this gist May 17, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@
    **Install [redis-server](https://redis.io/)**
    * Using [PPA](https://launchpad.net/~chris-lea/+archive/ubuntu/redis-server) for latest version
    ```
    sudo add-apt-repository ppa:chris-lea/redis-server
    sudo add-apt-repository -y ppa:chris-lea/redis-server
    sudo apt-get update
    sudo apt-get install -y redis-server
    ```
  2. @ankurk91 ankurk91 revised this gist Apr 11, 2019. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,21 @@ redis-cli
    QUEUE_CONNECTION=redis
    ```
    * Note: other redis configurations are not need to be updated, the default host and port should work fine.
    * :warning: In order to auto-restart redis server upon reboot, you need to follow [this guide](https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04)
    * **Configure redis server**
    * To make redis-server autostart upon reboot,
    * Open file with `sudo nano /etc/redis/redis.conf`
    * Find `supervised` section and update its value from `no` to `systemd`
    * Save and exit the conf file.
    * Enable the service with this command
    ```
    sudo systemctl enable redis-server.service
    ```
    * Try restarting the service now.
    ```
    sudo systemctl status redis-server.service
    sudo systemctl restart redis-server.service
    ```
    * We are good now.

    **Install [supervisor](http://supervisord.org/)**
    ```
  3. @ankurk91 ankurk91 revised this gist Apr 11, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@
    ```
    sudo add-apt-repository ppa:chris-lea/redis-server
    sudo apt-get update
    sudo apt-get install redis-server
    sudo apt-get install -y redis-server
    ```
    * Test if `redis-server` is working, run
    ```
  4. @ankurk91 ankurk91 revised this gist Apr 11, 2019. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -8,11 +8,7 @@
    * For now it should show status as `inactive` on dashbaord

    **Install [redis-server](https://redis.io/)**
    * With default respositories (may get older version)
    ```
    sudo apt-get install redis-server
    ```
    * OR You can use [PPA](https://launchpad.net/~chris-lea/+archive/ubuntu/redis-server) for latest version
    * Using [PPA](https://launchpad.net/~chris-lea/+archive/ubuntu/redis-server) for latest version
    ```
    sudo add-apt-repository ppa:chris-lea/redis-server
    sudo apt-get update
  5. @ankurk91 ankurk91 revised this gist Mar 24, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ QUEUE_CONNECTION=redis
    ```
    sudo apt install supervisor
    sudo service supervisor restart
    sudo systemctl enable supervisord
    sudo systemctl enable supervisor
    ```

    **Create supervisor config for Horizon**
  6. @ankurk91 ankurk91 revised this gist Mar 17, 2019. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ sudo systemctl enable supervisord
    * Supervisor keeps its programs' individual files in `/etc/supervisor/conf.d`
    * Create a fresh config file for your Laravel application
    ```
    sudo nano /etc/supervisor/conf.d/your-app-name.conf
    sudo nano /etc/supervisor/conf.d/your-laravel-app.conf
    ```
    * and paste these lines into nano editor
    ```
    @@ -80,8 +80,7 @@ php artisan horizon:terminate
    ```
    sudo service supervisor restart
    ```
    OR
    * You can restart specific program
    * OR -You can restart specific program
    ```
    sudo supervisorctl restart laravel_horizon
    ```
  7. @ankurk91 ankurk91 revised this gist Mar 16, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -88,5 +88,4 @@ sudo supervisorctl restart laravel_horizon

    ### Resources
    * https://serversforhackers.com/c/monitoring-processes-with-supervisord
    * https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04
    * https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04
  8. @ankurk91 ankurk91 revised this gist Mar 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ redis-cli
    QUEUE_CONNECTION=redis
    ```
    * Note: other redis configurations are not need to be updated, the default host and port should work fine.
    * :warning: In order to auto-restart redis server upon reboot, you need to follow [this guide](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04)
    * :warning: In order to auto-restart redis server upon reboot, you need to follow [this guide](https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04)

    **Install [supervisor](http://supervisord.org/)**
    ```
  9. @ankurk91 ankurk91 revised this gist Mar 9, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Laravel Horizon, redis-server, supervisord on Ubuntu 16/18 server

    > Laravel 5.7, Horizon 1.4, Redis 5.x
    > Laravel 5.8, Horizon 3.x, Redis 5.x
    **Parepare application**
    * Install and configure Laravel Horizon as instructed in [docs](https://laravel.com/docs/horizon)
  10. @ankurk91 ankurk91 revised this gist Dec 28, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,7 @@ redis-cli
    QUEUE_CONNECTION=redis
    ```
    * Note: other redis configurations are not need to be updated, the default host and port should work fine.
    * :warning: In order to auto-restart redis server upon reboot, you need to follow [this guide](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04)

    **Install [supervisor](http://supervisord.org/)**
    ```
  11. @ankurk91 ankurk91 revised this gist Dec 28, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -86,4 +86,6 @@ sudo supervisorctl restart laravel_horizon
    ```

    ### Resources
    * https://serversforhackers.com/c/monitoring-processes-with-supervisord
    * https://serversforhackers.com/c/monitoring-processes-with-supervisord
    * https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04
    * https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04
  12. @ankurk91 ankurk91 revised this gist Dec 18, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -56,8 +56,8 @@ user=www-data
    stdout_logfile=/home/ubuntu/your-project-folder/storage/horizon.log
    ```
    * You need to update `your-project-folder` path in above config
    * Make sure `storage` folder is writable by `www-data` (apache) user
    * Save the config and exit `nano`
    * Make sure your project `storage` folder is writable by `www-data` (apache) user
    * Save the config file and exit `nano`
    * Now run these commands one by one -
    ```
    sudo supervisorctl reread
  13. @ankurk91 ankurk91 revised this gist Dec 11, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Laravel Horizon, redis-server, supervisord on Ubuntu 16/18 server

    > Laravel 5.7, Horizon 1.4, Redis 4.x
    > Laravel 5.7, Horizon 1.4, Redis 5.x
    **Parepare application**
    * Install and configure Laravel Horizon as instructed in [docs](https://laravel.com/docs/horizon)
  14. @ankurk91 ankurk91 revised this gist Dec 4, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -84,3 +84,6 @@ OR
    ```
    sudo supervisorctl restart laravel_horizon
    ```

    ### Resources
    * https://serversforhackers.com/c/monitoring-processes-with-supervisord
  15. @ankurk91 ankurk91 revised this gist Nov 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ redis-cli
    ```
    QUEUE_CONNECTION=redis
    ```
    * Note: other redis configurations no need to be updated, the default host and port should work fine.
    * Note: other redis configurations are not need to be updated, the default host and port should work fine.

    **Install [supervisor](http://supervisord.org/)**
    ```
  16. @ankurk91 ankurk91 revised this gist Nov 10, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Laravel Horizon, redis-server, supervisord on Ubuntu server
    ## Laravel Horizon, redis-server, supervisord on Ubuntu 16/18 server

    > Laravel 5.7, Horizon 1.4, redix 4.x
    > Laravel 5.7, Horizon 1.4, Redis 4.x
    **Parepare application**
    * Install and configure Laravel Horizon as instructed in [docs](https://laravel.com/docs/horizon)
  17. @ankurk91 ankurk91 revised this gist Nov 10, 2018. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    ## Laravel Horizon, redis-server, supervisord on Ubuntu server

    > Laravel 5.7, Horizon 1.4, redix 4.x
    **Parepare application**
    * Install and configure Laravel Horizon as instructed in [docs](https://laravel.com/docs/horizon)
    * Make sure you can access the Horizon dashboard like - `http://yourapp.com/horizon`
    @@ -25,7 +27,7 @@ redis-cli

    * Update your Laravel application `.env` file like this -
    ```
    QUEUE_DRIVER=redis
    QUEUE_CONNECTION=redis
    ```
    * Note: other redis configurations no need to be updated, the default host and port should work fine.

    @@ -66,9 +68,9 @@ sudo supervisorctl update
    sudo supervisorctl
    ```
    * You will see process name with status `RUNNING`, if not; it means you have misconfigured something.
    * Access your horizon dashboard at `http://yourapp.com/horizon`, you can see status as active in dashboard.
    * Access your horizon dashboard at `http://yourapp.com/horizon`, you can see status as `active` on dashboard.

    * Make sure to run these command after each new deployment
    * Make sure to run these commands after each new deployment
    ```
    php artisan horizon:purge
    php artisan horizon:terminate
  18. @ankurk91 ankurk91 revised this gist Nov 4, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -65,7 +65,7 @@ sudo supervisorctl update
    ```
    sudo supervisorctl
    ```
    * You will see process name with status `RUNNING`, if not it means you have misconfigured something.
    * You will see process name with status `RUNNING`, if not; it means you have misconfigured something.
    * Access your horizon dashboard at `http://yourapp.com/horizon`, you can see status as active in dashboard.

    * Make sure to run these command after each new deployment
  19. @ankurk91 ankurk91 revised this gist Sep 15, 2018. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ redis-cli
    ```
    QUEUE_DRIVER=redis
    ```
    * Note: other redis configurations no need to be updated, the default host and post should work fine.
    * Note: other redis configurations no need to be updated, the default host and port should work fine.

    **Install [supervisor](http://supervisord.org/)**
    ```
    @@ -53,7 +53,7 @@ redirect_stderr=true
    user=www-data
    stdout_logfile=/home/ubuntu/your-project-folder/storage/horizon.log
    ```
    * You need to update project folder path in above config
    * You need to update `your-project-folder` path in above config
    * Make sure `storage` folder is writable by `www-data` (apache) user
    * Save the config and exit `nano`
    * Now run these commands one by one -
    @@ -65,8 +65,8 @@ sudo supervisorctl update
    ```
    sudo supervisorctl
    ```
    * You will see process name with `RUNNING` status, if not it means you have misconfigured something.
    * Access your horizon dashboard at `http://yourapp.com/horizon` , you can see status as active n dashboard.
    * You will see process name with status `RUNNING`, if not it means you have misconfigured something.
    * Access your horizon dashboard at `http://yourapp.com/horizon`, you can see status as active in dashboard.

    * Make sure to run these command after each new deployment
    ```
  20. @ankurk91 ankurk91 revised this gist Sep 1, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -77,4 +77,8 @@ php artisan horizon:terminate
    ```
    sudo service supervisor restart
    ```

    OR
    * You can restart specific program
    ```
    sudo supervisorctl restart laravel_horizon
    ```
  21. @ankurk91 ankurk91 revised this gist Sep 1, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,7 @@ QUEUE_DRIVER=redis
    ```
    sudo apt install supervisor
    sudo service supervisor restart
    sudo systemctl enable supervisord
    ```

    **Create supervisor config for Horizon**
  22. @ankurk91 ankurk91 revised this gist Sep 1, 2018. 1 changed file with 20 additions and 7 deletions.
    27 changes: 20 additions & 7 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,9 @@
    ### Laravel Horizon, redis-server, supervisord on Ubuntu server
    ## Laravel Horizon, redis-server, supervisord on Ubuntu server

    **Parepare application**
    * Install and configure Laravel Horizon as instructed in [docs](https://laravel.com/docs/horizon)
    * Make sure you can access the Horizon dashboard like - `http://yourapp.com/horizon`
    * For now it should show status as `inactive` on dashbaord

    **Install [redis-server](https://redis.io/)**
    * With default respositories (may get older version)
    @@ -22,6 +23,12 @@ redis-cli
    * Type `ping` and you will recieve `PONG` in response
    * Type `exit` to exit the CLI

    * Update your Laravel application `.env` file like this -
    ```
    QUEUE_DRIVER=redis
    ```
    * Note: other redis configurations no need to be updated, the default host and post should work fine.

    **Install [supervisor](http://supervisord.org/)**
    ```
    sudo apt install supervisor
    @@ -30,11 +37,11 @@ sudo service supervisor restart

    **Create supervisor config for Horizon**
    * Supervisor keeps its programs' individual files in `/etc/supervisor/conf.d`
    * Create a fresh config for your laravel application
    * Create a fresh config file for your Laravel application
    ```
    sudo nano /etc/supervisor/conf.d/your-app-name.conf
    ```
    * and paste these lines
    * and paste these lines into nano editor
    ```
    [program:laravel_horizon]
    process_name=%(program_name)s_%(process_num)02d
    @@ -47,7 +54,7 @@ stdout_logfile=/home/ubuntu/your-project-folder/storage/horizon.log
    ```
    * You need to update project folder path in above config
    * Make sure `storage` folder is writable by `www-data` (apache) user
    * Save the config and exit nano
    * Save the config and exit `nano`
    * Now run these commands one by one -
    ```
    sudo supervisorctl reread
    @@ -58,9 +65,15 @@ sudo supervisorctl update
    sudo supervisorctl
    ```
    * You will see process name with `RUNNING` status, if not it means you have misconfigured something.
    * Update your Laravel application `.env` like this -
    * Access your horizon dashboard at `http://yourapp.com/horizon` , you can see status as active n dashboard.

    * Make sure to run these command after each new deployment
    ```
    QUEUE_DRIVER=redis
    php artisan horizon:purge
    php artisan horizon:terminate
    ```
    * If you face any issue, you can restart supervisor service
    ```
    sudo service supervisor restart
    ```
    * Access your horizon dashboard at `http://yourapp.com/horizon` , you can see status as active.

  23. @ankurk91 ankurk91 revised this gist Aug 23, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ redis-cli
    * Type `ping` and you will recieve `PONG` in response
    * Type `exit` to exit the CLI

    **Install [supervisord](http://supervisord.org/)**
    **Install [supervisor](http://supervisord.org/)**
    ```
    sudo apt install supervisor
    sudo service supervisor restart
    @@ -32,7 +32,7 @@ sudo service supervisor restart
    * Supervisor keeps its programs' individual files in `/etc/supervisor/conf.d`
    * Create a fresh config for your laravel application
    ```
    sudo nano /etc/supervisor/conf.d/your-app.conf
    sudo nano /etc/supervisor/conf.d/your-app-name.conf
    ```
    * and paste these lines
    ```
  24. @ankurk91 ankurk91 revised this gist Aug 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -62,5 +62,5 @@ sudo supervisorctl
    ```
    QUEUE_DRIVER=redis
    ```
    * Access your horizon dashboard, you can see status as active.
    * Access your horizon dashboard at `http://yourapp.com/horizon` , you can see status as active.

  25. @ankurk91 ankurk91 created this gist Aug 23, 2018.
    66 changes: 66 additions & 0 deletions laravel_horizon.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    ### Laravel Horizon, redis-server, supervisord on Ubuntu server

    **Parepare application**
    * Install and configure Laravel Horizon as instructed in [docs](https://laravel.com/docs/horizon)
    * Make sure you can access the Horizon dashboard like - `http://yourapp.com/horizon`

    **Install [redis-server](https://redis.io/)**
    * With default respositories (may get older version)
    ```
    sudo apt-get install redis-server
    ```
    * OR You can use [PPA](https://launchpad.net/~chris-lea/+archive/ubuntu/redis-server) for latest version
    ```
    sudo add-apt-repository ppa:chris-lea/redis-server
    sudo apt-get update
    sudo apt-get install redis-server
    ```
    * Test if `redis-server` is working, run
    ```
    redis-cli
    ```
    * Type `ping` and you will recieve `PONG` in response
    * Type `exit` to exit the CLI

    **Install [supervisord](http://supervisord.org/)**
    ```
    sudo apt install supervisor
    sudo service supervisor restart
    ```

    **Create supervisor config for Horizon**
    * Supervisor keeps its programs' individual files in `/etc/supervisor/conf.d`
    * Create a fresh config for your laravel application
    ```
    sudo nano /etc/supervisor/conf.d/your-app.conf
    ```
    * and paste these lines
    ```
    [program:laravel_horizon]
    process_name=%(program_name)s_%(process_num)02d
    command=php /home/ubuntu/your-project-folder/artisan horizon
    autostart=true
    autorestart=true
    redirect_stderr=true
    user=www-data
    stdout_logfile=/home/ubuntu/your-project-folder/storage/horizon.log
    ```
    * You need to update project folder path in above config
    * Make sure `storage` folder is writable by `www-data` (apache) user
    * Save the config and exit nano
    * Now run these commands one by one -
    ```
    sudo supervisorctl reread
    sudo supervisorctl update
    ```
    * Check if our horizon process is running
    ```
    sudo supervisorctl
    ```
    * You will see process name with `RUNNING` status, if not it means you have misconfigured something.
    * Update your Laravel application `.env` like this -
    ```
    QUEUE_DRIVER=redis
    ```
    * Access your horizon dashboard, you can see status as active.