Closed lichnow closed 5 years ago
不要把容器当作虚拟机。
一个容器中运行的进程尽可能单一。
不要把容器当作虚拟机。 一个容器中运行的进程尽可能单一。
@khs1994 那具体现在需要在supervisor里运行node和php,是需要开两个supervisor吗?还是怎么操作?因为一个要运行socket.js一个运行laravel的任务列队
@khs1994 那具体现在需要在supervisor里运行node和php,是需要开两个supervisor吗?还是怎么操作?因为一个要运行socket.js一个运行laravel的任务列队
我现在改成这样
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"
可以的。 更新本项目到最新。 自定义服务可以加到 `docker-compose.include.yml` 文件中。 之后在 `.env` 中包含进来 ```bash LNMP_INCLUDE="xx xx xx" ```
@khs1994 是docker-compose.include.example.yml
这个文件吗?
@khs1994 是`docker-compose.include.example.yml`这个文件吗?
不是,执行lnmp-docker 初始化一下就能看到了
不是,执行lnmp-docker 初始化一下就能看到了
@khs1994 再加一个启动的include.sh吧,因为有些服务比如supervisor-node,需要删除日志等,就像lnmp-docker里supervisor的操作一样
@khs1994 再加一个启动的include.sh吧,因为有些服务比如supervisor-node,需要删除日志等,就像lnmp-docker里supervisor的操作一样
新增 lnmp-custom-script
文件,自己新建, 已被 .gitignore
忽略
新增 `lnmp-custom-script` 文件,自己新建, 已被 `.gitignore` 忽略
@khs1994 按照这个方法弄确实可以分开运行supervisor了,现在有一个问题,如果纯粹分开,而我运行在php容器里的laravel程序需要执行node,python等命令,那么该如何执行呢?比如 exec("cd ". dirname($nodeJsPath). " && node nodefunc.js 2>&1", $out, $err);
这条代码会提示找不到node,该怎么处理呢?
你这样的话,只能在自己制作一个包含各种软件的 Docker 镜像,没办法分开。
你这样的话,只能在自己制作一个包含各种软件的 Docker 镜像,没办法分开。
现在lnmp包里的supervisor镜像因为继承了php-fpm的镜像所以只能管理php进程,无法运行Node命令,也无法运行ruby等其它环境。请教一下,如何能使supervisor运行任意环境? 我现在的办法是复制一遍Node环境的dockerfile放到supervisor的dockerfile里面,虽然可以使用,但是感觉并不是很好,能有什么办法,使node,ruby或者其它任意环境以镜像的方式一起合并到supervisor里面吗?