{"id":3941,"date":"2024-04-01T14:35:15","date_gmt":"2024-04-01T14:35:15","guid":{"rendered":"https:\/\/code2deploy.com\/blog\/?p=3941"},"modified":"2024-04-01T16:17:26","modified_gmt":"2024-04-01T16:17:26","slug":"setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster","status":"publish","type":"post","link":"https:\/\/code2deploy.com\/blog\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/","title":{"rendered":"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Index:&nbsp;<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>On BareMetal Servers<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Installing Supervisor<\/li>\n\n\n\n<li>Creating a Supervisor Configuration File<\/li>\n\n\n\n<li>Reloading Supervisor<\/li>\n\n\n\n<li>Accessing Supervisor Web Interface<\/li>\n\n\n\n<li>Restarting Supervisor<\/li>\n\n\n\n<li>Accessing Supervisor Web Interface<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>On the Containerized Qjob solution in Docker\u00a0<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a Dockerfile for Your Laravel Application<\/li>\n\n\n\n<li>Create a Supervisor Configuration File<\/li>\n\n\n\n<li>Build the\u00a0 Docker Image<\/li>\n\n\n\n<li>Create a Docker Compose File (Optional)<\/li>\n\n\n\n<li>Run Your Containers with composer\u00a0<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>On Kubernetes Cluster&nbsp;<\/strong><\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a Dockerfile for the Supervisor<\/li>\n\n\n\n<li>Create Supervisor Configuration (Optional)<\/li>\n\n\n\n<li>\u00a0Build the Docker Image<\/li>\n\n\n\n<li>Push the Docker Image (Optional)<\/li>\n\n\n\n<li>Use the Docker Image<\/li>\n\n\n\n<li>Update Kubernetes Deployment YAML<\/li>\n\n\n\n<li>Deploy to Kubernetes<\/li>\n\n\n\n<li>Accessing Supervisor Web Interface (Optional)<\/li>\n\n\n\n<li>Monitoring and Logging<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Supervisord is an invaluable tool for managing processes in Ubuntu systems, particularly useful for running long-running tasks like Laravel queue workers. In this comprehensive guide, we&#8217;ll walk you through the steps to set up Supervisord for Laravel queue jobs on Ubuntu, along with accessing Supervisor&#8217;s web interface for easier management.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>On BareMetal Servers<\/strong><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Installing SupervisorD<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Firstly, let&#8217;s install SupervisorD on your Ubuntu system. Open your terminal and run the following commands:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>sudo apt-get update<br>sudo apt-get install supervisor<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Creating a Supervisor Configuration File<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s create a configuration file for the Supervisor. We&#8217;ll create a default configuration for a Laravel queue worker. Run the following command to create the configuration file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>sudo nano \/etc\/supervisor\/conf.d\/laravel-worker.conf<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Paste the following configuration into the file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>[program:laravel-worker]<br>process_name=%(program_name)s_%(process_num)02d<br>command=php \/path\/to\/your\/laravel\/project\/artisan queue:work &#8211;sleep=3 &#8211;tries=3<br>autostart=true<br>autorestart=true<br>user=www-data<br>numprocs=1<br>redirect_stderr=true<br>stdout_logfile=\/var\/log\/laravel-worker.log<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure to replace <strong>\/path\/to\/your\/laravel\/project <\/strong>with the actual path to your Laravel project. This configuration sets up a Laravel queue worker process with specified options.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save and exit the editor by pressing Ctrl + X, then Y, and finally Enter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Configuration Description:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">[program:laravel-worker]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; process_name=%(program_name)s_%(process_num)02d<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;#This line defines the naming pattern for the worker processes. It uses the format `%(program_name)s_%(process_num)02d`, where `%(program_name)s` represents the program name (`laravel-worker` in this case), and `%(process_num)02d` pads the process number with leading zeros to ensure consistent naming.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; command=php \/path\/to\/your\/laravel\/project\/artisan queue:work &#8211;sleep=3 &#8211;tries=3<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;#This line specifies the command that Supervisor should execute to start the worker process. It runs the `queue:work` Artisan command for your Laravel application, with specific options such as `&#8211;sleep` (sleep time between jobs) and `&#8211;tries` (maximum number of attempts per job).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; autostart=true<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;#This line indicates that the program should be started automatically when the Supervisor starts. Setting it to `true` ensures that the Laravel worker process is automatically started upon system boot or Supervisor restart.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; autorestart=true<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;#This line indicates that the program should be automatically restarted if it exits unexpectedly. Setting it to `true` ensures that Supervisor will monitor and automatically restart the Laravel worker process if it terminates unexpectedly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; user=www-data<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># This line specifies the user account under which the Laravel worker process should run. In this case, it&#8217;s set to `www-data`, which is a common user for web server processes in Ubuntu.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; numprocs=1<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># This line specifies the number of processes that the Supervisor should spawn for this program. It&#8217;s set to `1`, indicating that only one instance of the Laravel worker process will be managed by the Supervisor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; redirect_stderr=true<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;#This line tells the Supervisor to redirect standard error (stderr) output to the specified log file. By setting it to `true`, any error messages generated by the Laravel worker process will be logged.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>&#8211; stdout_logfile=\/var\/log\/laravel-worker.log<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># This line specifies the file where standard output (stdout) should be logged. It sets the path to `\/var\/log\/laravel-worker.log`, meaning any output produced by the Laravel worker process will be logged to this file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These descriptions provide a clear understanding of each line&#8217;s purpose and functionality within the Supervisor configuration for the Laravel worker process.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Reloading Supervisor<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After creating the Supervisor configuration file, you need to reload Supervisor to apply the changes. Run the following commands:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>sudo supervisorctl reread<br>sudo supervisorctl update<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Accessing Supervisor Web Interface<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s set up access to the Supervisor&#8217;s web interface for easier management. First, you need to enable the web interface by editing the Supervisor configuration file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>sudo nano \/etc\/supervisor\/supervisord.conf<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Find the [inet_http_server] section and make sure it looks like this:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>[inet_http_server]<br>port = 127.0.0.1:9001<br>username = user<br>password = pass<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the user and pass with your desired username and password. Save and exit the editor.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Restarting Supervisor<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the Supervisor to apply the changes:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>sudo service supervisor restart<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 6: Accessing Supervisor Web Interface<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, open your web browser and navigate to<strong> http:\/\/127.0.0.1:9001<\/strong>. You&#8217;ll be prompted to enter the username and password you specified earlier. Once logged in, you&#8217;ll have access to the Supervisor web interface, where you can manage processes, view logs, and more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it! You&#8217;ve successfully set up Laravel Supervisor for queue jobs in Ubuntu and accessed Supervisor&#8217;s web interface for easier management. Enjoy the seamless execution of your Laravel queue workers.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>On Container solution Docker&nbsp;<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If you use Docker then follow the below step.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s how you can set up a Docker container that runs both your Laravel application and Supervisor to manage Laravel queue workers:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Create a Dockerfile for Your Laravel Application<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ex Dockerfile<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td># Use the official PHP image as the base image<br>FROM php:8.0-apache<br><br># Install dependencies<br>RUN apt-get update &amp;&amp; apt-get install -y \\<br>supervisor \\<br>&amp;&amp; rm -rf \/var\/lib\/apt\/lists\/*<br><br># Copy your Laravel application files into the container<br>COPY . \/var\/www\/html<br><br># Set up Apache configurations (if needed)<br># COPY apache.conf \/etc\/apache2\/sites-available\/000-default.conf<br><br># Expose port 80<br>EXPOSE 80<br><br># Start Apache server<br>CMD [&#8220;apache2-foreground&#8221;]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Create a Supervisor Configuration File<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a Supervisor configuration file named laravel-worker.conf:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>[program:laravel-worker]<br>process_name=%(program_name)s_%(process_num)02d<br>command=php \/var\/www\/html\/artisan queue:work &#8211;sleep=3 &#8211;tries=3<br>autostart=true<br>autorestart=true<br>user=www-data<br>numprocs=1<br>redirect_stderr=true<br>stdout_logfile=\/var\/log\/laravel-worker.log<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Build Your Docker Image<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Build your Docker image using the Dockerfile:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>docker build -t your-laravel-image .<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Create a Docker Compose File (Optional)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer using Docker Compose for managing your containers, you can create a docker-compose.yml file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>version: &#8216;3&#8217;<br>services:<br>laravel-app:<br>build: .<br>ports:<br>&#8211; &#8220;8080:80&#8221;<br>volumes:<br>&#8211; .:\/var\/www\/html<br>depends_on:<br>&#8211; supervisor<br><br>supervisor:<br>image: your-laravel-image<br>command: supervisord -c \/etc\/supervisor\/conf.d\/supervisord.conf<br>volumes:<br>&#8211; .\/laravel-worker.conf:\/etc\/supervisor\/conf.d\/laravel-worker.conf<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Run Your Containers<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run your containers using either docker run or docker-compose up:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>docker run -d &#8211;name laravel-container your-laravel-image<br>docker run -d &#8211;name supervisor-container &#8211;volumes-from laravel-container your-laravel-image supervisord -c \/etc\/supervisor\/conf.d\/supervisord.conf<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Or with Docker Compose:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>docker-compose up -d<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This setup will create a Docker container running your Laravel application and another container running Supervisor to manage Laravel queue workers. The Supervisor configuration file (laravel-worker.conf) is mounted into the Supervisor container so that it can manage the Laravel queue worker process.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>On-Kubernetes Cluster&nbsp;<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s integrate the Supervisor Docker image into the Kubernetes deployment YAML file for managing Laravel queue workers. Below is an example of how you can achieve this:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To create a Docker image for Supervisor, you can create a Dockerfile with the necessary configurations to install Supervisor and any additional dependencies. Here&#8217;s a basic example of how you can create a Docker image for Supervisor:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Create a Dockerfile for the Supervisor&nbsp;<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a file named Dockerfile with the following content:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dockerfile<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td># Use an appropriate base image<br>FROM ubuntu:latest<br><br># Install Supervisor<br>RUN apt-get update &amp;&amp; apt-get install -y supervisor<br><br># Copy Supervisor configuration files<br>COPY supervisord.conf \/etc\/supervisor\/conf.d\/supervisord.conf<br><br># Expose the port for Supervisor web interface (optional)<br>EXPOSE 9001<br><br># Start Supervisor<br>CMD [&#8220;supervisord&#8221;, &#8220;-c&#8221;, &#8220;\/etc\/supervisor\/conf.d\/supervisord.conf&#8221;]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Create Supervisor Configuration (Optional)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you have custom configurations for supervisors, such as managing Laravel queue workers, you can create a SupervisorD.conf file and place it in the same directory as your Dockerfile. Here&#8217;s a basic example:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><br>[supervisord]<br>nodaemon=true<br><br>[program:laravel-worker]<br>command=php \/path\/to\/your\/laravel\/project\/artisan queue:work &#8211;sleep=3 &#8211;tries=3<br>autostart=true<br>autorestart=true<br>user=www-data<br>numprocs=1<br>redirect_stderr=true<br>stdout_logfile=\/var\/log\/laravel-worker.log<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <strong>\/path\/to\/your\/laravel\/project<\/strong> with the actual path to your Laravel project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Build the Docker Image<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the directory containing your Dockerfile and Supervisor configuration file, then build the Docker image:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>docker build -t your-supervisor-image .<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Push the Docker Image (Optional)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to use this Docker image in other environments or share it with others, you can push it to a Docker registry:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>docker push your-supervisor-image<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Use the Docker Image<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now you can use this Docker image to run Supervisor in your Kubernetes cluster or any other Docker environment. You can deploy it as a separate container or include it in your existing Docker-compose setup.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Note:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Make sure to customize the Dockerfile and Supervisor configuration according to your specific requirements and environment.<\/li>\n\n\n\n<li>Ensure that any necessary dependencies for the Supervisor and your application are installed in the Docker image.<\/li>\n\n\n\n<li>You may need to adjust security settings and user permissions based on your application&#8217;s requirements and best practices.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Update Kubernetes Deployment YAML<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Modify your Kubernetes Deployment YAML file to include the Supervisor container alongside your Laravel application container:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>apiVersion: apps\/v1<br>kind: Deployment<br>metadata:<br>name: laravel-app<br>spec:<br>replicas: 1<br>selector:<br>matchLabels:<br>app: laravel-app<br>template:<br>metadata:<br>labels:<br>app: laravel-app<br>spec:<br>containers:<br>&#8211; name: laravel-app<br>image: your-laravel-image<br>ports:<br>&#8211; containerPort: 80<br># Add other settings like environment variables, volumes, etc.<br>&#8211; name: supervisor<br>image: your-supervisor-image<br>command: [&#8220;supervisord&#8221;, &#8220;-c&#8221;, &#8220;\/etc\/supervisor\/conf.d\/supervisord.conf&#8221;]<br>ports:<br>&#8211; containerPort: 9001<br># Add other settings like volumes, environment variables, etc.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 6: Deploy to Kubernetes<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apply the updated Kubernetes Deployment YAML file to your Kubernetes cluster:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>kubectl apply -f your-deployment.yaml<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 7: Accessing Supervisor Web Interface (Optional)<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to access the Supervisor web interface from outside the Kubernetes cluster, you need to expose it using a Kubernetes Service and possibly an Ingress resource for external access. Below is an example of how you can expose the Supervisor web interface:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>apiVersion: v1<br>kind: Service<br>metadata:<br>name: supervisor-service<br>spec:<br>selector:<br>app: supervisor<br>ports:<br>&#8211; protocol: TCP<br>port: 9001<br>targetPort: 9001<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Apply the Service YAML file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>kubectl apply -f your-service.yaml<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 8: Monitoring and Logging<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Configure monitoring and logging solutions in your Kubernetes cluster to monitor the performance and health of your Laravel application and Supervisor, including the Laravel queue workers managed by the Supervisor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With these steps, you can deploy both your Laravel application and Supervisor for managing Laravel queue workers in a Kubernetes environment. Adjust the configurations and settings as needed to fit your specific requirements and environment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker and Kubernetes Cluster\u00a0<\/p>\n","protected":false},"author":1,"featured_media":3942,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,457,219,22],"tags":[455,456,453,454],"class_list":["post-3941","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-containerization-docker","category-cron-and-qjob","category-deployment","category-web-hositing","tag-containerized-qjob-solution-in-docker","tag-laravel-queue-with-supervisor","tag-laravel-supervisor","tag-queue-jobs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0 - code2deploy.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0 - code2deploy.com\" \/>\n<meta property=\"og:description\" content=\"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker and Kubernetes Cluster\u00a0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/\" \/>\n<meta property=\"og:site_name\" content=\"code2deploy.com\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-01T14:35:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-01T16:17:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.code2deploy.com\/wp-content\/uploads\/2024\/04\/Laravel-queue-with-supervisor-jpg.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"675\" \/>\n\t<meta property=\"og:image:height\" content=\"464\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"enam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"enam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/\"},\"author\":{\"name\":\"enam\",\"@id\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/#\\\/schema\\\/person\\\/e46930c19b999a87f12566fa8357481b\"},\"headline\":\"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0\",\"datePublished\":\"2024-04-01T14:35:15+00:00\",\"dateModified\":\"2024-04-01T16:17:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/\"},\"wordCount\":1789,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/#\\\/schema\\\/person\\\/e46930c19b999a87f12566fa8357481b\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/Laravel-queue-with-supervisor-jpg.webp\",\"keywords\":[\"Containerized Qjob solution in Docker\",\"Laravel queue with supervisor\",\"Laravel Supervisor\",\"Queue Jobs\"],\"articleSection\":[\"Containerization\",\"Cron and QJob\",\"Deployment\",\"Web Hositing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/\",\"url\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/\",\"name\":\"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0 - code2deploy.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/Laravel-queue-with-supervisor-jpg.webp\",\"datePublished\":\"2024-04-01T14:35:15+00:00\",\"dateModified\":\"2024-04-01T16:17:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#primaryimage\",\"url\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/Laravel-queue-with-supervisor-jpg.webp\",\"contentUrl\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/Laravel-queue-with-supervisor-jpg.webp\",\"width\":675,\"height\":464,\"caption\":\"Laravel queue with supervisor\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.code2deploy.com\\\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/\",\"name\":\"code2deploy.com\\\/blog\",\"description\":\"TechOps\",\"publisher\":{\"@id\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/#\\\/schema\\\/person\\\/e46930c19b999a87f12566fa8357481b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/#\\\/schema\\\/person\\\/e46930c19b999a87f12566fa8357481b\",\"name\":\"enam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g\",\"caption\":\"enam\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g\"},\"sameAs\":[\"https:\\\/\\\/code2deploy.com\\\/blog\"],\"url\":\"https:\\\/\\\/code2deploy.com\\\/blog\\\/author\\\/enam\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0 - code2deploy.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/","og_locale":"en_US","og_type":"article","og_title":"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0 - code2deploy.com","og_description":"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker and Kubernetes Cluster\u00a0","og_url":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/","og_site_name":"code2deploy.com","article_published_time":"2024-04-01T14:35:15+00:00","article_modified_time":"2024-04-01T16:17:26+00:00","og_image":[{"width":675,"height":464,"url":"https:\/\/blog.code2deploy.com\/wp-content\/uploads\/2024\/04\/Laravel-queue-with-supervisor-jpg.webp","type":"image\/jpeg"}],"author":"enam","twitter_card":"summary_large_image","twitter_misc":{"Written by":"enam","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#article","isPartOf":{"@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/"},"author":{"name":"enam","@id":"https:\/\/code2deploy.com\/blog\/#\/schema\/person\/e46930c19b999a87f12566fa8357481b"},"headline":"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0","datePublished":"2024-04-01T14:35:15+00:00","dateModified":"2024-04-01T16:17:26+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/"},"wordCount":1789,"commentCount":2,"publisher":{"@id":"https:\/\/code2deploy.com\/blog\/#\/schema\/person\/e46930c19b999a87f12566fa8357481b"},"image":{"@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#primaryimage"},"thumbnailUrl":"https:\/\/code2deploy.com\/blog\/wp-content\/uploads\/2024\/04\/Laravel-queue-with-supervisor-jpg.webp","keywords":["Containerized Qjob solution in Docker","Laravel queue with supervisor","Laravel Supervisor","Queue Jobs"],"articleSection":["Containerization","Cron and QJob","Deployment","Web Hositing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/","url":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/","name":"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0 - code2deploy.com","isPartOf":{"@id":"https:\/\/code2deploy.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#primaryimage"},"image":{"@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#primaryimage"},"thumbnailUrl":"https:\/\/code2deploy.com\/blog\/wp-content\/uploads\/2024\/04\/Laravel-queue-with-supervisor-jpg.webp","datePublished":"2024-04-01T14:35:15+00:00","dateModified":"2024-04-01T16:17:26+00:00","breadcrumb":{"@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#primaryimage","url":"https:\/\/code2deploy.com\/blog\/wp-content\/uploads\/2024\/04\/Laravel-queue-with-supervisor-jpg.webp","contentUrl":"https:\/\/code2deploy.com\/blog\/wp-content\/uploads\/2024\/04\/Laravel-queue-with-supervisor-jpg.webp","width":675,"height":464,"caption":"Laravel queue with supervisor"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.code2deploy.com\/setting-up-laravel-supervisor-for-queue-jobs-in-ubuntu-docker-and-kubernetes-cluster\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code2deploy.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Setting Up Laravel Supervisor for Queue Jobs in Ubuntu, Docker, and Kubernetes Cluster\u00a0"}]},{"@type":"WebSite","@id":"https:\/\/code2deploy.com\/blog\/#website","url":"https:\/\/code2deploy.com\/blog\/","name":"code2deploy.com\/blog","description":"TechOps","publisher":{"@id":"https:\/\/code2deploy.com\/blog\/#\/schema\/person\/e46930c19b999a87f12566fa8357481b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/code2deploy.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/code2deploy.com\/blog\/#\/schema\/person\/e46930c19b999a87f12566fa8357481b","name":"enam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g","caption":"enam"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/d864e2f082f4499f8f1b33f004ec166eea77b9e94738553b120b6dca2410f203?s=96&d=mm&r=g"},"sameAs":["https:\/\/code2deploy.com\/blog"],"url":"https:\/\/code2deploy.com\/blog\/author\/enam\/"}]}},"_links":{"self":[{"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/posts\/3941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/comments?post=3941"}],"version-history":[{"count":1,"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/posts\/3941\/revisions"}],"predecessor-version":[{"id":3943,"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/posts\/3941\/revisions\/3943"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/media\/3942"}],"wp:attachment":[{"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/media?parent=3941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/categories?post=3941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code2deploy.com\/blog\/wp-json\/wp\/v2\/tags?post=3941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}