circus && web comsole docker-compose 獨立部署

 問題的根本緣由是web console 的bug(實際上仍是python 對於依賴版本出來不明確)python

circus 進程docker 鏡像

  • dockerfile
FROM python:slim-stretch
LABEL AUTHOR="dalongrong"
LABEL EMAIL="1141591465@qq.com"
WORKDIR /app
RUN apt-get update && apt-get install -y --reinstall build-essential \
    && pip install circus chaussette \
    && apt-get remove -y --purge build-essential \
    && rm -rf /var/lib/apt/lists/*
COPY circus.ini /app/
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
  • entrypoint.sh
#!/bin/sh
circusd /app/circus.ini
  • circus demo 配置文件
[circus]
statsd = True
[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

circus web console docker 鏡像

  • dockerfile

    說明由於pyzmq 以及tornado 版本的問題,進行了特殊處理git

FROM python:2.7-slim-stretch
LABEL AUTHOR="dalongrong"
LABEL EMAIL="1141591465@qq.com"
RUN apt-get update && apt-get install -y --reinstall build-essential \
    && pip install circus-web \
    && pip uninstall -y tornado \
    && pip uninstall -y pyzmq \
    && pip install tornado==3.2.2 \
    && pip install pyzmq==16.0.4 \
    && apt-get remove -y --purge build-essential \
    && rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
  • entrypoint
#!/bin/sh
circushttpd

集成試用

使用docker-composegithub

  • docker-compose 文件
version: "3"
services: 
  circus:
    image: dalongrong/circus:3.7-slim-stretch
    ports: 
    - "9999:9999"
    - "5555:5555"
    volumes: 
    - "./circus.ini:/app/circus.ini"
  circus-web:
    image: dalongrong/circusd-web:2.7-slim-stretch
    ports:
    - "8080:8080"
  • circus 配置文件

    數據卷掛載方式web

[circus]
statsd = True
check_delay = 5
endpoint = tcp://0.0.0.0:5555
pubsub_endpoint = tcp://0.0.0.0:5556
stats_endpoint= tcp://0.0.0.0:5557
[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

啓動&&效果

  • 啓動
docker-compose up -d
  • socket 訪問

 

  • web console 訪問

 

 

說明

由於web console 獲取circus stats 接口地址錯誤(bug),形成沒法獲取進行的統計信息,只能進行操做處理,同時這種處理方式並非很安全,實際推薦
基於ipc 通訊,並經過ssh tunneling 進行管理以及通訊信息查看docker

參考資料

https://github.com/rongfengliang/circusd-web-docker
https://github.com/rongfengliang/circusd-docker
https://github.com/rongfengliang/circus-docker-compose
https://cloud.docker.com/repository/docker/dalongrong/circusd-web
https://cloud.docker.com/repository/docker/dalongrong/circusd安全

相關文章
相關標籤/搜索