circus 进程以及socket 管理工具&&docker运行
circus 是由mozilla 团队开发基于python 以及zeromq 的进程以及socket 管理的工具,类似supervisord
但是比supervisord 更灵活方便
来自官方的使用比较
- supervisord的
- 来自circus 的
docker 集成shiyong
搜索docker hub 对于circus 的镜像并不是很多,而且文档也不是很清晰,所以自己使用
pip 包安装的方式做了了一个简单的,方便测试,目前有一个bug,还在确定原因
- 项目结构
├── Dockerfile
├── Dockerfile-Test
├── README.md
├── circus.ini
├── docker-compose.yaml
└── entrypoint.sh
- 代码说明
Dockerfile: circus docker 镜像文件(构建)
FROM python:slim-stretch
LABEL AUTHOR="dalongrong"
LABEL EMAIL="1141591465@qq.com"
RUN apt-get update && apt-get install -y --reinstall build-essential \
&& pip install circus circus-web chaussette \
&& apt-get remove -y --purge build-essential \
&& rm -rf /var/lib/apt/lists/*
Dockerfile-Test: 测试镜像使用的(基于上边构建的镜像)
FROM dalongrong/circus
WORKDIR /app
COPY circus.ini /app/
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
circus.ini: demo 运行circus 配置,使用自带的demo
[circus]
statsd = True
httpd = False
[watcher:webapp]
cmd = /usr/local/bin/chaussette --fd $(circus.sockets.web)
numprocesses = 5
use_sockets = True
[socket:web]
host = 0.0.0.0
port = 9999
entrypoint.sh: demo 镜像的entrypoint
#!/bin/sh
circusd /app/circus.ini
docker-compose.yaml 使用docker-compose 构建镜像以及运行demo
version: "3"
services:
circus:
build: ./
web:
build:
dockerfile: Dockerfile-Test
context: ./
ports:
- "9999:9999"
- "8080:8080"
构建&&运行
- 构建
为了加速以及方便构建使用了docker hub 的构建功能,只需要添加github 集成即可,构建好的
镜像名称dalongrong/circus
- 使用
docker-compose up -d web
- 访问效果
说明
当前对于circushttpd web 配置的集成是有问题的,异常信息如下,还在解决中
web_1 | SyntaxError: invalid syntax
web_1 | Traceback (most recent call last):
web_1 | File "<string>", line 1, in <module>
web_1 | File "/usr/local/lib/python3.7/site-packages/circusweb/circushttpd.py", line 25, in <module>
web_1 | import tornadio2
web_1 | File "/usr/local/lib/python3.7/site-packages/tornadio2/__init__.py", line 25, in <module>
web_1 | from tornadio2.router import TornadioRouter
web_1 | File "/usr/local/lib/python3.7/site-packages/tornadio2/router.py", line 27, in <module>
web_1 | from tornadio2 import persistent, polling, sessioncontainer, session, proto, preflight, stats
web_1 | File "/usr/local/lib/python3.7/site-packages/tornadio2/persistent.py", line 143
web_1 | except Exception, ex:
web_1 | ^
web_1 | SyntaxError: invalid syntax
参考资料
https://circus.readthedocs.io/en/latest/faq/
https://github.com/rongfengliang/circus-docker
https://cloud.docker.com/repository/docker/dalongrong/circus
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2017-06-10 一款直接时空处理分析的开源数据库---geomesa
2017-06-10 nginx php 配置
2017-06-10 Apache Accumulo
2017-06-10 Kubernetes Helm
2017-06-10 Helm Charts