-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from commercetools/datadog-sdk
DEVX-390 - PHP sdk set up for Datadog
- Loading branch information
Showing
11 changed files
with
131 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ logs | |
/lambda/.serverless/ | ||
.idea/ | ||
docs/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,6 @@ var/ | |
vendor/ | ||
.editorconfig | ||
.env.*.local | ||
.env.local | ||
docker/php/.env.sample | ||
.env.local.php | ||
.env.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
|
||
###> symfony/framework-bundle ### | ||
/.env.local | ||
/docker/php/.env.local | ||
/.env.local.php | ||
/.env.*.local | ||
/config/secrets/prod/prod.decrypt.private.php | ||
/public/bundles/ | ||
/var/ | ||
/vendor/ | ||
/.env | ||
###< symfony/framework-bundle ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,45 @@ | ||
version: "3.4" | ||
|
||
version: '3.8' | ||
|
||
services: | ||
application: | ||
php-datadog: | ||
build: | ||
context: docker/php | ||
dockerfile: Dockerfile | ||
args: | ||
NEWRELIC_KEY: "<newrelic license key>" | ||
NEWRELIC_APP_NAME: "PHP_SDK" | ||
tty: true | ||
ports: | ||
- 9000:9000 | ||
context: ./docker/php | ||
dockerfile: Dockerfile.datadog | ||
environment: | ||
- DD_SERVICE=symfony-app | ||
- DD_AGENT_HOST=datadog-agent | ||
- DD_TRACE_AGENT_PORT=8126 | ||
- DD_API_KEY=${DD_API_KEY} | ||
- DD_TRACE_DEBUG=true | ||
- DD_LOGS_ENABLED=true | ||
- DD_PROCESS_AGENT_ENABLED=true | ||
volumes: | ||
- .:/var/www/symfony | ||
- ./var/logs/newrelic:/var/log/newrelic | ||
- ./docker/php/.env.sample:/var/www/symfony/.env | ||
expose: | ||
- "9000" | ||
|
||
nginx: | ||
build: | ||
context: docker/nginx | ||
context: ./docker/nginx | ||
dockerfile: Dockerfile | ||
ports: | ||
- 8080:80 | ||
links: | ||
- application | ||
- "8080:80" | ||
depends_on: | ||
- php-datadog | ||
volumes: | ||
- ./var/logs/nginx:/var/log/nginx | ||
- .:/var/www/symfony | ||
|
||
datadog-agent: | ||
image: datadog/agent:latest | ||
environment: | ||
- DD_API_KEY=${DD_API_KEY} | ||
- DD_SITE=datadoghq.com | ||
- DD_APM_ENABLED=true | ||
ports: | ||
- "127.0.0.1:8126:8126/tcp" | ||
volumes: | ||
- "/var/run/docker.sock:/var/run/docker.sock:ro" | ||
- "/proc/:/host/proc/:ro" | ||
- "/sys/fs/cgroup/:/host/sys/fs/cgroup:ro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM php:8.2-fpm | ||
|
||
# Install necessary packages and PHP extensions | ||
RUN apt-get update \ | ||
&& apt-get install -y apt-utils wget git curl libicu-dev zlib1g-dev libonig-dev libzip-dev gnupg2 \ | ||
&& docker-php-ext-install intl mbstring zip \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Download Datadog setup script from the latest release and move it in /usr/local/bin | ||
RUN curl -LO https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php \ | ||
&& mv datadog-setup.php /usr/local/bin/datadog-setup.php \ | ||
&& chmod +x /usr/local/bin/datadog-setup.php | ||
|
||
# Copy Datadog configuration and setup script | ||
COPY conf.d/datadog.ini /usr/local/etc/php/conf.d/ | ||
|
||
# Copy the .env.sample file from host to the container | ||
COPY .env.sample /var/www/symfony/.env.sample | ||
|
||
# Run the setup script | ||
RUN php /usr/local/bin/datadog-setup.php --php-bin=all --enable-appsec --enable-profiling | ||
|
||
HEALTHCHECK --interval=30s --timeout=5s CMD curl -f http://localhost/ || exit 1 | ||
|
||
WORKDIR /var/www/symfony/public | ||
|
||
EXPOSE 9000 | ||
|
||
CMD ["php-fpm", "-F"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Dockerfile for New Relic | ||
FROM php:8.2-fpm | ||
|
||
ARG NEWRELIC_KEY | ||
ARG NEWRELIC_APP_NAME | ||
|
||
# Install necessary packages and New Relic | ||
RUN apt-get update \ | ||
&& apt-get install -y apt-utils wget git curl libicu-dev zlib1g-dev libonig-dev libzip-dev gnupg2 \ | ||
&& docker-php-ext-install intl mbstring zip \ | ||
&& echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | tee /etc/apt/sources.list.d/newrelic.list \ | ||
&& wget -qO - https://download.newrelic.com/548C16BF.gpg | apt-key add - \ | ||
&& apt-get update \ | ||
&& apt-get install -y newrelic-php5 \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy New Relic configuration files | ||
COPY conf.d/newrelic.ini /usr/local/etc/php/conf.d/ | ||
COPY conf.d/60-user.ini /usr/local/etc/php/conf.d/ | ||
|
||
# Configure New Relic | ||
RUN sed -i \ | ||
-e 's/"REPLACE_WITH_REAL_KEY"/'"$NEWRELIC_KEY"'/' \ | ||
-e 's/newrelic.appname = "PHP Application"/newrelic.appname = '"$NEWRELIC_APP_NAME"'/' \ | ||
/usr/local/etc/php/conf.d/newrelic.ini | ||
|
||
WORKDIR /var/www/symfony/public | ||
|
||
EXPOSE 9000 | ||
|
||
CMD ["php-fpm", "-F"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[datadog] | ||
ddtrace.request_init_hook=/opt/datadog-php/ddtrace-sources/bridge/dd_wrap_autoloader.php | ||
ddtrace.enabled=true | ||
ddtrace.agent_host=${DD_AGENT_HOST} | ||
ddtrace.agent_port=${DD_TRACE_AGENT_PORT} | ||
ddtrace.service=symfony-app | ||
ddtrace.env=${DD_ENV} |