Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warden 0.8.0 on Ubuntu - Nginx/Varnish Exit Early #200

Closed
ryantfowler opened this issue Jul 30, 2020 · 2 comments
Closed

Warden 0.8.0 on Ubuntu - Nginx/Varnish Exit Early #200

ryantfowler opened this issue Jul 30, 2020 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@ryantfowler
Copy link
Contributor

ryantfowler commented Jul 30, 2020

Base OS: Ubuntu 20.04.1 LTS
Docker Version: 19.03.9, build 9d988398e7
Docker Compose: 1.25.4, build 8d51620a
Warden Version: 0.8.0
Warden Environment Type: magento2

Background
Following an upgrade from 0.6.0 to 0.8.0, projects that were working using warden, "broke." When running warden env up / warden env start ( equivalent to running docker-compose up ), the nginx container exits immediately, and so does the varnish container.

Findings

  1. docker logs <nginx-container-id> shows the following:
2020/07/29 21:47:23 [emerg] 1#1: invalid number of arguments in "fastcgi_param" directive in /etc/nginx/fastcgi_params:28
nginx: [emerg] invalid number of arguments in "fastcgi_param" directive in /etc/nginx/fastcgi_params:28

This is the location of line 28 referenced above, which has the following declaration:

fastcgi_param  HTTP_X_DEBUG_HOST  ${XDEBUG_CONNECT_BACK_HOST};
  1. This is where there was a change between 0.6.0 and 0.8.0 releases. XDEBUG_CONNECT_BACK_HOST

  2. Due to this depenency from the varnish container, upon the nginx container, is why the varnish container is also exiting immediately.

Conclusion
It's clear to me that the host.docker.internal works on Mac, but not on Linux.

A few quick fixes in order to get around the nginx and varnish containers from exiting early:

  • I've just deleted this and the next line ( since I install warden via git clone ).
  • Or, I've applied the following diff:
diff --git a/environments/includes/nginx.base.yml b/environments/includes/nginx.base.yml
index 206cfdc..6f95b46 100644
--- a/environments/includes/nginx.base.yml
+++ b/environments/includes/nginx.base.yml
@@ -13,4 +13,4 @@ services:
     volumes:
       - .${WARDEN_WEB_ROOT:-}/:/var/www/html:delegated
     environment:
-      - XDEBUG_CONNECT_BACK_HOST=${XDEBUG_CONNECT_BACK_HOST:-}
+      - XDEBUG_CONNECT_BACK_HOST=${XDEBUG_CONNECT_BACK_HOST:-""}

@davidalger I can open a PR for the above diff, if you'd like, but I wanted to wait and see if you had something better in mind.

Just sharing this so that if anyone else runs into it, and there's no need for anything from 0.7.0+, switching to 0.6.0 or following any of the suggestions in the previous sentence, will get things going again.

@davidalger davidalger added this to the Warden 0.8.1 milestone Jul 30, 2020
@davidalger
Copy link
Collaborator

davidalger commented Jul 30, 2020

@ryantfowler Thanks so much for the thorough and accurate write up. This issue is certainly a regression and crept in due to PR #199 which was intended to allow XDEBUG_CONNECT_BACK_HOST to be set via an exported environment variable so that (in lieu of having automatic setting) it can be configured on WSL (which does seem to require the use of host.docker.internal), but also when using Warden on networked Linux dev servers rather than on the same host as the workstation.

The patch you noted would be the appropriate solution. In fact '' is the default value for the env var in the Dockerfile for the nginx image. :)

I'll be pushing out release 0.8.1 with this fix very shortly.

@davidalger davidalger added the bug Something isn't working label Jul 30, 2020
@ryantfowler
Copy link
Contributor Author

@davidalger you're most welcome, and thank you for the quick turn around on this. I also appreciate the explanation, which provides more context for the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants