Skip to content

Commit

Permalink
give FPM two seconds to start before the web server binds to the port…
Browse files Browse the repository at this point in the history
… and starts accepting traffic. or else fcgi pipe breakage, potentially
  • Loading branch information
dzuelke committed Apr 23, 2014
1 parent 06d8214 commit eb5cbdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bin/heroku-php-apache2
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ echo "Starting log redirection..." >&2
# start FPM; write "php-fpm" to the shared pipe if it exits
echo "Starting php-fpm..." >&2
( php-fpm --nodaemonize -y "$fpm_config" -c "$php_config"; echo "php-fpm"; ) > $wait_pipe &
# wait a few seconds for FPM to finish initializing; otherwise an early request might break Apache with the FastCGI pipe not being ready
# start apache; write "httpd" to the shared pipe if it exits
echo "Starting httpd..." >&2
( httpd -D FOREGROUND -c "Include $httpd_config" || true; echo "httpd"; ) > $wait_pipe &
( sleep 2; httpd -D FOREGROUND -c "Include $httpd_config" || true; echo "httpd"; ) > $wait_pipe &

# wait for something to come from the shared pipe, which means that the given process was killed or has failed
# we'll only reach this if one of the processes above has terminated
Expand Down
3 changes: 2 additions & 1 deletion bin/heroku-php-nginx
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ echo "Starting log redirection..." >&2
# start FPM; write "php-fpm" to the shared pipe if it exits
echo "Starting php-fpm..." >&2
( php-fpm --nodaemonize -y "$fpm_config" -c "$php_config"; echo "php-fpm"; ) > $wait_pipe &
# wait a few seconds for FPM to finish initializing; otherwise an early request might break nginx with the FastCGI pipe not being ready
# start nginx; write "nginx" to the shared pipe if it exits
echo "Starting nginx..." >&2
( nginx -g "daemon off; include $nginx_config;"; echo "nginx"; ) > $wait_pipe &
( sleep 2; nginx -g "daemon off; include $nginx_config;"; echo "nginx"; ) > $wait_pipe &

# wait for something to come from the shared pipe, which means that the given process was killed or has failed
# we'll only reach this if one of the processes above has terminated
Expand Down

0 comments on commit eb5cbdd

Please sign in to comment.