feat: option to configure Flask listening address#439
Open
L2jLiga wants to merge 1 commit intoNeptuneHub:mainfrom
Open
feat: option to configure Flask listening address#439L2jLiga wants to merge 1 commit intoNeptuneHub:mainfrom
L2jLiga wants to merge 1 commit intoNeptuneHub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the Gunicorn bind address in supervisord.conf to support IPv6 and adds a trailing newline. Feedback suggests removing the single quotes from the bind address to prevent potential parsing errors and considering an environment variable for the bind address to ensure compatibility with systems where IPv6 is disabled.
|
|
||
| [program:flask] | ||
| command=/usr/local/bin/gunicorn --bind 0.0.0.0:8000 --workers 1 --threads 4 --worker-class gthread --keep-alive 5 --timeout 300 app:app | ||
| command=/usr/local/bin/gunicorn --bind '[::]:8000' --workers 1 --threads 4 --worker-class gthread --keep-alive 5 --timeout 300 app:app |
Contributor
There was a problem hiding this comment.
While binding to [::] is the standard way to support both IPv4 and IPv6 on modern Linux systems, there are two points to consider:
- Compatibility: Gunicorn will fail to start if the host system has IPv6 completely disabled at the kernel level (e.g., via
ipv6.disable=1). For a more robust implementation, consider making the bind address configurable via an environment variable to allow users to revert to0.0.0.0if needed. - Quotes: The single quotes around
[::]:8000are unnecessary in asupervisord.confcommand string and might be passed literally to Gunicorn depending on the Supervisor version's parsing logic, which could lead to binding errors. It is safer to remove them.
command=/usr/local/bin/gunicorn --bind [::]:8000 --workers 1 --threads 4 --worker-class gthread --keep-alive 5 --timeout 300 app:app
Changes gunicorn bind address from IPV4-only 0.0.0.0 to IPv4/IPv6 [::]. This chance allows to run flask properly on IPv6-only or dual-stack networks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added environment variable to configure gunicorn bind address, so it can be changed to
[::]for IPv6-only / dual-stack environments