diff --git a/apache-run.sh b/apache-run.sh index bfef85e..48ee6c5 100755 --- a/apache-run.sh +++ b/apache-run.sh @@ -2,31 +2,6 @@ set -e -rm -f $CONTAINER_STARTED_LOCK - -if [[ ${XDEBUG_ENABLED} == true ]]; then - sudo -E xdebug-set-mode ${XDEBUG_MODE:-debug} -fi - -sudo -E newrelic-setup -sudo -E opcache-setup - -if [[ ${SESSION_HANDLER} == true ]]; then - sudo rm -f /usr/local/etc/php/conf.d/session-handler.ini - echo "session.save_handler = ${SESSION_HANDLER_NAME}" | sudo tee -a /usr/local/etc/php/conf.d/session-handler.ini - echo "session.save_path = \"${SESSION_HANDLER_PATH}\"" | sudo tee -a /usr/local/etc/php/conf.d/session-handler.ini -fi - -sudo rm -rf var/cache/* var/logs/* && - sudo mkdir -p /var/www/html/var/cache && - sudo mkdir -p /var/www/html/var/logs && - sudo mkdir -p /var/www/html/var/sessions && - sudo chown -R www-data:www-data /var/www/html/var/cache && chmod 777 /var/www/html/var/cache && - sudo chown -R www-data:www-data /var/www/html/var/logs && chmod 777 /var/www/html/var/logs && - sudo chown -R www-data:www-data /var/www/html/var/sessions && chmod 777 /var/www/html/var/sessions - -post-startup-hook - -touch $CONTAINER_STARTED_LOCK +server-warmup exec apache2-foreground diff --git a/bin/server-warmup b/bin/server-warmup new file mode 100755 index 0000000..f23a3f1 --- /dev/null +++ b/bin/server-warmup @@ -0,0 +1,28 @@ +#!/bin/bash + +rm -f $CONTAINER_STARTED_LOCK + +if [[ ${XDEBUG_ENABLED} == true ]]; then + sudo -E xdebug-set-mode ${XDEBUG_MODE:-debug} +fi + +sudo -E newrelic-setup +sudo -E opcache-setup + +if [[ ${SESSION_HANDLER} == true ]]; then + sudo rm -f /usr/local/etc/php/conf.d/session-handler.ini + echo "session.save_handler = ${SESSION_HANDLER_NAME}" | sudo tee -a /usr/local/etc/php/conf.d/session-handler.ini + echo "session.save_path = \"${SESSION_HANDLER_PATH}\"" | sudo tee -a /usr/local/etc/php/conf.d/session-handler.ini +fi + +sudo rm -rf var/cache/* var/logs/* && + sudo mkdir -p /var/www/html/var/cache && + sudo mkdir -p /var/www/html/var/logs && + sudo mkdir -p /var/www/html/var/sessions && + sudo chown -R www-data:www-data /var/www/html/var/cache && chmod 777 /var/www/html/var/cache && + sudo chown -R www-data:www-data /var/www/html/var/logs && chmod 777 /var/www/html/var/logs && + sudo chown -R www-data:www-data /var/www/html/var/sessions && chmod 777 /var/www/html/var/sessions + +post-startup-hook + +touch $CONTAINER_STARTED_LOCK