Skip to content

Commit 22cab5d

Browse files
authored
Merge pull request hestiacp#1448 from hestiacp/staging/fixes
Staging/fixes
2 parents 5a2e1ee + 1d43a44 commit 22cab5d

26 files changed

+452
-12
lines changed

bin/v-add-letsencrypt-domain

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ query_le_v2() {
5555
# Save http response to file passed as "$4" arg or print to stdout if not provided
5656
# http response headers are always sent to stdout
5757
local save_to_file=${4:-"/dev/stdout"}
58-
curl --silent --dump-header /dev/stdout --data "$post_data" "$1" --header "$content" --output "$save_to_file"
58+
curl --location --insecure --retry 5 --retry-connrefused --silent --dump-header /dev/stdout --data "$post_data" "$1" --header "$content" --output "$save_to_file"
59+
debug_log "API call" "exit status: $?"
5960
}
6061

6162

@@ -410,10 +411,31 @@ if [[ "$status" -ne 200 ]]; then
410411
fi
411412

412413
# Downloading signed certificate / STEP 7
413-
answer=$(query_le_v2 "$certificate" "" "$nonce" "$ssl_dir/$domain.pem")
414-
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
414+
status=0
415+
retry=0
416+
417+
while [[ $status != 200 && $retry -lt 3 ]]; do
418+
419+
answer=$(query_le_v2 "$certificate" "" "$nonce" "$ssl_dir/$domain.pem")
420+
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
421+
422+
debug_log "Step 7" "- status: ${status}\n- retry: ${retry}\n- answer: ${answer}"
423+
424+
if [[ $status != 200 ]]; then
425+
retry=$((retry + 1))
426+
sleep $((retry * 2)) # Sleep for 2s, 4s, 6s, 8s
427+
fi
428+
429+
done
430+
431+
# Fallback on depreciated download method for certs (unauthenticated GET)
432+
if [[ $status != 200 ]]; then
433+
answer=$(curl --insecure --retry 5 --retry-connrefused --silent --dump-header /dev/stdout "$certificate" --output "$ssl_dir/$domain.pem")
434+
status=$(echo "$answer"|grep HTTP/ |tail -n1 |cut -f 2 -d ' ')
435+
436+
debug_log "Step 7 - Fallback" "- status: ${status}\n- answer: ${answer}"
437+
fi
415438

416-
debug_log "Step 7" "- status: ${status}\n- answer: ${answer}"
417439
debug_log "CERT DIR" "$(ls -las "$ssl_dir/")"
418440
debug_log "CERT PEM" "$(cat "$ssl_dir/$domain.pem")"
419441

bin/v-add-user-composer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ if [[ "$signature" != $(sha384sum $COMPOSER_SETUP_FILE | cut -f 1 -d " ") ]]; th
7373
check_result $E_INVALID "Composer signature does not match"
7474
fi
7575

76-
COMPOSER_HOME="$HOMEDIR/$user/.config/composer" user_exec /usr/bin/php "$COMPOSER_SETUP_FILE" --quiet --install-dir="$COMPOSER_DIR" --filename=composer
76+
COMPOSER_HOME="$HOMEDIR/$user/.config/composer" user_exec /usr/bin/php "$COMPOSER_SETUP_FILE" --1 --quiet --install-dir="$COMPOSER_DIR" --filename=composer
7777
check_result $? "Composer install failed"
7878

7979
[ -f "$COMPOSER_SETUP_FILE" ] && rm -f "$COMPOSER_SETUP_FILE"

bin/v-add-web-php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# options: VERSION
44
# labels: hestia
55
#
6-
# example: v-add-web-php 7.4
6+
# example: v-add-web-php 8.0
77
#
88
# The function checks and delete a fpm php version if not used by any domain.
99

@@ -32,7 +32,7 @@ php_fpm="/etc/init.d/php$version-fpm"
3232
# Verify php version format
3333
if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
3434
echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
35-
echo "Example: 7.0, 7.4"
35+
echo "Example: 7.0, 7.4, 8.0"
3636
exit
3737
fi
3838

@@ -67,6 +67,11 @@ if [[ `echo "$version 7.2" | awk '{print ($1 < $2)}'` == 1 ]]; then
6767
mph="$mph php$version-mcrypt"
6868
fi
6969

70+
# Check if version is 8.0 or higher and drop php json.
71+
if [[ ${version:0:1} == "8" ]]; then
72+
mph=$(echo "$mph" | sed -e "s/php$version-json//")
73+
fi
74+
7075
if ! echo "$DB_SYSTEM" | grep -w 'mysql' >/dev/null; then
7176
mph=$(echo "$mph" | sed -e "s/php$version-mysql//")
7277
fi

bin/v-update-sys-rrd-pgsql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ for host in $hosts; do
7676
done
7777

7878
export PGPASSWORD="$PASSWORD"
79-
sql="psql -h $HOST -U $USER -c"
79+
sql="psql -h $HOST -U $USER"
8080

8181
# Checking empty vars
8282
if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ]; then
@@ -88,7 +88,7 @@ for host in $hosts; do
8888
# Parsing data
8989
q='SELECT SUM(xact_commit + xact_rollback), SUM(numbackends)
9090
FROM pg_stat_database;'
91-
status=$($sql plsql -d postgres -c "$q" 2>/dev/null); code="$?"
91+
status=$($sql -d postgres -c "$q" 2>/dev/null); code="$?"
9292
if [ '0' -ne "$code" ]; then
9393
active=0
9494
slow=0

install/deb/multiphp/apache2/PHP-56.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ ! -f "$pool_file_56" ]; then
5051
echo "$pool_conf" > $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-70.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-71.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-72.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-73.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

install/deb/multiphp/apache2/PHP-74.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
4545
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
4646
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
4747
pool_file_74="/etc/php/7.4/fpm/pool.d/$2.conf"
48+
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
4849

4950
if [ -f "$pool_file_56" ]; then
5051
rm $pool_file_56
@@ -76,4 +77,9 @@ if [ ! -f "$pool_file_74" ]; then
7677
service php7.4-fpm restart
7778
fi
7879

80+
if [ -f "$pool_file_80" ]; then
81+
rm $pool_file_80
82+
service php8.0-fpm restart
83+
fi
84+
7985
exit 0

0 commit comments

Comments
 (0)