Skip to main content

Installing the docker PHP

At the bottom of Management > Agent installation, click Install Application > Select the Docker PHP tab in Install guide.

This process applies the WhaTap monitoring agent to the PHP application running on the Docker container and packages the container image as follows.

Note

EKS Fargate is to be supported later.

Download agent

Install the whatap-php package when building your PHP application docker image.

x64
RUN wget https://s3.ap-northeast-2.amazonaws.com/repo.whatap.io/alpine/x86_64/whatap-php.tar.gz
RUN tar -xvzf whatap-php.tar.gz -C /

Agent CONFIG.

  • Use the following command to set the installation script. If you enter the WhaTap access key and server IP, the PHP environment data is automatically collected.

    RUN (echo "[Access Key]"; echo "[Server IP]")|/usr/whatap/php/install.sh
  • Using the following method, you can directly enter the PHP environment settings.

    # RUN /usr/whatap/php/install.sh -l [Access Key] -s [Server IP] -v [PHP version x.x] -i [php.ini full path] -p [Process Name] -z [thread safety] 
    RUN /usr/whatap/php/install.sh -l xxxxx -s 1.1.1.1/2.2.2.2 -v 7.0 -i /etc/php.ini -p httpd [-z]
Note

Be careful not to expose the access key to images that are in Docker Public status.

Configuring the container environment variables

After building Docker, set container environment variables in the Kubernetes environment. Add the following items in the yaml file for releasing the application.


env:
- name: NODE_IP
valueFrom: {fieldRef: {fieldPath: status.hostIP}}
- name: NODE_NAME
valueFrom: {fieldRef: {fieldPath: spec.nodeName}}
- name: POD_NAME
valueFrom: {fieldRef: {fieldPath: metadata.name}}

See the following example:

apiVersion: v1
kind: Pod
metadata:
name: # Pod Name
labels: # Pod Labels
spec:
containers:
env:
- name: NODE_IP
valueFrom: {fieldRef: {fieldPath: status.hostIP}}
- name: NODE_NAME
valueFrom: {fieldRef: {fieldPath: spec.nodeName}}
- name: POD_NAME
valueFrom: {fieldRef: {fieldPath: metadata.name}}
Note

Roles of environment variables

  • NODE_IP: Collects the IP address of the node where the current Pod has been hosted.

  • NODE_NAME: Collects the name of the node where the current Pod is running.

  • POD_NAME: Collects the name of the current Pod.

Running the agent

Add the whatap-php startup command before the application startup command.

sh -c "/usr/whatap/php/whatap-php start && [Application Startup Command]"

Execute the following command to check whether the WhaTap service has been run normally. When the application server runs, it begins collecting monitoring information.


ps -ef | grep whatap_php

Checking the agent installation

To check whether the agent has been installed, go to Dashboard > Application service dashboard.

If you have manually installed the downloaded file but cannot see the agent in Dashboard, check the following.

  • Execute the command, ps -ef | grep whatap in the container, and then check whether the agent options have been applied properly.

  • Check the content of the container in the /usr/whatap/php/logs path. The file name of the agent log is displayed as logs/{boot or install}-yyyymmdd.log.