我有使用ddev进行的验收测试。它们在ddev composer cookieman:test
上本地运行。我想对Github动作使用相同的设置。
有人在Github动作/工作流程中对ddev有好运吗?我要直到ddev的运行状况检查失败:
... Creating ddev-router ... done Failed to start extension-cookieman-master: ddev-router failed to become ready: logOutput=2019/11/15 02:24:19 [emerg] 1630#1630: no servers are inside upstream in /etc/nginx/conf.d/default.conf:89 nginx: [emerg] no servers are inside upstream in /etc/nginx/conf.d/default.conf:89 nginx: configuration file /etc/nginx/nginx.conf test failed % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 404 Not Found ddev-router healthcheck endpoint not responding , err=container /ddev-router unhealthy: 2019/11/15 02:24:19 [emerg] 1630#1630: no servers are inside upstream in /etc/nginx/conf.d/default.conf:89 nginx: [emerg] no servers are inside upstream in /etc/nginx/conf.d/default.conf:89 nginx: configuration file /etc/nginx/nginx.conf test failed % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 404 Not Found ddev-router healthcheck endpoint not responding ##[error]Process completed with exit code 1.
.github / workflows / tests.yml:
name: Tests on: [push, pull_request] jobs: tests-via-ddev: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - run: export DEBIAN_FRONTEND=noninteractive # update docker - run: sudo -E apt-get purge -y docker docker-engine docker.io containerd runc nginx - run: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - run: sudo -E add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - run: sudo -E apt-get update - run: sudo -E apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce # install linuxbrew - run: sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" - run: echo "::add-path::/home/linuxbrew/.linuxbrew/bin" # install ddev + docker-compose - run: brew tap drud/ddev && brew install ddev docker-compose # Start ddev - run: ddev start || exit 0 # Debug - run: ls -als .ddev/ - run: curl 127.0.0.1 || exit 0 - run: curl 127.0.0.1/healthcheck || exit 0 - run: docker ps || exit 0 # we want Clover coverage - run: ddev exec enable_xdebug # Run tests - run: ddev composer cookieman:test
我尝试了
使用Ubuntu 16.04
完全升级Ubuntu 16.04 / 18.04上的所有软件包
像这样配置ddev:
run: ddev config global --router-bind-all-interfaces=true
run: ddev config global --omit-containers=dba,ddev-ssh-agent
更改为非特权路由器端口(在config.yaml中设置router_http_port,router_https_port)
如果我强迫它继续使用ddev start || exit 0
,我可以看到容器正在运行:
- run: docker ps || exit 0
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c36601a06fd6 drud/ddev-router:v1.11.0 "/app/docker-entrypo…" 27 seconds ago Up 24 seconds (unhealthy) 0.0.0.0:4430->4430/tcp, 0.0.0.0:4444->4444/tcp, 0.0.0.0:8025->8025/tcp, 80/tcp, 0.0.0.0:8080->8080/tcp ddev-router 18152602a054 drud/ddev-webserver:v1.11.0-built "/start.sh" 30 seconds ago Up 28 seconds (healthy) 8025/tcp, 127.0.0.1:32770->80/tcp, 127.0.0.1:32769->443/tcp ddev-extension-cookieman-master-web 33aca55715f2 selenium/standalone-chrome:3.12 "/opt/bin/entry_poin…" 32 seconds ago Up 30 seconds 4444/tcp ddev-extension-cookieman-master-chrome 6c852ae62974 drud/ddev-dbserver:v1.11.0-10.2-built "/docker-entrypoint.…" 32 seconds ago Up 30 seconds (healthy) 127.0.0.1:32768->3306/tcp ddev-extension-cookieman-master-db
curl 127.0.0.1
产生默认的nginx起始页(我希望'503:没有可用的ddev后端站点')
curl 127.0.0.1/healthcheck
产生404
到目前为止,我的结论是:ddev-router可以访问,但是其nginx没有适当的配置(/etc/nginx/conf.d/default.conf中上游没有服务器)。因此,ddev仅运行启动前挂钩形式config.yaml。后启动未达到。
您可以在https://github.com/dmind-gmbh/extension-cookieman/actions?query=branch%3Afeat%2Facceptance-tests
处看到最后一次运行的输出编辑/修改:
这是从/etc/nginx/conf.d/default.conf
(错误)生成的ddev-router
:
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
default $http_x_forwarded_port;
'' $server_port;
}
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
# Connection header that may have been passed to this server
map $http_upgrade $proxy_connection {
default upgrade;
'' close;
}
# Apply fix for very long server names
server_names_hash_bucket_size 128;
# Default dhparam
# ssl_dhparam /etc/nginx/dhparam/dhparam.pem;
# Set appropriate X-Forwarded-Ssl header
map $scheme $proxy_x_forwarded_ssl {
default off;
https on;
}
rfay提到了ddev-router与底层docker守护程序之间通过套接字的通讯错误。
答案 0 :(得分:1)
编辑:
我得出的结论是问题在于docker-gen。
在模板的第一行(https://github.com/drud/ddev/blob/master/containers/ddev-router/nginx.tmpl或jwilder的https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl)中,.Docker.CurrentContainerID为空,在某些情况下https://github.com/jwilder/docker-gen/issues/196#issuecomment-225412753似乎发生在某些人身上。 >
建议删除“仅曝光”对我不起作用。我稍微修改了模板,以免不依赖容器,就是这样。
:)
这还是有点脏,只有一个证明证明:
这是更改后的模板https://github.com/dmind-gmbh/extension-cookieman/blob/feat/acceptance-tests/nginx-debug.tmpl(比较上游{}部分,在该部分中我删除了检查容器是否与路由器在同一网络上的内容)
我在工作流程中
ddev start || exit 0
#这将失败并且也不会执行任何启动后挂钩docker cp nginx-debug.tmpl ddev-router:/app/nginx-debug.tmpl
docker exec ddev-router sh -c "docker-gen -only-exposed -notify 'sleep 1 && nginx -s reload' /app/nginx-debug.tmpl /etc/nginx/conf.d/default.conf"
尚未决定如何从此处继续。也许@rfay对如何更改Nginx模板有一个想法。或者,我将为ddev-router使用自定义Dockerfile以及docker-compose.ddev-router.yaml来更改文件,仅用于Github操作运行...
编辑/修改:
此版本的简短版本:
ddev start || docker cp .ddev/patches/ddev-router/nginx.tmpl ddev-router:/app/nginx.tmpl
ddev start
-这会触发容器重启,从而使docker-gen运行