Skip to content

Commit

Permalink
Merge pull request #1 from heyanlong/php-e2e
Browse files Browse the repository at this point in the history
PHP E2E
  • Loading branch information
simonluo345 authored Sep 14, 2023
2 parents 921d007 + 5516ef7 commit e53c99e
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 11 deletions.
50 changes: 50 additions & 0 deletions test/e2e-v2/cases/php/Dockerfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM php:8.1-fpm-bullseye as builder

ARG SW_AGENT_PHP_COMMIT

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.64.0

WORKDIR /tmp
RUN apt update \
&& apt install -y wget protobuf-compiler libclang-dev git \
&& wget https://static.rust-lang.org/rustup/archive/1.25.1/x86_64-unknown-linux-gnu/rustup-init \
&& chmod +x rustup-init \
&& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host x86_64-unknown-linux-gnu \
&& rm rustup-init \
&& chmod -R a+w $RUSTUP_HOME $CARGO_HOME

RUN git clone https://github.com/apache/skywalking-php.git $(pwd)

RUN git reset --hard ${SW_AGENT_PHP_COMMIT} && git submodule update --init

RUN phpize \
&& ./configure --enable-skywalking_agent \
&& make \
&& make install

FROM php:8.1-fpm-bullseye
RUN apt update \
&& apt install -y nginx \
&& cd / \
&& rm -rf /var/cache/apk/*
COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20210902/skywalking_agent.so /usr/local/lib/php/extensions/no-debug-non-zts-20210902/

ENTRYPOINT ["/entrypoint.sh"]
9 changes: 7 additions & 2 deletions test/e2e-v2/cases/php/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ services:
- 12800

php:
image: skyapm/skywalking-php:v4.2.0-8.0-fpm-alpine
build:
context: .
dockerfile: Dockerfile.php
args:
- SW_AGENT_PHP_COMMIT=${SW_AGENT_PHP_COMMIT}
networks:
- e2e
ports:
Expand All @@ -36,7 +40,8 @@ services:
condition: service_healthy
volumes:
- ./index.php:/var/www/html/index.php
- ./php.ini:/usr/local/etc/php/conf.d/ext-skywalking.ini
- ./php.ini:/usr/local/etc/php/conf.d/ext-skywalking_agent.ini
- ./entrypoint.sh:/entrypoint.sh

provider:
extends:
Expand Down
19 changes: 19 additions & 0 deletions test/e2e-v2/cases/php/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


nginx
php-fpm
62 changes: 62 additions & 0 deletions test/e2e-v2/cases/php/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

server {
listen 8080;
root /var/www/html;
index index.php;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
16 changes: 7 additions & 9 deletions test/e2e-v2/cases/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
; limitations under the License.


[skywalking]
extension=skywalking.so
skywalking.app_code = php
skywalking.enable = 1
skywalking.version = 8
skywalking.grpc = oap:11800
skywalking.error_handler_enable = 0
skywalking.sample_n_per_3_secs = -1
skywalking.instance_name = "php-instance"
[skywalking_agent]
extension = skywalking_agent.so
skywalking_agent.service_name = php
skywalking_agent.enable = 1
skywalking_agent.log_file = /tmp/skywalking-agent.log
skywalking_agent.log_level = DEBUG
skywalking_agent.server_addr = oap:11800

1 change: 1 addition & 0 deletions test/e2e-v2/script/env
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016
SW_KUBERNETES_COMMIT_SHA=e2c61c6774cf377b23516fca6f8a1e119d3191c5
SW_ROVER_COMMIT=fc8d074c6d34ecfee585a7097cbd5aef1ca680a5
SW_BANYANDB_COMMIT=df34a83663d66af9687ff484884ceae669c83980
SW_AGENT_PHP_COMMIT=81e04a242b0b7089e2a43fe72b90614bd2a2ffc5

SW_CTL_COMMIT=9d2d0edccda2afe5cf24f1e632142f40e80e8fa4

0 comments on commit e53c99e

Please sign in to comment.