diff --git a/docker/app/entrypoint.sh b/docker/app/entrypoint.sh index 50ede26..ac409a5 100644 --- a/docker/app/entrypoint.sh +++ b/docker/app/entrypoint.sh @@ -53,6 +53,23 @@ refresh_config_cache() { php artisan view:clear >/dev/null 2>&1 || true } +ensure_help_cache() { + cd "$APP_TARGET" + + if [[ "${HELP_SYNC_ON_BOOT:-auto}" == "0" ]]; then + return + fi + + if [[ "${HELP_SYNC_ON_BOOT:-auto}" == "1" ]]; then + php artisan help:sync >/dev/null 2>&1 || true + return + fi + + if ! compgen -G "$APP_TARGET/storage/app/help/*/*/articles.json" > /dev/null; then + php artisan help:sync >/dev/null 2>&1 || true + fi +} + wait_for_service() { local name="$1" host="$2" port="$3" timeout="$4" local start @@ -120,6 +137,7 @@ ensure_helper_scripts prepare_storage refresh_config_cache wait_for_dependencies +ensure_help_cache cd "$APP_TARGET" exec "$@" diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf index 1c67192..11e50f9 100644 --- a/docker/nginx/default.conf +++ b/docker/nginx/default.conf @@ -20,6 +20,10 @@ server { fastcgi_pass app:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto; + fastcgi_param HTTP_X_FORWARDED_HOST $http_x_forwarded_host; + fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for; + fastcgi_param HTTPS $http_x_forwarded_proto; fastcgi_buffer_size 32k; fastcgi_buffers 8 16k; } diff --git a/tests/Feature/Help/HelpSyncServiceTest.php b/tests/Feature/Help/HelpSyncServiceTest.php new file mode 100644 index 0000000..87d7de9 --- /dev/null +++ b/tests/Feature/Help/HelpSyncServiceTest.php @@ -0,0 +1,24 @@ +app->make(HelpSyncService::class); + $result = $service->sync(); + + $this->assertNotEmpty($result); + Storage::disk('local')->assertExists('help/guest/en/articles.json'); + Storage::disk('local')->assertExists('help/guest/de/articles.json'); + } +}