Repository navigation
refactor(php-fpm): rework php-fpm backend selection to reduce complexity - #63
Conversation
|
Looks good. Not sure if we need all headers for debug every time, as they may be not readable for developers who don't dig into warden internals. But it's actually good for debugging. Maybe we should consider hiding them under some request header like |
|
Agreed, they are primarily there just to aid with testing the change before release. Plan is to remove them before the merge, unless general consensus is to keep them behind a feature flag. I feel the |
There was a problem hiding this comment.
These changes are unnecessary. We don't need to use the environment variables for this.
There was a problem hiding this comment.
Dropped the changes to the Dockerfile
| BF:$WARDEN_BLACKFIRE:$http_X_BLACKFIRE_QUERY; | ||
| DBG:$PHP_XDEBUG_3:$cookie_XDEBUG_SESSION$cookie_XDEBUG_PROFILE$cookie_XDEBUG_TRACE$arg_XDEBUG_SESSION$arg_XDEBUG_SESSION_START; | ||
| SPX:$WARDEN_PHP_SPX:$cookie_SPX_ENABLED$cookie_SPX_KEY$arg_SPX_ENABLED$arg_SPX_KEY$arg_SPX_UI_URI; |
There was a problem hiding this comment.
We should ignore the environment files, but keep the prefix so it's easier to match. I like the idea of the prefix, but I think it would be enough to have "~BF:.+;" or "~SPX:.+;"
There was a problem hiding this comment.
Dropped the enabled checks, but kept the prefixes for the backends
| "~DBG:1:.+;" ${NGINX_UPSTREAM_DEBUG_HOST}:${NGINX_UPSTREAM_DEBUG_PORT}; | ||
| "~BF:1:.+;" ${NGINX_UPSTREAM_BLACKFIRE_HOST}:${NGINX_UPSTREAM_BLACKFIRE_PORT}; | ||
| "~SPX:1:.+;" ${NGINX_UPSTREAM_SPX_HOST}:${NGINX_UPSTREAM_SPX_PORT}; |
There was a problem hiding this comment.
Remove the :1 from the pattern, as we shouldn't need to use the environment variables.
| # TESTING PURPOSES - Show evaluated backend conditions | ||
| add_header x-backend-blackfire "BF:$WARDEN_BLACKFIRE:$http_X_BLACKFIRE_QUERY;" always; | ||
| add_header x-backend-xdebug "DBG:$PHP_XDEBUG_3:$cookie_XDEBUG_SESSION$cookie_XDEBUG_PROFILE$cookie_XDEBUG_TRACE$arg_XDEBUG_SESSION$arg_XDEBUG_SESSION_START;" always; | ||
| add_header x-backend-spx "SPX:$WARDEN_PHP_SPX:$cookie_SPX_ENABLED$cookie_SPX_KEY$arg_SPX_ENABLED$arg_SPX_KEY$arg_SPX_UI_URI;" always; |
There was a problem hiding this comment.
Go ahead and remove these. If they're for debugging, they shouldn't be in the PR.
|
I like where you're going with the PR, but I don't think the 502 errors are wrong to appear. |
|
Main direction of the PR was to reduce the complexity around enabling/disabling the SPX container and have it just work. From my perspective, I treat the feature flag as a source of truth. After turning off the flag, I don't expect to have to manually cleanup my environment. And vice versa, when a feature I am expecting is missing, its one of the first things i check. I think if we do decided to stick with the 502 route, we'll need a custom 502 page like @ihor-sviziev suggested, to help visualise why the 502 happened with a easy way to remove the left over cookies. wardenenv/warden#822 (comment) I think its really just a case of deciding what will be the best UX. https://github.com/wardenenv/images/compare/main...SamJUK:feat/cookie-helper?expand=1
|
|
I'd rather support a dynamic 502 page. To me the issue you're trying to solve with the environment value is a user-error. You have to tag the request to be debug/spx/blackfire using cookies, why would disabling it be done somewhere else instead of just deleting the cookies? Feels like we're solving the wrong problem with this approach. |
|
I'd also rather the dynamic 502 page. It's not exactly user error, but it's also not the kind of thing we want to silently change on developers (e.g. turning on SPX, but SPX isn't on, but you get a page, and you can't figure out why SPX isn't working). That kind of silence makes it really difficult to determine what's happening. A dynamic 502 for the case where its been turned off but the cookie still exists is infinitely better. And honestly I don't see any reason why your POC couldn't be considered complete. |
|
Thanks for the feedback both. I've had the 502 page build running locally for the last 2 weeks, and to be fair, its worked well from a UX perspective. I'll also rebase this PR to drop the enabled checks, and reduce the scope of this PR to just include the QOL changes to the fastcgi_backend map for container selection. |
8cc585a to
26ee1a0
Compare
|
PR rebased, and title updated to reflect new scope of the PR |

Related PR within the docker compose repository - wardenenv/warden#889
Rough concept PR for reworking the PHP fastcgi backend selection to hopefully resolve a few issues.
Specially around the need to delete cookies when disabling debug containers to avoid 502 errors.
x-backendto improve the visibility of the backend selectionfastcgi_backendmap to account for enabled status of each service/container to avoid 502 errors when disabling containers like SPX or XDEBUGfastcgi_backendmap to use named labels & multiple lines to improve maintainabilityShould resolve the following issues:
wardenenv/warden#820 (comment)
wardenenv/warden#822