Supervisor mirroring cannot manage multiple environments
lichnow opened this issue · comments
现在lnmp包里的supervisor镜像因为继承了php-fpm的镜像所以只能管理php进程,无法运行Node命令,也无法运行ruby等其它环境。请教一下,如何能使supervisor运行任意环境?
我现在的办法是复制一遍Node环境的dockerfile放到supervisor的dockerfile里面,虽然可以使用,但是感觉并不是很好,能有什么办法,使node,ruby或者其它任意环境以镜像的方式一起合并到supervisor里面吗?
不要把容器当作虚拟机。
一个容器中运行的进程尽可能单一。
Source
不要把容器当作虚拟机。
一个容器中运行的进程尽可能单一。
Translate
Do not think of containers as virtual machines. Processes running in a container are as simple as possible.
Tencent AI Analytic Result 😄
@khs1994 那具体现在需要在supervisor里运行node和php,是需要开两个supervisor吗?还是怎么操作?因为一个要运行socket.js一个运行laravel的任务列队
Source
@khs1994 那具体现在需要在supervisor里运行node和php,是需要开两个supervisor吗?还是怎么操作?因为一个要运行socket.js一个运行laravel的任务列队
Translate
@ khs 1994 that specific now need to run node and php in the supervisor, is it necessary to open two supervisors? Or how? Because a task queue running laravel
Tencent AI Analytic Result 😄
我现在改成这样
supervisord:
<< : *php7
networks:
- backend
image: "gkrio/php:supervisord"
# secrets:
# - source: supervisord_ini
# target: /etc/supervisord.ini
volumes:
- type: bind
source: ./config/supervisor/php
target: /etc/supervisor/conf.d
- ./log/supervisor/php:/var/log/supervisor:delegated
- ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}:cached
# - ./config/etc/supervisor/supervisord.conf:/etc/supervisor/supervisord.conf:ro,cached
command: ["/usr/bin/supervisord","-n","-c","/etc/supervisor/supervisord.conf"]
expose:
- "9001"
supervisord-node:
networks:
- backend
image: "gkrio/node:supervisord"
volumes:
- type: bind
source: ./config/supervisor/node
target: /etc/supervisor/conf.d
- ./log/supervisor/node:/var/log/supervisor:delegated
- ${APP_ROOT:-./app}:${LNMP_PHP_PATH:-/app}:cached
command: ["/usr/bin/supervisord","-n","-c","/etc/supervisor/supervisord.conf"]
docker镜像for node
FROM gkrio/node:latest
FROM gkrio/php:${PHP_VERSION}
RUN apk update && apk add --no-cache supervisor \
&& mkdir -p /etc/supervisor/conf.d/ \
&& mkdir -p /var/log/supervisor/
COPY supervisord.conf /etc/supervisor/supervisord.conf
VOLUME ["/etc/supervisor/conf.d"]
CMD ["/usr/bin/supervisord","-n","-c","/etc/supervisor/supervisord.conf"]
php类似,这样的方式是正确合理的吗?
可以的。
更新本项目到最新。
自定义服务可以加到 docker-compose.include.yml
文件中。
之后在 .env
中包含进来
LNMP_INCLUDE="xx xx xx"
Source
可以的。
更新本项目到最新。
自定义服务可以加到
docker-compose.include.yml
文件中。之后在
.env
中包含进来LNMP_INCLUDE="xx xx xx"
Translate
Yes. Update this item to the latest. The custom service can be added to the' docker-compose.include.yml' file. Then included in '.env' bashlnmp _ include =' xxxxxx'
Tencent AI Analytic Result 👍
Source
@khs1994 是
docker-compose.include.example.yml
这个文件吗?
Translate
@ khs1994 is the file 'docker-compose.include.example.yml.'?
Tencent AI Analytic Result 😄
不是,执行lnmp-docker 初始化一下就能看到了
Source
不是,执行lnmp-docker 初始化一下就能看到了
Translate
No, perform an lnmp-docker initialization and you'll see
Tencent AI Analytic Result 😄
@khs1994 再加一个启动的include.sh吧,因为有些服务比如supervisor-node,需要删除日志等,就像lnmp-docker里supervisor的操作一样
Source
@khs1994 再加一个启动的include.sh吧,因为有些服务比如supervisor-node,需要删除日志等,就像lnmp-docker里supervisor的操作一样
Translate
@ khs 1994 plus a start-up include.sh, because some services such as supervisor-node, need to delete the log, etc. Just like the supervisor in the lnmp-docker.
Tencent AI Analytic Result 😄
新增 lnmp-custom-script
文件,自己新建, 已被 .gitignore
忽略
Source
新增
lnmp-custom-script
文件,自己新建, 已被.gitignore
忽略
Translate
Added' lnmp-custom-script' file, self-created, ignored by'.gitignore'
Tencent AI Analytic Result 😄
@khs1994 按照这个方法弄确实可以分开运行supervisor了,现在有一个问题,如果纯粹分开,而我运行在php容器里的laravel程序需要执行node,python等命令,那么该如何执行呢?比如 exec("cd ". dirname($nodeJsPath). " && node nodefunc.js 2>&1", $out, $err);
这条代码会提示找不到node,该怎么处理呢?
你这样的话,只能在自己制作一个包含各种软件的 Docker 镜像,没办法分开。
Source
你这样的话,只能在自己制作一个包含各种软件的 Docker 镜像,没办法分开。
Translate
In this case, you can only make your own docker image that contains all kinds of software.