diff --git a/docker/99-elastic-apm-custom.ini b/docker/99-elastic-apm-custom.ini new file mode 100644 index 00000000..2d26cbf7 --- /dev/null +++ b/docker/99-elastic-apm-custom.ini @@ -0,0 +1,19 @@ +; This file contains the various settings for the Elastic APM PHP agent. For +; further details refers to the following URL: +; https://www.elastic.co/guide/en/apm/agent/php/current/configuration-reference.html +; + +[elastic] +elastic_apm.enabled = ${PHP_ELASTIC_APM_ENABLED} +;elastic_apm.api_key = "REPLACE_WITH_API_KEY" +elastic_apm.environment = "${PHP_ELASTIC_APM_ENVIRONMENT}" +elastic_apm.log_level = "INFO" +elastic_apm.log_level_stderr = "INFO" +elastic_apm.secret_token = "${PHP_ELASTIC_APM_TOKEN}" +;elastic_apm.server_timeout = "30s" +elastic_apm.server_url = "${PHP_ELASTIC_APM_SERVER}" +elastic_apm.service_name = "${PHP_ELASTIC_APM_SERVICE}" +elastic_apm.service_version = ${GIT_SHA} +;elastic_apm.transaction_max_spans = 500 +;elastic_apm.transaction_sample_rate = 1.0 +;elastic_apm.verify_server_cert = true diff --git a/docker/Dockerfile b/docker/Dockerfile index 992b6a0e..8822b418 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -61,3 +61,9 @@ COPY --from=builder /srv/www/composer.patches.json /srv/www/composer.patches.jso COPY --from=builder /srv/www/composer.lock /srv/www/composer.lock COPY --from=builder /srv/www/symfony.lock /srv/www/symfony.lock COPY --from=builder /srv/www/PATCHES /srv/www/PATCHES +COPY --from=builder /srv/www/docker/99-elastic-apm-custom.ini /tmp/99-elastic-apm-custom.ini + +RUN curl -L -o /tmp/apm-agent-php_all.apk https://github.com/elastic/apm-agent-php/releases/download/v1.10.0/apm-agent-php_1.10.0_all.apk && \ + apk add --allow-untrusted /tmp/apm-agent-php_all.apk && \ + rm -f /tmp/apm-agent-php_all.apk && \ + mv -f /tmp/99-elastic-apm-custom.ini /etc/php82/conf.d/99-elastic-apm-custom.ini diff --git a/html/modules/custom/gms_pdflink/src/Controller/PrintSectionController.php b/html/modules/custom/gms_pdflink/src/Controller/PrintSectionController.php index 1868d5a7..4a4c07f5 100644 --- a/html/modules/custom/gms_pdflink/src/Controller/PrintSectionController.php +++ b/html/modules/custom/gms_pdflink/src/Controller/PrintSectionController.php @@ -148,6 +148,7 @@ public function viewPrint($export_type, $entity_type, $entity_id) { $response = new RedirectResponse($base_url, 301); $response->send(); } + return $response; } @@ -208,9 +209,16 @@ public function downloadPdf($entity_type, $entity_id) { ' . $content . ' - '; - echo $html; - die; + '; + + // This could *possibly* be an HtmlResponse but things seem to work as-is. + $response = new Response(); + $response->headers->set('Pragma', 'no-cache'); + $response->headers->set('Content-type', 'text/html; charset=utf-8'); + $response->headers->set('Cache-control', 'private'); + $response->headers->set('Content-length', strlen($html)); + $response->setContent($html); + $response->send(); } else { global $base_url; @@ -218,6 +226,7 @@ public function downloadPdf($entity_type, $entity_id) { $response = new RedirectResponse($base_url, 301); $response->send(); } + return $response; } } diff --git a/html/modules/custom/gms_pdflink/src/Controller/ViewPdfController.php b/html/modules/custom/gms_pdflink/src/Controller/ViewPdfController.php index 1b9f5c07..e970d2ce 100644 --- a/html/modules/custom/gms_pdflink/src/Controller/ViewPdfController.php +++ b/html/modules/custom/gms_pdflink/src/Controller/ViewPdfController.php @@ -143,6 +143,7 @@ public function viewPrint($export_type, $entity_type, $entity_id) { $response = new RedirectResponse($base_url, 301); $response->send(); } + return $response; } }