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
Increment backend port also when commented #3180
base: main
Are you sure you want to change the base?
Conversation
This allows to grep the incremented port also for other backends then php-fpm with `%backend_lsnr%` in the web template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments if not the default template is used it seems to fail loading properly
@@ -55,7 +55,7 @@ fi | |||
|
|||
# Allocating backend port | |||
backend_port=9000 | |||
ports=$(grep -v '^;' $pool/* 2> /dev/null | grep listen | grep -o :[0-9].*) | |||
ports=$(grep $pool/* 2> /dev/null | grep -o :[0-9].*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I rebuild a domain with PHP-7_4 template for example it runs:
pool="/etc/php/7.4/fpm/pool.d"
grep $pool/* 2> /dev/null | grep -o :[0-9].*
And it freezes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange. I made the same PR to Vesta in December 2018. It was excepted in October 2021 and is still the newest change to both files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it when I made it the first time but maybe something has changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 102 to 131 in 559aece
# Accept first function argument as backend template otherwise fallback to $template global variable | |
local backend_template=${1:-$template} | |
pool=$(find -L /etc/php/ -name "$domain.conf" -exec dirname {} \;) | |
# Check if multiple-PHP installed | |
regex="socket-(\d+)_(\d+)" | |
if [[ $backend_template =~ ^.*PHP-([0-9])\_([0-9])$ ]]; then | |
backend_version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}" | |
pool=$(find -L /etc/php/$backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \)) | |
else | |
backend_version=$(multiphp_default_version) | |
if [ -z "$pool" ] || [ -z "$BACKEND" ]; then | |
pool=$(find -L /etc/php/$backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \)) | |
fi | |
fi | |
if [ ! -e "$pool" ]; then | |
check_result $E_NOTEXIST "php-fpm pool doesn't exist" | |
fi | |
backend_type="$domain" | |
if [ "$WEB_BACKEND_POOL" = 'user' ]; then | |
backend_type="$user" | |
fi | |
if [ -e "$pool/$backend_type.conf" ]; then | |
backend_lsnr=$(grep "listen =" $pool/$backend_type.conf) | |
backend_lsnr=$(echo "$backend_lsnr" | cut -f 2 -d = | sed "s/ //") | |
if [ -n "$(echo $backend_lsnr | grep /)" ]; then | |
backend_lsnr="unix:$backend_lsnr" | |
fi | |
fi |
vs
It looks like we have made some changes to it it might be the reason why it breaks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like as VestaCP doesn't support multiple fpm version is caused the issue
Replacing your line with
ports=$(grep listen /etc/php/*/fpm/pool.d/* | grep -o :[0-9].*)
Seems to work. But how do we provide the port number back to the user.
it would be easier to supply the user with a option to spefiy the port via web domain selection
@@ -62,7 +62,7 @@ delete_web_backend | |||
|
|||
# Allocating backend port | |||
backend_port=9000 | |||
ports=$(grep -v '^;' $pool/* 2> /dev/null | grep listen | grep -o :[0-9].*) | |||
ports=$(grep $pool/* 2> /dev/null | grep -o :[0-9].*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See last comment accidentally approved it
This allows to grep the incremented port also for other backends then php-fpm with
%backend_lsnr%
in the web template.This is an example how I use it in a wsgi app with gunicorn. It works out of the box with this patch applied.
Backend template:
Nginx web template: