Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports more specific plan combinations for PHP + web servers #114

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

pivotal-david-osullivan
Copy link
Contributor

@pivotal-david-osullivan pivotal-david-osullivan commented Jun 21, 2024

Summary

When used with the PHP buildpack and HTTPD as the webserver, the httpd/apache agent is installed instead of PHP.
To support this combination, as well as PHP + nginx, new plan entries for these combinations have been added.

Use Cases

Tested Paketo PHP sample with both nginx and httpd as the server, both download the PHP agent

[builder] Paketo Buildpack for Dynatrace 11.0.0
[builder]   https://github.com/paketo-buildpacks/dynatrace
[builder]   Dynatrace OneAgent 1.291.121.20240531-083741: Contributing to layer
[builder]   Warning: Dependency has no SHA256. Skipping cache.
[builder]     Downloading from https://<url>.live.dynatrace.com/api/v1/deployment/installer/agent/unix/paas/latest?bitness=64&skipMetadata=true&arch=x86&include=php
[builder]     Expanding to /layers/paketo-buildpacks_dynatrace/dynatrace-oneagent
[builder]     Writing env.launch/BPI_DYNATRACE_BUILDPACK_ID.default
[builder]     Writing env.launch/BPI_DYNATRACE_BUILDPACK_VERSION.default
[builder]     Writing env.launch/DT_CUSTOM_PROP.append
[builder]     Writing env.launch/DT_CUSTOM_PROP.delim
[builder]     Writing env.launch/DT_LOGSTREAM.default
[builder]     Writing env.launch/LD_PRELOAD.delim
[builder]     Writing env.launch/LD_PRELOAD.prepend
[builder]   Launch Helper: Contributing to layer
[builder]     Creating /layers/paketo-buildpacks_dynatrace/helper/exec.d/properties`

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@pivotal-david-osullivan pivotal-david-osullivan added semver:patch A change requiring a patch version bump type:bug A general bug labels Jun 21, 2024
@pivotal-david-osullivan pivotal-david-osullivan requested a review from a team as a code owner June 21, 2024 16:15
@anthonydahanne
Copy link
Member

Hello @dmikusa !
I've reviewed and tested this work from @pivotal-david-osullivan

Test context

~/workspaces/paketo-buildpacks/samples/php/httpd main* 12s ❯ tree 
.
├── README.md
├── bindings
│   └── Dynatrace
│       ├── api-token
│       ├── environment-id
│       └── type
├── htdocs
│   └── index.php
└── project.toml

Before

pack build php-httpd-sample --volume "/Users/anthonyd2/workspaces/paketo-buildpacks/samples/php/httpd/bindings:/bindings" --env SERVICE_BINDING_ROOT=/bindings  --buildpack paketo-buildpacks/php -b paketobuildpacks/dynatrace:latest --builder paketobuildpacks/builder-jammy-full
[...]
===> DETECTING
target distro name/version labels not found, reading /etc/os-release file
7 of 15 buildpacks participating
paketo-buildpacks/ca-certificates 3.8.0
paketo-buildpacks/php-dist        2.3.7
paketo-buildpacks/httpd           0.7.19
paketo-buildpacks/php-fpm         0.2.31
paketo-buildpacks/php-httpd       0.3.27
paketo-buildpacks/php-start       0.4.27
paketo-buildpacks/dynatrace       5.8.0
[...]
Paketo Buildpack for Dynatrace 5.8.0
  https://github.com/paketo-buildpacks/dynatrace
  Dynatrace OneAgent 1.291.121.20240531-083741: Contributing to layer
  Warning: Dependency has no SHA256. Skipping cache.
    Downloading from https://neh11396.live.dynatrace.com/api/v1/deployment/installer/agent/unix/paas/latest?bitness=64&skipMetadata=true&arch=x86&include=apache
[...]
Successfully built image php-httpd-sample

You can notice it downloaded the apache flavor of the agent, not the php one

docker run --volume "/Users/anthonyd2/workspaces/paketo-buildpacks/samples/php/httpd/bindings:/bindings" --env SERVICE_BINDING_ROOT=/bindings --env PORT=9999 -p 9999:9999  -it php-httpd-sample

Configuring Dynatrace properties
[21-Jun-2024 18:16:13] NOTICE: PHP message: PHP Warning:  PHP Startup: Dynatrace Bootstrap Agent (failed, see agent log for details): Unable to initialize module
Module compiled with module API=0
PHP    compiled with module API=20210902
These options need to match
 in Unknown on line 0

[...]

and it fails because the image does not have the proper agent

After

pack build php-httpd-sample --volume "/Users/anthonyd2/workspaces/paketo-buildpacks/samples/php/httpd/bindings:/bindings" 
--env SERVICE_BINDING_ROOT=/bindings  --buildpack paketo-buildpacks/php -b /Users/anthonyd2/workspaces/paketo-buildpacks/dynatrace/linux/amd64 --builder paketobuildpacks/builder-jammy-full
[...]
===> DETECTING
target distro name/version labels not found, reading /etc/os-release file
7 of 15 buildpacks participating
paketo-buildpacks/ca-certificates 3.8.0
paketo-buildpacks/php-dist        2.3.7
paketo-buildpacks/httpd           0.7.19
paketo-buildpacks/php-fpm         0.2.31
paketo-buildpacks/php-httpd       0.3.27
paketo-buildpacks/php-start       0.4.27
paketo-buildpacks/dynatrace       {{.version}}
[...]
Paketo Buildpack for Dynatrace {{.version}}
  https://github.com/paketo-buildpacks/dynatrace
  Dynatrace OneAgent 1.291.121.20240531-083741: Contributing to layer
  Warning: Dependency has no SHA256. Skipping cache.
    Downloading from https://neh11396.live.dynatrace.com/api/v1/deployment/installer/agent/unix/paas/latest?bitness=64&skipMetadata=true&arch=x86&include=php
[...]
Successfully built image php-httpd-sample

You can notice it downloaded the php flavor of the agent, as expected.

docker run --volume "/Users/anthonyd2/workspaces/paketo-buildpacks/samples/php/httpd/bindings:/bindings" --env SERVICE_BINDING_ROOT=/bindings --env PORT=9999 -p 9999:9999  -it php-httpd-sample

Configuring Dynatrace properties
[Fri Jun 21 18:17:49.901389 2024] [mpm_event:notice] [pid 41:tid 46912510732160] AH00489: Apache/2.4.59 (Unix) configured -- resuming normal operations
[Fri Jun 21 18:17:49.902768 2024] [mpm_event:info] [pid 41:tid 46912510732160] AH00490: Server built: May  8 2024 22:03:19
[Fri Jun 21 18:17:49.903075 2024] [core:notice] [pid 41:tid 46912510732160] AH00094: Command line: 'httpd -f /layers/paketo-buildpacks_php-httpd/php-httpd-config/httpd.conf -D FOREGROUND'

[...]

It works properly and uses the php agent as expected.

@dmikusa dmikusa merged commit b6a3a5b into main Jun 21, 2024
5 checks passed
@dmikusa dmikusa deleted the php-fix branch June 21, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch A change requiring a patch version bump type:bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants