For PHP version 7.0 and above
The PHP agent (PHP version 7.0 and above) can be deployed in a Kubernetes environment using any of the following methods.
You can also keep the license keys in a configmap to avoid using them in the deployment files.
Modifying the Dockerfile
Follow the steps given in this
help page to achieve the following:
- Install the PHP agent and S247DataExporter in the same docker container during the image build.
- Start the DataExporter using an Entry Point Script.
Instead of using an Entry Point Script, you can modify the Helm chart to start the S247DataExporter.
Helm chart modification to start the S247DataExporter:
- lifecycle:
- postStart:
- exec:
- command: ["/bin/sh", "-c", "/opt/S247DataExporter/bin/service.sh run"]
Without modifying the Dockerfile
For PHP version below 7.0
The PHP agent (PHP version below 7.0) can be deployed in a Kubernetes environment using any of the following methods.
Without Helm charts
- You can include the installation script when building the container. This is similar to the docker installation method. For more information, please refer to our docker installation help documentation.
- You can include the installation script in the Post Life Cycle hooks of Kubernetes YAML.
Add the following in the Kubernetes deployment YAML file:
- lifecycle:
- preStop:
- exec:
- command: ["/bin/bash", "-c", "service zpdpsvc stop;"]
- postStart:
- exec:
- command: ["/bin/bash", "-c", "wget https://staticdownloads.site24x7.com/apminsight/scripts/s247apmphpinstall.sh && ./s247apmphpinstall.sh -key=<site24x7 license key> -appname=<App name to be shown in APM> ; /etc/init.d/apache2 reload ;" ]
The /etc/init.d/apache2 reload command in the above example is for Apache-based server. If you are using NGINX or FPM based server, you'll need to add the command kill -USR2 1.
With Helm charts
If you are deploying with Helm, you can include the installation script in the Helm charts file.
Add the following to the template folder or deployment.yaml, or if you prefer to use values.yaml, configure as follows:
- site24x7:
- apikey: <site24x7 license key>
- appname: <App name to be shown in APM>
Use the following configuration in lifecycle hooks:
You can also keep the license keys in a configmap to avoid using them in the deployment files.