Install ddtrace via datadog-setup.php on PHP 7.0+#1290
Open
Teko012 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
@mlocati What do you think about this? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On PHP 7.0+ this PR switches the ddtrace installation path from the existing PECL + Cargo build to Datadog's official installer,
datadog-setup.php. The PECL/Cargo path is preserved for PHP <7.0 and as a fallback when a user pins ddtrace to a version below 1.0.0.Why
datadog-setup.phpis Datadog's supported install path for the PHP tracer. Using it keeps the installation aligned with Datadog's release artifacts and version-pinning rules instead of relying on PECL's mirror ofdatadog/dd-trace.ddappsec,datadog-profiling) in lockstep with the matching tracer build, which is awkward to do via PECL.curl-dev automake libtool(Alpine) orlibssl libcurl4-openssl-dev automake libtool(Debian) and adds noticeable build time/image size.What changes
installRemoteModule()— theddtrace)branch (install-php-extensions)The selection logic is reorganized around the PHP version:
installCargo. If a user explicitly requestsddtrace-1.0.0or newer on PHP <7.0, the script now errors out (ddtrace <version> requires PHP 7.0 or later) instead of silently failing later. With no version supplied, it still defaults to0.75.0(newer 0.x releases refuse PHP 5 in theirconfigurescript).installCargopath so older 0.x releases stay reproducible.installDDTracehelper and setinstallRemoteModule_manuallyInstalled=2so the surrounding code skips the standard PECL pipeline (this is the same convention used for other manually-installed modules like blackfire).PECL stability flags (
stable,beta, …) are still resolved viaresolvePeclStabilityVersionbefore any of the branches above run.New
installDDTrace()helper (install-php-extensions)datadog-setup.phpfrom the corresponding GitHub release:https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.phpX.Y.Z→https://github.com/DataDog/dd-trace-php/releases/download/X.Y.Z/datadog-setup.phpphp datadog-setup.php --php-bin=php [extra args].--enable-appsecand/or--enable-profiling.curl $IPE_CURL_FLAGS -sSLffor the download so the existingIPE_INSECURE=1toggle keeps working, and errors out cleanly with a### ERROR ### Failed to download …message if the download fails.datadog-setup.phponce the install completes.New environment variables (
README.md)IPE_DD_APPSEC=1--enable-appsectodatadog-setup.php, installing theddappsecmodule alongside ddtrace. Requires PHP 7.0+ and the 1.x tracer line.IPE_DD_PROFILING=1--enable-profilingtodatadog-setup.php, installing thedatadog-profilingmodule. Requires PHP 7.1+ on Alpine 3.13+ (any Debian works) and the 1.x tracer line.Both follow the existing
IPE_*env-var conventions (accept1,y…,Y…).buildRequiredPackageLists()—ddtrace@alpineandddtrace@debian(install-php-extensions)The development packages that were unconditionally pulled in for ddtrace are now gated behind
PHP_MAJMIN_VERSION -lt 700, because they're only needed by the Cargo build path:curl-dev automake libtool— installed only on PHP <7.0.$buildRequiredPackageLists_libssl libcurl4-openssl-dev automake libtool— installed only on PHP <7.0.For PHP 7.0+ the
datadog-setup.phpflow installs the prebuilt tracer binary, so none of these dev packages are needed.Test script:
scripts/tests/ddtraceAdds an executable PHP test that:
ddtrace_version()is defined and prints the resolved version.IPE_DD_PROFILINGwas set during install, verifies thedatadog-profilingextension is loaded.IPE_DD_APPSECwas set during install, verifies theddappsecextension is loaded.The script exits non-zero on any failure so it can be wired into the existing extension test matrix.
Backwards compatibility
install-php-extensions ddtraceon PHP <7.0 behaves exactly as before (default0.75.0, Cargo build, same build deps).install-php-extensions ddtrace-<0.x.y>on PHP 7.0+ keeps the previous Cargo-based path.datadog-setup.phpinstall — which yields the sameddtraceextension but no longer leavescurl-dev/libcurl4-openssl-dev/automake/libtoollingering as runtime-installed packages.Closes #1163.