File tree Expand file tree Collapse file tree 7 files changed +48
-5
lines changed Expand file tree Collapse file tree 7 files changed +48
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ LABEL \
1010# ##
1111# ## Build arguments
1212# ##
13- ARG VHOST_GEN_GIT_REF=0.11
13+ ARG VHOST_GEN_GIT_REF=0.12
1414ARG CERT_GEN_GIT_REF=0.2
1515
1616ENV BUILD_DEPS \
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ This Docker container adds a lot of injectables in order to customize it to your
127127| PHP_FPM_ENABLE | bool | ` 0 ` | Enable PHP-FPM for the default vhost and the mass virtual hosts. |
128128| PHP_FPM_SERVER_ADDR | string | `` | IP address or hostname of remote PHP-FPM server.<br /><strong >Required when enabling PHP.</strong > |
129129| PHP_FPM_SERVER_PORT | int | ` 9000 ` | Port of remote PHP-FPM server |
130+ | PHP_FPM_TIMEOUT | int | ` 180 ` | Timeout in seconds to upstream PHP-FPM server |
130131
131132##### Optional environmental variables (default vhost)
132133
Original file line number Diff line number Diff line change @@ -96,3 +96,38 @@ export_php_fpm_server_port() {
9696 # Ensure variable is exported if not set
9797 eval " export ${varname} =${value} "
9898}
99+
100+
101+ # ##
102+ # ## Ensure PHP_FPM_TIMEOUT is set (if needed)
103+ # ##
104+ export_php_fpm_timeout () {
105+ local varname=" ${1} "
106+ local debug=" ${2} "
107+ local value=" 180"
108+
109+ if [ " ${PHP_FPM_ENABLE} " = " 1" ]; then
110+ if ! env_set " ${varname} " ; then
111+ log " info" " \$ ${varname} not specified, keeping default: ${value} " " ${debug} "
112+ else
113+ value=" $( env_get " ${varname} " ) "
114+
115+ if [ -z " ${value} " ]; then
116+ log " err" " \$ ${varname} is empty." " ${debug} "
117+ exit 1
118+ fi
119+ if ! isint " ${value} " ; then
120+ log " err" " \$ ${varname} is not a valid integer: ${value} " " ${debug} "
121+ exit 1
122+ fi
123+ if [ " ${value} " -lt " 0" ]; then
124+ log " err" " \$ ${varname} must be greater than 0: ${value} " " ${debug} "
125+ exit 1
126+ fi
127+ log " info" " PHP-FPM: Timeout: ${value} " " ${debug} "
128+ fi
129+ fi
130+
131+ # Ensure variable is exported if not set
132+ eval " export ${varname} =${value} "
133+ }
Original file line number Diff line number Diff line change @@ -16,13 +16,15 @@ vhost_gen_php_fpm() {
1616 local enable=" ${1} "
1717 local addr=" ${2} "
1818 local port=" ${3} "
19- local config=" ${4} "
20- local debug=" ${5} "
19+ local timeout=" ${4} "
20+ local config=" ${5} "
21+ local debug=" ${6} "
2122
2223 if [ " ${enable} " -eq " 1" ]; then
2324 run " sed -i'' 's/__PHP_ENABLE__/yes/g' ${config} " " ${debug} "
2425 run " sed -i'' 's/__PHP_ADDR__/${addr} /g' ${config} " " ${debug} "
2526 run " sed -i'' 's/__PHP_PORT__/${port} /g' ${config} " " ${debug} "
27+ run " sed -i'' 's/__PHP_TIMEOUT__/${timeout} /g' ${config} " " ${debug} "
2628 else
2729 run " sed -i'' 's/__PHP_ENABLE__/no/g' ${config} " " ${debug} "
2830 fi
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ export_docker_logs "DOCKER_LOGS" "${DEBUG_LEVEL}"
8282export_php_fpm_enable " PHP_FPM_ENABLE" " ${DEBUG_LEVEL} "
8383export_php_fpm_server_addr " PHP_FPM_SERVER_ADDR" " ${DEBUG_LEVEL} "
8484export_php_fpm_server_port " PHP_FPM_SERVER_PORT" " ${DEBUG_LEVEL} "
85+ export_php_fpm_timeout " PHP_FPM_TIMEOUT" " ${DEBUG_LEVEL} "
8586
8687
8788# ##
125126# ##
126127# ## Enable and configure PHP-FPM
127128# ##
128- vhost_gen_php_fpm " ${PHP_FPM_ENABLE} " " ${PHP_FPM_SERVER_ADDR} " " ${PHP_FPM_SERVER_PORT} " " /etc/vhost-gen/main.yml" " ${DEBUG_LEVEL} "
129- vhost_gen_php_fpm " ${PHP_FPM_ENABLE} " " ${PHP_FPM_SERVER_ADDR} " " ${PHP_FPM_SERVER_PORT} " " /etc/vhost-gen/mass.yml" " ${DEBUG_LEVEL} "
129+ vhost_gen_php_fpm " ${PHP_FPM_ENABLE} " " ${PHP_FPM_SERVER_ADDR} " " ${PHP_FPM_SERVER_PORT} " " ${PHP_FPM_TIMEOUT} " " /etc/vhost-gen/main.yml" " ${DEBUG_LEVEL} "
130+ vhost_gen_php_fpm " ${PHP_FPM_ENABLE} " " ${PHP_FPM_SERVER_ADDR} " " ${PHP_FPM_SERVER_PORT} " " ${PHP_FPM_TIMEOUT} " " /etc/vhost-gen/mass.yml" " ${DEBUG_LEVEL} "
130131
131132
132133# ##
Original file line number Diff line number Diff line change @@ -138,6 +138,8 @@ vhost:
138138 # Hostname or IP address
139139 address : __PHP_ADDR__
140140 port : __PHP_PORT__
141+ # Timeout to upstream FPM service
142+ timeout : __PHP_TIMEOUT__
141143 # Create additional aliases
142144 alias :
143145 - alias : /devilbox-api/
Original file line number Diff line number Diff line change @@ -138,6 +138,8 @@ vhost:
138138 # Hostname or IP address
139139 address : __PHP_ADDR__
140140 port : __PHP_PORT__
141+ # Timeout to upstream FPM service
142+ timeout : __PHP_TIMEOUT__
141143 # Create additional aliases
142144 alias :
143145 - alias : /devilbox-api/
You can’t perform that action at this time.
0 commit comments