请教各位大佬
1
OceanBreeze 2023-11-14 05:53:44 +08:00 via iPhone
监听 -> 守护吧。supervisord 也完全可以在容器内运行,楼主有什么问题?
|
2
lzj307077687 2023-11-14 08:08:17 +08:00 via iPhone
我的 supervisord 是用 docker exec
|
3
poisedflw 2023-11-14 08:28:49 +08:00
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "/etc/supervisor/supervisord.conf"]
|
4
kilvn 2023-11-14 10:03:33 +08:00
|
5
hongfs 2023-11-14 10:07:49 +08:00
尝试下 pm2 ?
|
6
hefish 2023-11-14 10:18:06 +08:00
用 supervisord 来启动 nginx 和 php-fpm 吧。 至少我是这么干的。 楼上有大佬说 pm2 ,嗯,得空去研究一下。
|
7
darklost 2023-11-14 10:20:32 +08:00
开个容器专门跑 supervisord php-worker
|
8
pota 2023-11-14 10:33:09 +08:00
单独用一个容器使用 supervisord 去守护 cli
|
9
brader 2023-11-14 10:51:36 +08:00
大概就是这样子弄:
api_dockerfile: ``` FROM my_php COPY ./ /app WORKDIR /app COPY ./docker/php-fpm/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN rm -rf /app/docker \ && chmod +x /usr/local/bin/docker-entrypoint.sh ENTRYPOINT ["docker-entrypoint.sh"] CMD ["php-fpm"] ``` docker-entrypoint.sh: ``` #!/bin/sh composer install php artisan storage:link php artisan migrate php artisan make:lang-json chown -R www-data:www-data lang/ storage/ service supervisor start supervisorctl reread supervisorctl update supervisorctl start laravel-worker:* exec docker-php-entrypoint "$@" ``` laravel-worker.conf: ``` [program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /app/artisan queue:work --sleep=2 --tries=3 --max-time=3600 autostart=true autorestart=true stopasgroup=true killasgroup=true user=www-data numprocs=2 redirect_stderr=true stdout_logfile=/root/laravel-worker.log stopwaitsecs=3600 ``` |