In the previous article, we wrote about how to deploy Laravel applications with Docker. In this article, we will write about how to deploy Laravel applications with queues and task scheduling. 1. Let's first prepare our docker/app.cron file Note that the blank line at the end of the file is required. #!/usr/bin/env bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin * * * * * cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1 2. Create a new entry file: docker-entrypoint-queue.sh Note that this file requires execute permissions. #!/usr/bin/env bash php artisan cache:clear php artisan config:cache php artisan route:cache php artisan view:cache # Load the scheduled task and restart cron crontab docker/app.cron /etc/init.d/cron restart # Execute queue php artisan queue:work --timeout=60 3. This time we use docker compose to run the program: ./docker-compose.yml version: "3.4" services: API: build: . image: moorper/example-laravel networks: -frontend - backend environment: - APP_ENV=development ports: - "80:80" entrypoint: ./docker-entrypoint.sh queue: build: . image: moorper/example-laravel networks: - backend environment: - APP_ENV=development entrypoint: ./docker-script-entrypoint.sh networks: frontend: backend: 4. Operation docker-compose up -d The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: MySQL 5.7.20 installation and configuration method graphic tutorial (win10)
>>: Vue recursively implements three-level menu
First, let’s take a look at the picture: Today we...
Preface Programming languages usually contain v...
This article shares with you a uniform motion imp...
The virtual machine is in use or cannot be connec...
Table of contents Configuration nfs server (nfs.s...
zabbix Zabbix ([`zæbiks]) is an enterprise-level ...
Today I found this prompt when I was running and ...
Table of contents definition structure Examples C...
MySQL slow query, whose full name is slow query l...
MySQL installation (4, 5, 6 can be omitted) State...
A WeakMap object is a collection of key/value pai...
Real-time replication is the most important way t...
As the number of visits increases, for some time-...
This article takes Centos7.6 system and Oracle11g...
Ubuntu 15.04 opens MySQL remote port 3306. All th...