diff --git a/.assets/bootstrap.php b/.assets/bootstrap.php index 4295235..6b41619 100644 --- a/.assets/bootstrap.php +++ b/.assets/bootstrap.php @@ -35,8 +35,8 @@ use Cake\Core\Configure; use Cake\Core\Configure\Engine\PhpConfig; use Cake\Datasource\ConnectionManager; -use Cake\Error\ConsoleErrorHandler; -use Cake\Error\ErrorHandler; +use Cake\Error\ErrorTrap; +use Cake\Error\ExceptionTrap; use Cake\Http\ServerRequest; use Cake\Log\Log; use Cake\Mailer\Mailer; @@ -89,6 +89,15 @@ Configure::load('app_local', 'default'); } +/** + * This try catch can be removed after install + */ +try { + Configure::load('swagger_bake', 'default', false); +} catch(\Exception $e) { + triggerWarning($e->getMessage() . '. Run `bin/cake mixerapi install` to clear this warning'); +} + /* * When debug = true the metadata cache should only last * for a short time. @@ -120,17 +129,13 @@ /* * Register application error and exception handlers. */ -$isCli = PHP_SAPI === 'cli'; -if ($isCli) { - (new ConsoleErrorHandler(Configure::read('Error')))->register(); -} else { - (new ErrorHandler(Configure::read('Error')))->register(); -} +(new ErrorTrap(Configure::read('Error')))->register(); +(new ExceptionTrap(Configure::read('Error')))->register(); /* * Include the CLI bootstrap overrides. */ -if ($isCli) { +if (PHP_SAPI === 'cli') { require __DIR__ . '/bootstrap_cli.php'; } diff --git a/.docker/php/docker-entrypoint.sh b/.docker/php/docker-entrypoint.sh index 42d04ba..873f25d 100644 --- a/.docker/php/docker-entrypoint.sh +++ b/.docker/php/docker-entrypoint.sh @@ -16,7 +16,7 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/cakephp' ]; then fi COMPOSER_MEMORY_LIMIT=-1 - composer create-project --prefer-dist --no-interaction cakephp/app:^4.2 . + composer create-project --prefer-dist --no-interaction cakephp/app:^4.4 . rm -rf .github cp config/.env.example config/.env cp config/app_local.example.php config/app_local.php @@ -24,12 +24,12 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/cakephp' ]; then sed -i '/export APP_NAME/c\export APP_NAME="cakephp"' config/.env - salt=$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) + salt=$(openssl rand -base64 32) sed -i '/export SECURITY_SALT/c\export SECURITY_SALT="'$salt'"' config/.env touch .gitkeep - composer require mixerapi/mixerapi + composer require mixerapi/mixerapi -W # optional: composer require mixerapi/crud @@ -50,6 +50,7 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/cakephp' ]; then mkdir -p logs tmp + # Set ACLs for Linux users echo "HOST OS: $HOST_OS" if [[ $HOST_OS == *"Linux"* ]]; then echo "Setting ACLs..." diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 802c230..74c88ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,8 @@ jobs: - name: Start run: docker-compose up -d - name: Wait for services - run: sleep 5 - - name: HTTP Check - run: curl -v -o /dev/null http://localhost:8080 + run: sleep 10 + - name: Check CakePHP Welcome Page + run: curl -f -v -o /dev/null http://localhost:8080 + - name: Check NGINX Files + run: curl -f -v -o /dev/null http://localhost:8080/css/home.css diff --git a/Dockerfile b/Dockerfile index 37772cc..fc01936 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,8 +35,10 @@ COPY .assets /srv/.assets WORKDIR /srv/app -RUN addgroup -g 101 nginx RUN adduser --disabled-password --gecos '' -u $UID cakephp; +RUN addgroup -g 101 nginx +RUN addgroup cakephp nginx +RUN addgroup cakephp www-data COPY --from=composer /usr/bin/composer /usr/bin/composer