linux – Daemonized buildbot start
我正在尝试编写最简单的docker buildbot主映像,它在ENTRYPOINT / CMD Dockerfile指令中运行buildbot start.
我试过使用dumb-init,gosu和exec的很多组合,但没有成功. 情况如下: >当我尝试使用命令docker run -d -v $local / vol / bldbot / master:/ var / lib / buildbot buildbot-master-test运行deamonized buildroot时,容器成功启动,但它突然终止.日志如下所示: [timestamp] [ – ]日志已打开. 我已经研究过官方buildbot主docker镜像的内容,即buildbot / buildbot-master.我看到作者决定在start_buildbot.sh中使用命令exec twistd -ny $B / buildbot.tac,而不是他们自己的buildbot启动. 所以问题是,如何在仅运行buildbot start的Dockerfile中编写ENTRYPOINT / CMD指令. 附录1 Dockerfile内容 FROM alpine:3.4 ENV BASE_DIR=/var/lib/buildbot SRC_DIR=/usr/src/buildbot COPY start $SRC_DIR/ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && echo @community http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && apk add --no-cache python py-pip py-twisted py-cffi py-cryptography@community py-service_identity@community py-sqlalchemy@community gosu@testing dumb-init@community py-jinja2 tar curl && # install pip dependencies pip install --upgrade pip setuptools && pip install "buildbot" && rm -r /root/.cache WORKDIR $BASE_DIR RUN adduser -D -s /bin/sh bldbotmaster && chown bldbotmaster:bldbotmaster . VOLUME $BASE_DIR CMD ["dumb-init","/usr/src/buildbot/start","buildbot","master"] 附录2 启动脚本内容 #!/bin/sh set -e BASE_DIR=/var/lib/buildbot if [[ "$1" = 'buildbot' && "$2" = 'master' ]]; then if [ -z "$(ls -A "$BASE_DIR/master.cfg" 2> /dev/null)" ]; then gosu bldbotmaster buildbot create-master -r $BASE_DIR gosu bldbotmaster cp $BASE_DIR/master.cfg.sample $BASE_DIR/master.cfg fi exec gosu bldbotmaster buildbot start $BASE_DIR fi exec "$@" 解决方法
Buildbot引导程序基于Twisted的“.tac”文件,预计将使用twistd -y buildbot.tac启动.
buildbot启动脚本实际上只是扭曲的一个方便包装器.它实际上只是运行twistd,然后监视日志以确认buildbot成功启动.在此日志监视之外没有任何增值,因此使用buildbot start启动buildbot并非严格要求. 你可以用twistd -y buildbot.tac来启动它. 当你指出官方docker镜像正在使用twistd -ny buildbot.tac启动buildbot buildbot start命令也有一个–nodaemon选项,它实际上只是’exec’到twistd -ny. 另一个Docker具体是buildbot.tac是不同的.它将twistd日志配置为输出到stdout而不是输出到twisted.log.这是因为docker设计期望日志在stdout中,因此您可以独立于应用程序的技术配置任何花哨的云日志转发器. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |