Laravel 8.x (LaRaBBS) is deployed to Alibaba Cloud ECS, based on MySQL, Redis, Supervisor, crontab implementation
1. Laravel 8.x (LaraBBS) has been implemented in the local development environment. as shown in Figure 1
2. Based on Xshell 7, log in to Alibaba Cloud ECS. View the operating system version. List all version information, execute the command: lsb_release -a. Version: CentOS 7.7. as shown in Figure 2
[root@iZ23wv7v5ggZ ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.7.1908 (Core)
Release: 7.7.1908
Codename: Core
3. Reference URL:https://oneinstack.com/, which is deployed based on OneInstack. Because this ECS has already deployed websites based on OneInstack before. Therefore, some steps will be skipped. Create a snapshot backup of the cloud disk in advance, just in case it causes data loss. as shown in Figure 3
4. It is recommended to start operating ECS after the snapshot progress is equal to 100%, that is, after the status is successful. as shown in Figure 4
5. A URL that has been successfully deployed on ECS:https://www.shuijingwanwq.com/. Reference URL:https://www.shuijingwanwq.com/2016/04/25/1050/
6. Directory: /root/oneinstack already exists. as shown in Figure 5
7. Check the current PHP version: 7.4. as shown in Figure 6
[root@iZ23wv7v5ggZ oneinstack]# php -v
PHP 7.4.0 (cli) (built: Dec 5 2019 11:56:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies
8. Upgrade the script tool without affecting the running environment. Execute the command: /upgrade.sh –oneinstack. as shown in Figure 7
[root@iZ23wv7v5ggZ oneinstack]# ./upgrade.sh --oneinstack
#######################################################################
# OneinStack for CentOS/RedHat 6+ Debian 8+ and Ubuntu 14+ #
# Upgrade Software versions for OneinStack #
# For more information please visit https://oneinstack.com #
#######################################################################
Congratulations! OneinStack upgrade successful!
[root@iZ23wv7v5ggZ oneinstack]#
9. Reference URL:https://oneinstack.com/install/, add a virtual host, execute the command: ./vhost.sh. Error: Error: create lets encrypt ssl certificate failed! . The reason is that there are no corresponding DNS records. as shown in Figure 8
[root@iZ23wv7v5ggZ oneinstack]# ./vhost.sh
#######################################################################
# OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+ #
# For more information please visit https://oneinstack.com #
#######################################################################
What Are You Doing?
1. Use HTTP Only
2. Use your own SSL Certificate and Key
3. Use Let's Encrypt to Create SSL Certificate and Key
q. Exit
Please input the correct option: 3
Please input domain(example: www.example.com): app-wangqiang-larabbs.shuijingwanwq.com
domain=app-wangqiang-larabbs.shuijingwanwq.com
Please input the directory for the domain:app-wangqiang-larabbs.shuijingwanwq.com :
(Default directory: /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com):
Virtual Host Directory=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com
Create Virtul Host directory......
set permissions of Virtual Host directory......
Do you want to add more domain name? [y/n]: n
Do you want to redirect all HTTP requests to HTTPS? [y/n]: y
Please enter your email: shuijingwanwq@163.com
[Fri Jan 7 10:36:05 CST 2022] Unknown parameter : -m
Let's Encrypt Verify error! DNS problem: NXDOMAIN looking up A for app-wangqiang-larabbs.shuijingwanwq.com
[Fri Jan 7 10:36:10 CST 2022] Creating domain key
[Fri Jan 7 10:36:10 CST 2022] The domain key is here: /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/app-wangqiang-larabbs.shuijingwanwq.com.key
[Fri Jan 7 10:36:10 CST 2022] Single domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan 7 10:36:10 CST 2022] Getting domain auth token for each domain
[Fri Jan 7 10:36:14 CST 2022] Getting webroot for domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan 7 10:36:15 CST 2022] Verifying: app-wangqiang-larabbs.shuijingwanwq.com
[Fri Jan 7 10:36:19 CST 2022] app-wangqiang-larabbs.shuijingwanwq.com:Verify error:DNS problem: NXDOMAIN looking up A for app-wangqiang-larabbs.shuijingwanwq.com - check that a DNS record exists for this domain
[Fri Jan 7 10:36:19 CST 2022] Please add '--debug' or '--log' to check more details.
[Fri Jan 7 10:36:19 CST 2022] See: https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh
Error: Create Let's Encrypt SSL Certificate failed!
[root@iZ23wv7v5ggZ oneinstack]#
10. Check whether there is a DNS record in this domain. First add the corresponding domain name in DNS: app-wangqiang-larabbs.shuijingwanwq.com . as shown in Figure 9
11. Execute the command again: ./vhost.sh. Added virtual host successfully. As shown in Figure 10
[root@iZ23wv7v5ggZ oneinstack]# ./vhost.sh
#######################################################################
# OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+ #
# For more information please visit https://oneinstack.com #
#######################################################################
What Are You Doing?
1. Use HTTP Only
2. Use your own SSL Certificate and Key
3. Use Let's Encrypt to Create SSL Certificate and Key
q. Exit
Please input the correct option: 3
Please input domain(example: www.example.com): app-wangqiang-larabbs.shuijingwanwq.com
domain=app-wangqiang-larabbs.shuijingwanwq.com
Please input the directory for the domain:app-wangqiang-larabbs.shuijingwanwq.com :
(Default directory: /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com):
Virtual Host Directory=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com
Create Virtul Host directory......
set permissions of Virtual Host directory......
Do you want to add more domain name? [y/n]: n
Do you want to redirect all HTTP requests to HTTPS? [y/n]: y
Please enter your email: shuijingwanwq@163.com
[Fri Jan 7 10:48:20 CST 2022] Unknown parameter : -m
[Fri Jan 7 10:48:24 CST 2022] Single domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan 7 10:48:24 CST 2022] Getting domain auth token for each domain
[Fri Jan 7 10:48:29 CST 2022] Getting webroot for domain='app-wangqiang-larabbs.shuijingwanwq.com'
[Fri Jan 7 10:48:29 CST 2022] Verifying: app-wangqiang-larabbs.shuijingwanwq.com
[Fri Jan 7 10:48:34 CST 2022] Success
[Fri Jan 7 10:48:34 CST 2022] Verify finished, start to sign.
[Fri Jan 7 10:48:34 CST 2022] Lets finalize the order, Le_OrderFinalize: https://acme-v02.api.letsencrypt.org/acme/finalize/73156074/53280741960
[Fri Jan 7 10:48:37 CST 2022] Download cert, Le_LinkCert: https://acme-v02.api.letsencrypt.org/acme/cert/04ed99c0b6706b74ad4a5a19389500b0add1
[Fri Jan 7 10:48:38 CST 2022] Cert success.
-----BEGIN CERTIFICATE-----
xxxxxxxxxx
-----END CERTIFICATE-----
[Fri Jan 7 10:48:38 CST 2022] Your cert is in /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/app-wangqiang-larabbs.shuijingwanwq.com.cer
[Fri Jan 7 10:48:38 CST 2022] Your cert key is in /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/app-wangqiang-larabbs.shuijingwanwq.com.key
[Fri Jan 7 10:48:39 CST 2022] The intermediate CA cert is in /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/ca.cer
[Fri Jan 7 10:48:39 CST 2022] And the full chain certs is there: /root/.acme.sh/app-wangqiang-larabbs.shuijingwanwq.com/fullchain.cer
Do you want to add hotlink protection? [y/n]: y
Allow Rewrite rule? [y/n]: y
Please input the rewrite of programme :
wordpress,opencart,magento2,drupal,joomla,codeigniter,laravel
thinkphp,pathinfo,discuz,typecho,ecshop,nextcloud,zblog,whmcs rewrite was exist.
(Default rewrite: other): laravel
You choose rewrite=laravel
Allow Nginx/Tengine/OpenResty access_log? [y/n]: y
You access log file=/data/wwwlogs/app-wangqiang-larabbs.shuijingwanwq.com_nginx.log
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......
#######################################################################
# OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+ #
# For more information please visit https://oneinstack.com #
#######################################################################
Your domain: app-wangqiang-larabbs.shuijingwanwq.com
Virtualhost conf: /usr/local/nginx/conf/vhost/app-wangqiang-larabbs.shuijingwanwq.com.conf
Directory of: /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com
Rewrite rule: /usr/local/nginx/conf/rewrite/laravel.conf
Let's Encrypt SSL Certificate:/usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.crt
SSL Private Key: /usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.key
[root@iZ23wv7v5ggZ oneinstack]# ^C
[root@iZ23wv7v5ggZ oneinstack]#
12. To manage the FTP account, execute the command: ./pureftpd_vhost.sh . as shown in Figure 11
[root@iZ23wv7v5ggZ oneinstack]# ./pureftpd_vhost.sh
#######################################################################
# OneinStack for CentOS/RedHat 7+ Debian 8+ and Ubuntu 16+ #
# FTP virtual user account management #
# For more information please visit https://oneinstack.com #
#######################################################################
What Are You Doing?
1. UserAdd
2. UserMod
3. UserPasswd
4. UserDel
5. ListAllUser
6. ShowUser
q. Exit
Please input the correct option: 1
Please input a username: app-wangqiang-larabbs.shuijingwanwq.com
Please input the password: s0etwJ9DGm3e6CwP
Please input the directory(Default directory: /data/wwwroot): /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com
Password:
Enter it again:
#####################################
[app-wangqiang-larabbs.shuijingwanwq.com] create successful!
You user name is : app-wangqiang-larabbs.shuijingwanwq.com
You Password is : xxxxxxxxxx
You directory is : /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com
What Are You Doing?
1. UserAdd
2. UserMod
3. UserPasswd
4. UserDel
5. ListAllUser
6. ShowUser
q. Exit
Please input the correct option: q
[root@iZ23wv7v5ggZ oneinstack]#
13. Open FlashFXP and upload the source code to the directory through FTP: /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com . as shown in Figure 12
14. Log in to the Alibaba Cloud RDS console and create a database: APP_WANGQIANG_LARABBS, and the authorized account number: APP_WANGQIANG_LARABBS. as shown in Figure 13
15. After logging in to the RDS instance, the database already exists: APP_WANGQIANG_LARABBS. Figure 14
16. Edit the virtual host configuration file: /usr/local/nginx/conf/vhost/app-wangqiang-larabbs.shuijingwanwq.com.conf . Add /public to the root directory of the website. Then restart the nginx service and execute the command: service nginx restart. as shown in Figure 15
[root@iZ23wv7v5ggZ oneinstack]# cat /usr/local/nginx/conf/vhost/app-wangqiang-larabbs.shuijingwanwq.com.conf
server {
listen 80;
listen 443 ssl http2;
ssl_certificate /usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/app-wangqiang-larabbs.shuijingwanwq.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
server_name app-wangqiang-larabbs.shuijingwanwq.com;
access_log /data/wwwlogs/app-wangqiang-larabbs.shuijingwanwq.com_nginx.log combined;
index index.html index.htm index.php;
root /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/public;
if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
include /usr/local/nginx/conf/rewrite/laravel.conf;
#error_page 404 /404.html;
#error_page 502 /502.html;
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
valid_referers none blocked *.shuijingwanwq.com app-wangqiang-larabbs.shuijingwanwq.com;
if ($invalid_referer) {
return 403;
}
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
deny all;
}
location /.well-known {
allow all;
}
}
[root@iZ23wv7v5ggZ oneinstack]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
17. View the pseudo-static configuration file of Laravel, /usr/local/nginx/conf/rewrite/laravel.conf
[root@iZ23wv7v5ggZ oneinstack]# cat /usr/local/nginx/conf/rewrite/laravel.conf
location / {
try_files $uri $uri/ /index.php?$query_string;
}
[root@iZ23wv7v5ggZ oneinstack]#
18. After the 13th step is completed, set the Laravel directory permissions. Reference URL:https://learnku.com/laravel/t/62112. WWW is a user and user group for my web services. The directory is set to 755 and all files are set to 644. In terms of permissions, it has been automatically set by OneInStack. Therefore, there is no need to set additional permissions like the directory: /bootstrap/cache, /storage, and /public/uploads. as shown in Figure 16
19. Edit the file /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/.env in ECS.
20. Execute database migration and fill, and the execution is successful. as shown in Figure 17
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan migrate:refresh --seed
Migration table not found.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (47.50ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (29.91ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated: 2019_08_19_000000_create_failed_jobs_table (36.63ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated: 2019_12_14_000001_create_personal_access_tokens_table (40.31ms)
Migrating: 2021_12_31_134920_add_avatar_and_introduction_to_users_table
Migrated: 2021_12_31_134920_add_avatar_and_introduction_to_users_table (240.63ms)
Migrating: 2021_12_31_155234_create_categories_table
Migrated: 2021_12_31_155234_create_categories_table (37.03ms)
Migrating: 2021_12_31_155935_seed_categories_data
Migrated: 2021_12_31_155935_seed_categories_data (12.72ms)
Migrating: 2021_12_31_161159_create_topics_table
Migrated: 2021_12_31_161159_create_topics_table (62.53ms)
Migrating: 2022_01_04_175444_create_replies_table
Migrated: 2022_01_04_175444_create_replies_table (49.36ms)
Migrating: 2022_01_05_101230_create_notifications_table
Migrated: 2022_01_05_101230_create_notifications_table (72.61ms)
Migrating: 2022_01_05_101456_add_notification_count_to_users_table
Migrated: 2022_01_05_101456_add_notification_count_to_users_table (41.74ms)
Migrating: 2022_01_05_114704_create_permission_tables
Migrated: 2022_01_05_114704_create_permission_tables (462.25ms)
Migrating: 2022_01_05_115758_seed_roles_and_permissions_data
Migrated: 2022_01_05_115758_seed_roles_and_permissions_data (252.50ms)
Migrating: 2022_01_05_164147_create_links_table
Migrated: 2022_01_05_164147_create_links_table (40.32ms)
Migrating: 2022_01_05_170327_add_references
Migrated: 2022_01_05_170327_add_references (133.90ms)
Migrating: 2022_01_06_094656_add_last_actived_at_to_users_table
Migrated: 2022_01_06_094656_add_last_actived_at_to_users_table (25.63ms)
Seeding: Database\Seeders\UsersTableSeeder
Seeded: Database\Seeders\UsersTableSeeder (188.79ms)
Seeding: Database\Seeders\TopicsTableSeeder
Seeded: Database\Seeders\TopicsTableSeeder (1,517.44ms)
Seeding: Database\Seeders\RepliesTableSeeder
Seeded: Database\Seeders\RepliesTableSeeder (4,513.18ms)
Seeding: Database\Seeders\LinksTableSeeder
Seeded: Database\Seeders\LinksTableSeeder (25.96ms)
Database seeding completed successfully.
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]#
21. Open the URL:https://app-wangqiang-larabbs.shuijingwanwq.com/, prompt: InvalidArgumentException
No hint path defined for[sudosu]. . . as shown in Figure 18
22. Edit the file config/sudosu.php and add COM
'allowed_tlds' => ['dev', 'local', 'com'],
23. Start the queue system on the command line, and report an error: Symfony\Component\Process\Exception\LogicException . The process class relies on proc_open, which is not available on your php installation. as shown in Figure 19
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan queue:listen
Symfony\Component\Process\Exception\LogicException
The Process class relies on proc_open, which is not available on your PHP installation.
at vendor/symfony/process/Process.php:146
142▕ */
143▕ public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
144▕ {
145▕ if (!\function_exists('proc_open')) {
➜ 146▕ throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
147▕ }
148▕
149▕ $this->commandline = $command;
150▕ $this->cwd = $cwd;
+16 vendor frames
17 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
24. Edit the /usr/local/php/etc/php.ini file, search for disable_functions, and delete proc_open and proc_get_status in its value. Then restart the PHP service. As shown in Figure 20
[root@iZ23wv7v5ggZ etc]# vi php.ini
[root@iZ23wv7v5ggZ etc]#
[root@iZ23wv7v5ggZ etc]# service php-fpm restart
Redirecting to /bin/systemctl restart php-fpm.service
[root@iZ23wv7v5ggZ etc]#
25. Start the queue system on the command line, and the queue will enter the listening state after the startup is completed. However, it still reports an error: Symfony\Component\Process\Exception\ProcessTimeDoutException . the process “/usr/local/php/bin/phpArtisanQueue:work–once–name=default–queue=default–backoff=0–memory=128–sleep=3–tries=1Exceeded the timeout of 60 seconds.. Add option –timeout=0, no more errors. As shown in Figure 21
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan queue:listen
[2022-01-07 17:04:21][9iy9L39pxxNvZ7NL9YQ0xQMXxI4EwI0j] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:22][9iy9L39pxxNvZ7NL9YQ0xQMXxI4EwI0j] Failed: App\Jobs\TranslateSlug
[2022-01-07 17:04:23][oho1xFRRasdVKHL8f4T19vz51vwzf241] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:24][oho1xFRRasdVKHL8f4T19vz51vwzf241] Failed: App\Jobs\TranslateSlug
[2022-01-07 17:04:25][qCqFpPSu9ImA0JggR4IiMlIKLWL3EB8H] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:28][qCqFpPSu9ImA0JggR4IiMlIKLWL3EB8H] Failed: App\Jobs\TranslateSlug
[2022-01-07 17:04:28][uxRYiXpFXEXBvpPxJTDKIDkCCXAgBTG9] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:29][uxRYiXpFXEXBvpPxJTDKIDkCCXAgBTG9] Failed: App\Jobs\TranslateSlug
[2022-01-07 17:04:29][kgqbausYzFSzLYgjlAvvXfrgVaGBwZME] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:04:29][kgqbausYzFSzLYgjlAvvXfrgVaGBwZME] Failed: App\Jobs\TranslateSlug
[2022-01-07 17:04:30][wdweaoBl2V2k0iCCwynnjE3imiHxmUZK] Processing: App\Jobs\TranslateSlug
Symfony\Component\Process\Exception\ProcessTimedOutException
The process "'/usr/local/php/bin/php' 'artisan' 'queue:work' '--once' '--name=default' '--queue=default' '--backoff=0' '--memory=128' '--sleep=3' '--tries=1'" exceeded the timeout of 60 seconds.
at vendor/symfony/process/Process.php:1204
1200▕
1201▕ if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
1202▕ $this->stop(0);
1203▕
➜ 1204▕ throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
1205▕ }
1206▕
1207▕ if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
1208▕ $this->stop(0);
+18 vendor frames
19 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# php artisan queue:listen --timeout=0
[2022-01-07 17:08:38][crCkj0LVPcowMiTlvjeGcGNHkPh1E4rY] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:39][crCkj0LVPcowMiTlvjeGcGNHkPh1E4rY] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:40][a6UvDyYukqW1sUSNcbjw7P6QzpFnt1dU] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:42][a6UvDyYukqW1sUSNcbjw7P6QzpFnt1dU] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:43][m8I0VIyZL9TguYR0XnxINv72wLgXqDCv] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:43][m8I0VIyZL9TguYR0XnxINv72wLgXqDCv] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:44][NM3oLDGUOhcsT5cIy9tAiM4WR1kOHTDw] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:46][NM3oLDGUOhcsT5cIy9tAiM4WR1kOHTDw] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:46][AGlsFITpj9Aqy2Iu0SOJZoxyNYcTl7ax] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:47][AGlsFITpj9Aqy2Iu0SOJZoxyNYcTl7ax] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:48][F8UO802DJzIt6nrIfAd5KZU0SmrFWg60] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:49][F8UO802DJzIt6nrIfAd5KZU0SmrFWg60] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:49][uN38Doj9q9xwDWtQcU7dGZLOub3W9Sqg] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:50][uN38Doj9q9xwDWtQcU7dGZLOub3W9Sqg] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:50][i2Fpvio1WVFbCbVFwmM8F6Gm9FWgveYq] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:51][i2Fpvio1WVFbCbVFwmM8F6Gm9FWgveYq] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:52][Ac7q3FzkUum0PN6jMVWYCqbbXRfInRM3] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:52][Ac7q3FzkUum0PN6jMVWYCqbbXRfInRM3] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:53][JstjmnEAp5ttbdPyqLXri7SwMs8Q7ple] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:54][JstjmnEAp5ttbdPyqLXri7SwMs8Q7ple] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:55][k7n2iJdSelQcgQWXsrjyci4KG1vNsAlq] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:55][k7n2iJdSelQcgQWXsrjyci4KG1vNsAlq] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:56][LcSujDiTXczEUgE1YZ5Cwf459he4yxSD] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:57][LcSujDiTXczEUgE1YZ5Cwf459he4yxSD] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:57][t2Umbs1fLco6N4ZfjYkEEbMdEHje0r9d] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:08:59][t2Umbs1fLco6N4ZfjYkEEbMdEHje0r9d] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:08:59][m4ttqh4axQ6JpFPQoL6Skpa1qBPAB6EC] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:01][m4ttqh4axQ6JpFPQoL6Skpa1qBPAB6EC] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:01][ARlo5v4zTyv3RUyKlBiR6HiYiwtuY6r5] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:03][ARlo5v4zTyv3RUyKlBiR6HiYiwtuY6r5] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:03][0DAnnrmFlwmZ6u1DGpZT0lL3fVc2GoTP] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:05][0DAnnrmFlwmZ6u1DGpZT0lL3fVc2GoTP] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:05][RXGEod7NPKnjrvzp0LB0xG7tumOTZQB3] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:07][RXGEod7NPKnjrvzp0LB0xG7tumOTZQB3] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:08][ebi2yS5WyyaZgfdHHdM0bPr6voETTHOY] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:10][ebi2yS5WyyaZgfdHHdM0bPr6voETTHOY] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:10][oCUs3UGYliYMEIldq3bOvbXEAuHJxH74] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:11][oCUs3UGYliYMEIldq3bOvbXEAuHJxH74] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:12][qS3aEkUuUx7s9eekD6txazQFCGXdZf95] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:12][qS3aEkUuUx7s9eekD6txazQFCGXdZf95] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:13][0M5eGoCrf44T0bHqi6CSnJWhIcRScx7V] Processing: App\Jobs\TranslateSlug
[2022-01-07 17:09:13][0M5eGoCrf44T0bHqi6CSnJWhIcRScx7V] Processed: App\Jobs\TranslateSlug
[2022-01-07 17:09:14][ILzNa3JxWqzi4hMEbKsywvspJR0cSG7V] Processing: App\Jobs\TranslateSlug
^C
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]#
26. It is found that the queue job does not work as expected, check the table: failed_jobs, there are some failed queue records in it. It can be ignored, because this is an accidental event, which should be caused by the high frequency of calls in an instant. Figure 22
GuzzleHttp\Exception\ServerException: Server error: `GET http://api.fanyi.baidu.com/api/trans/vip/translate?q=Aut+et+assumenda+esse+necessitatibus+et+soluta+quia+temporibus.&from=zh&to=en&appid=20220104001046264&salt=1641546261&sign=6bf4c1c8f9779e1124e4e7b9a0dacd93` resulted in a `502 No data received from server or forwarder` response:
502 - (truncated...)
in /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create()
#1 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#2 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler()
#3 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run()
#5 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#6 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#7 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#8 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#9 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/Client.php(187): GuzzleHttp\Promise\Promise->wait()
#10 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/guzzlehttp/guzzle/src/ClientTrait.php(44): GuzzleHttp\Client->request()
#11 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/app/Handlers/SlugTranslateHandler.php(42): GuzzleHttp\Client->get()
#12 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/app/Jobs/TranslateSlug.php(29): App\Handlers\SlugTranslateHandler->translate()
#13 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\TranslateSlug->handle()
#14 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#15 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#16 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#17 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#18 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#19 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#20 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#21 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#22 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow()
#23 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#24 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#25 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()
#26 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#27 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#28 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()
#29 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()
#30 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(329): Illuminate\Queue\Worker->runJob()
#31 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->runNextJob()
#32 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker()
#33 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#34 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#35 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#36 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#37 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#38 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#39 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute()
#40 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#41 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Application.php(1005): Illuminate\Console\Command->run()
#42 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#43 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#44 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run()
#45 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#46 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#47 {main}
</pre>
27. In the development environment, for the convenience of testing, we directly call artisan queue:listen for queue monitoring on the command line. However, in the production environment, we need to configure a process management tool to monitor the status of the queue:work process and restart when needed. Install Supervisor, Supervisor is a process monitor for the Linux operating system. If it fails, it will automatically restart the Queue process. To install Supervisor, you can use the following command. Error:[Errno 14]HTTP Error 502 – Bad Gateway
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# yum install supervisor
Loaded plugins: fastestmirror
Determining fastest mirrors
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/epel/7/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/7/extras/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/7/updates/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
Resolving Dependencies
--> Running transaction check
---> Package supervisor.noarch 0:3.4.0-1.el7 will be installed
--> Processing Dependency: python-meld3 >= 0.6.5 for package: supervisor-3.4.0-1.el7.noarch
--> Processing Dependency: python-setuptools for package: supervisor-3.4.0-1.el7.noarch
--> Running transaction check
---> Package python-meld3.x86_64 0:0.6.10-1.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
--> Running transaction check
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================
Installing:
supervisor noarch 3.4.0-1.el7 epel 498 k
Installing for dependencies:
python-backports x86_64 1.0-8.el7 base 5.8 k
python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k
python-ipaddress noarch 1.0.16-2.el7 base 34 k
python-meld3 x86_64 0.6.10-1.el7 epel 73 k
python-setuptools noarch 0.9.8-7.el7 base 397 k
Transaction Summary
==============================================================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 1.0 M
Installed size: 5.1 M
Is this ok [y/d/N]: y
Downloading packages:
python-backports-1.0-8.el7.x86 FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-backports-1.0-8.el7.x86_64.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-backports-ssl_match_hos FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-meld3-0.6.10-1.el7.x86_ FAILED
http://mirrors.cloud.aliyuncs.com/epel/7/x86_64/Packages/p/python-meld3-0.6.10-1.el7.x86_64.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-ipaddress-1.0.16-2.el7. FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-ipaddress-1.0.16-2.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
python-setuptools-0.9.8-7.el7. FAILED
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
supervisor-3.4.0-1.el7.noarch. FAILED
http://mirrors.cloud.aliyuncs.com/epel/7/x86_64/Packages/s/supervisor-3.4.0-1.el7.noarch.rpm: [Errno 14] HTTP Error 502 - Bad Gateway
Trying other mirror.
Error downloading packages:
python-backports-1.0-8.el7.x86_64: [Errno 256] No more mirrors to try.
python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch: [Errno 256] No more mirrors to try.
python-setuptools-0.9.8-7.el7.noarch: [Errno 256] No more mirrors to try.
supervisor-3.4.0-1.el7.noarch: [Errno 256] No more mirrors to try.
python-ipaddress-1.0.16-2.el7.noarch: [Errno 256] No more mirrors to try.
python-meld3-0.6.10-1.el7.x86_64: [Errno 256] No more mirrors to try.
28. The reason should be that the yum source has expired, reconfigure Alibaba Cloud’s CentOS 7 yum source, refer to the website:https://oneinstack.com/faq/yum-apt/. Figure 23
[root@iZ23wv7v5ggZ ~]# cd /etc/yum.repos.d
[root@iZ23wv7v5ggZ yum.repos.d]# ls
CentOS-Base.repo epel.repo
[root@iZ23wv7v5ggZ yum.repos.d]# rm -rf /etc/yum.repos.d/*.repo
[root@iZ23wv7v5ggZ yum.repos.d]# ls
[root@iZ23wv7v5ggZ yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 4059 0 --:--:-- --:--:-- --:--:-- 4056
[root@iZ23wv7v5ggZ yum.repos.d]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 639 0 0:00:01 0:00:01 --:--:-- 640
[root@iZ23wv7v5ggZ yum.repos.d]# ls
CentOS-Base.repo epel.repo
[root@iZ23wv7v5ggZ yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.cloud.aliyuncs.com
* extras: mirrors.cloud.aliyuncs.com
* updates: mirrors.cloud.aliyuncs.com
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/13): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(2/13): epel/x86_64/prestodelta | 450 B 00:00:00
(3/13): base/7/x86_64/filelists_db | 7.2 MB 00:00:01
(4/13): epel/x86_64/filelists_db | 12 MB 00:00:01
(5/13): epel/x86_64/primary_db | 7.0 MB 00:00:00
(6/13): extras/7/x86_64/primary_db | 243 kB 00:00:00
(7/13): extras/7/x86_64/filelists_db | 259 kB 00:00:00
(8/13): epel/x86_64/other_db | 3.4 MB 00:00:00
(9/13): extras/7/x86_64/other_db | 145 kB 00:00:00
(10/13): updates/7/x86_64/filelists_db | 7.4 MB 00:00:01
(11/13): updates/7/x86_64/other_db | 955 kB 00:00:00
(12/13): updates/7/x86_64/primary_db | 13 MB 00:00:02
base/7/x86_64/other_db FAILED
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/ecaab5cc3b9c10fefe6be2ecbf6f9fcb437231dac3e82cab8d9d2cf70e99644d-other.sqlite.bz2: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/ecaab5cc3b9c10fefe6be2ecbf6f9fcb437231dac3e82cab8d9d2cf70e99644d-other.sqlite.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(13/13): base/7/x86_64/other_db | 2.6 MB 00:00:00
Metadata Cache Created
[root@iZ23wv7v5ggZ yum.repos.d]# ^C
[root@iZ23wv7v5ggZ yum.repos.d]#
29. Refer to the Supervisor configuration:https://learnku.com/docs/laravel/8.5/queues/10395#e45763, install Supervisor again. The installation was successful.
[root@iZ23wv7v5ggZ yum.repos.d]# yum install supervisor
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cloud.aliyuncs.com
* extras: mirrors.cloud.aliyuncs.com
* updates: mirrors.cloud.aliyuncs.com
Resolving Dependencies
--> Running transaction check
---> Package supervisor.noarch 0:3.4.0-1.el7 will be installed
--> Processing Dependency: python-meld3 >= 0.6.5 for package: supervisor-3.4.0-1.el7.noarch
--> Processing Dependency: python-setuptools for package: supervisor-3.4.0-1.el7.noarch
--> Running transaction check
---> Package python-meld3.x86_64 0:0.6.10-1.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
--> Running transaction check
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================
Package Arch Version Repository
Size
=======================================================================================
Installing:
supervisor noarch 3.4.0-1.el7 epel 498 k
Installing for dependencies:
python-backports x86_64 1.0-8.el7 base 5.8 k
python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k
python-ipaddress noarch 1.0.16-2.el7 base 34 k
python-meld3 x86_64 0.6.10-1.el7 epel 73 k
python-setuptools noarch 0.9.8-7.el7 base 397 k
Transaction Summary
=======================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 1.0 M
Installed size: 5.1 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
(1/6): python-backports-1.0-8.el7.x86_64.rpm | 5.8 kB 00:00:00
(2/6): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch | 13 kB 00:00:00
(3/6): python-ipaddress-1.0.16-2.el7.noarch.rpm | 34 kB 00:00:00
(4/6): python-meld3-0.6.10-1.el7.x86_64.rpm | 73 kB 00:00:00
(5/6): python-setuptools-0.9.8-7.el7.noarch.rpm | 397 kB 00:00:00
(6/6): supervisor-3.4.0-1.el7.noarch.rpm | 498 kB 00:00:00
---------------------------------------------------------------------------------------
Total 726 kB/s | 1.0 MB 00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-meld3-0.6.10-1.el7.x86_64 1/6
Installing : python-ipaddress-1.0.16-2.el7.noarch 2/6
Installing : python-backports-1.0-8.el7.x86_64 3/6
Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 4/6
Installing : python-setuptools-0.9.8-7.el7.noarch 5/6
Installing : supervisor-3.4.0-1.el7.noarch 6/6
Verifying : supervisor-3.4.0-1.el7.noarch 1/6
Verifying : python-backports-1.0-8.el7.x86_64 2/6
Verifying : python-ipaddress-1.0.16-2.el7.noarch 3/6
Verifying : python-meld3-0.6.10-1.el7.x86_64 4/6
Verifying : python-setuptools-0.9.8-7.el7.noarch 5/6
Verifying : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 6/6
Installed:
supervisor.noarch 0:3.4.0-1.el7
Dependency Installed:
python-backports.x86_64 0:1.0-8.el7
python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7
python-ipaddress.noarch 0:1.0.16-2.el7
python-meld3.x86_64 0:0.6.10-1.el7
python-setuptools.noarch 0:0.9.8-7.el7
Complete!
[root@iZ23wv7v5ggZ yum.repos.d]#
30. Create a /etc/supervisord.d/app-wangqiang-larabbs-worker.ini file to start and monitor the queue:work process. Instructs supervisor to run 2 queue:work processes and monitor all processes. Figure 24
[root@iZ23wv7v5ggZ supervisord.d]# cat app-wangqiang-larabbs-worker.ini
[program:app-wangqiang-larabbs-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan queue:work sqs --sleep=3 --tries=3 --max-time=600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www
numprocs=2
redirect_stderr=true
stdout_logfile=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log
stopwaitsecs=600
[root@iZ23wv7v5ggZ supervisord.d]#
31. After creating the configuration file, you can update the supervisor configuration and start the process with the following command. Error: unix:///var/run/supervisor/supervisor.sock no such file
[root@iZ23wv7v5ggZ supervisord.d]# cd ~
[root@iZ23wv7v5ggZ ~]# supervisorctl reread
error: , [Errno 2] No such file or directory: file: /usr/lib64/python2.7/socket.py line: 224
[root@iZ23wv7v5ggZ ~]# supervisorctl status
unix:///var/run/supervisor/supervisor.sock no such file
32. After restarting the ECS instance, execute the command: easy_install supervisor. Check the running status of supervisord: supervisorctl status, error: canT find commandphp. as shown in Figure 25
[root@iZ23wv7v5ggZ ~]# easy_install supervisor
Searching for supervisor
Best match: supervisor 3.4.0
Adding supervisor 3.4.0 to easy-install.pth file
Installing echo_supervisord_conf script to /usr/bin
Installing pidproxy script to /usr/bin
Installing supervisorctl script to /usr/bin
Installing supervisord script to /usr/bin
Using /usr/lib/python2.7/site-packages
Processing dependencies for supervisor
Finished processing dependencies for supervisor
[root@iZ23wv7v5ggZ ~]# systemctl enable supervisord
Created symlink from /etc/systemd/system/multi-user.target.wants/supervisord.service to /usr/lib/systemd/system/supervisord.service.
[root@iZ23wv7v5ggZ ~]# systemctl restart supervisord
[root@iZ23wv7v5ggZ ~]# supervisorctl status
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_00 FATAL can't find command 'php'
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_01 FATAL can't find command 'php'
[root@iZ23wv7v5ggZ ~]#
33. Check the PHP running directory which PHP, and the PHP of the INI configuration file plus the absolute path. Figure 26
[root@iZ23wv7v5ggZ ~]# which php
/usr/local/php/bin/php
[root@iZ23wv7v5ggZ ~]# vim /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[root@iZ23wv7v5ggZ ~]# cat /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[program:app-wangqiang-larabbs-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan queue:work sqs --sleep=3 --tries=3 --max-time=600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www
numprocs=2
redirect_stderr=true
stdout_logfile=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log
stopwaitsecs=600
[root@iZ23wv7v5ggZ ~]#
34. After restarting Supervisord, check the status, the operation is successful, but the prompt: exit is too fast (the process log may have detailed information). Figure 27
[root@iZ23wv7v5ggZ ~]# service supervisord restart
Redirecting to /bin/systemctl restart supervisord.service
[root@iZ23wv7v5ggZ ~]# supervisorctl status
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_00 BACKOFF Exited too quickly (process log may have details)
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_01 STARTING
[root@iZ23wv7v5ggZ ~]#
35. Check /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log, prompt: classaws\sqs\sqsclientnot found. as shown in Figure 29
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# cat worker.log
Error
Class 'Aws\Sqs\SqsClient' not found
at /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/vendor/laravel/framework/src/Illuminate/Queue/Connectors/SqsConnector.php:26
22▕ $config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
23▕ }
24▕
25▕ return new SqsQueue(
➜ 26▕ new SqsClient($config),
27▕ $config['queue'],
28▕ $config['prefix'] ?? '',
29▕ $config['suffix'] ?? '',
30▕ $config['after_commit'] ?? null
+18 vendor frames
19 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan:37
Illuminate\Foundation\Console\Kernel::handle()
+18 vendor frames
19 /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan:37
Illuminate\Foundation\Console\Kernel::handle()
36. The php of the command of the ini configuration file, delete the sqs, and then restart, check the status, and it has been running. as shown in Figure 30
[root@iZ23wv7v5ggZ ~]# vim /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[root@iZ23wv7v5ggZ ~]# cat /etc/supervisord.d/app-wangqiang-larabbs-worker.ini
[program:app-wangqiang-larabbs-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan queue:work --sleep=3 --tries=3 --max-time=600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www
numprocs=2
redirect_stderr=true
stdout_logfile=/data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/worker.log
stopwaitsecs=600
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# service supervisord restart
Redirecting to /bin/systemctl restart supervisord.service
[root@iZ23wv7v5ggZ app-wangqiang-larabbs.shuijingwanwq.com]# supervisorctl status
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_00 RUNNING pid 2277, uptime 0:00:07
app-wangqiang-larabbs-worker:app-wangqiang-larabbs-worker_01 RUNNING pid 2276, uptime 0:00:07
37. Test whether the queue is effective. After restarting the ECS, create a new topic. The URL of the details page is:https://app-wangqiang-larabbs.shuijingwanwq.com/topics/105. Refresh it, it will 301 jump to:https://app-wangqiang-larabbs.shuijingwanwq.com/topics/105/a-german. Indicates that the queue is in effect. as shown in Figure 31
38. The implementation of the scheduled task. When using the scheduler, we need to modify the system’s cron scheduled task configuration information, run the following commands, and add new dispatch tasks. The deployment is complete. Figure 32
[root@iZ23wv7v5ggZ ~]# export EDITOR=vi && crontab -e
crontab: installing new crontab
* * * * * /usr/local/php/bin/php /data/wwwroot/app-wangqiang-larabbs.shuijingwanwq.com/artisan schedule:run >> /dev/null 2>&1

















![打开网址:https://app-wangqiang-larabbs.shuijingwanwq.com/ ,提示:InvalidArgumentException No hint path defined for [sudosu].](https://www.shuijingwanwq.com/wp-content/uploads/2022/01/18-1.png)












