From ba62380b6b5c2ae2ffd4076ee9fa93de3b85a8ae Mon Sep 17 00:00:00 2001 From: Peter Lieverdink Date: Fri, 27 Oct 2023 12:38:55 +1100 Subject: [PATCH] chore: Add in Elastic APM so we may have an easier time of doing debugs in the future. Refs: OPS-IWANNASOIDO --- docker/99-elastic-apm-custom.ini | 19 +++++++++++++++++++ docker/Dockerfile | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100644 docker/99-elastic-apm-custom.ini 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