Skip to content

Commit

Permalink
otel-webserver support for arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
Fydon committed Jun 4, 2024
1 parent e11348b commit f7e0a28
Show file tree
Hide file tree
Showing 10 changed files with 247 additions and 65 deletions.
195 changes: 168 additions & 27 deletions .github/workflows/webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:
- '.github/workflows/webserver.yml'

jobs:
webserver-build-test-ubuntu:
name: webserver-ubuntu-build
webserver-build-test-ubuntu-x64:
name: webserver-ubuntu-build-x64
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
Expand All @@ -24,6 +24,7 @@ jobs:
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/amd64
- name: cache docker layers
uses: actions/cache@v3
with:
Expand All @@ -34,18 +35,18 @@ jobs:
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_ubuntu -f docker/ubuntu20.04/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu \
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu-new \
docker buildx build -t apache_ubuntu_amd64 -f docker/ubuntu20.04/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_amd64 \
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_amd64-new \
--load .
- name: build
run: |
docker run -idt --name apache_ubuntu_container apache_ubuntu /bin/bash
docker run -idt --name apache_ubuntu_container_amd64 apache_ubuntu_amd64 /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_ubuntu_container bash -c \
docker exec apache_ubuntu_container_amd64 bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container):/otel-webserver-module/
docker exec apache_ubuntu_container bash -c \
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_amd64):/otel-webserver-module/
docker exec apache_ubuntu_container_amd64 bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \
Expand All @@ -54,20 +55,91 @@ jobs:
- name: update cache
run: |
rm -rf /tmp/buildx-cache/apache_ubuntu
mv /tmp/buildx-cache/apache_ubuntu-new /tmp/buildx-cache/apache_ubuntu
rm -rf /tmp/buildx-cache/apache_ubuntu_amd64
mv /tmp/buildx-cache/apache_ubuntu_amd64-new /tmp/buildx-cache/apache_ubuntu_amd64
webserver-build-test-centos7:
name: webserver-centos7-build
webserver-build-test-ubuntu-arm64:
name: webserver-ubuntu-build-arm64
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@master
- name: setup buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/arm64
- name: cache docker layers
uses: actions/cache@v3
with:
path: /tmp/buildx-cache/
key: apache-ubuntu-20.04-${{ github.sha }}
restore-keys: |
apache-ubuntu-20.04
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_ubuntu_arm64 -f docker/ubuntu20.04/Dockerfile \
--cache-from type=local,src=/tmp/buildx-cache/apache_ubuntu_arm64 \
--cache-to type=local,dest=/tmp/buildx-cache/apache_ubuntu_arm64-new \
--load . --platform linux/arm64
- name: build
run: |
docker run -idt --platform linux/arm64 --name apache_ubuntu_container_arm64 apache_ubuntu_arm64 /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_ubuntu_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_ubuntu_container_arm64):/otel-webserver-module/
docker exec apache_ubuntu_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \
./gradlew assembleWebServerModule -DtargetSystem=ubuntu'
# - name: unit test
# run: |
# docker exec apache_ubuntu_container_arm64 bash -c \
# 'cd /otel-webserver-module; ./gradlew runUnitTest'
- name: update cache
run: |
rm -rf /tmp/buildx-cache/apache_ubuntu_arm64
mv /tmp/buildx-cache/apache_ubuntu_arm64-new /tmp/buildx-cache/apache_ubuntu_arm64
# - name: copy artifacts
# id: artifacts
# run: |
# cd instrumentation/otel-webserver-module
# mkdir -p /tmp/apache_ubuntu_arm64/
# docker cp apache_ubuntu_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
# /tmp/apache_ubuntu_arm64/
# - name: upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: opentelemetry-webserver-sdk-arm64-linux.tgz
# path: /tmp/apache_ubuntu_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
# - name: run integrationtest
# run: |
# docker rm -f apache_ubuntu_container_arm64
# cd instrumentation/otel-webserver-module
# docker compose --profile ubuntu20.04 up -d
# docker ps -a
# sleep 30
# ./gradlew :test:integration:integrationTests -i

webserver-build-test-centos7-x64:
name: webserver-centos7-build-x64
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
uses: actions/checkout@v3
- name: setup buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/amd64
# - name: cache docker layers
# uses: actions/cache@v3
# with:
Expand All @@ -78,45 +150,114 @@ jobs:
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_centos7 -f docker/centos7/Dockerfile \
docker buildx build -t apache_centos7_amd64 -f docker/centos7/Dockerfile \
--load .
- name: build
run: |
docker run -idt --name apache_centos7_container apache_centos7 /bin/bash
docker run -idt --name apache_centos7_container_amd64 apache_centos7_amd64 /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_centos7_container bash -c \
docker exec apache_centos7_container_amd64 bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container):/otel-webserver-module/
docker exec apache_centos7_container bash -c \
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_amd64):/otel-webserver-module/
docker exec apache_centos7_container_amd64 bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \
./gradlew assembleWebServerModule'
- name: unit test
run: |
docker exec apache_centos7_container bash -c \
docker exec apache_centos7_container_amd64 bash -c \
'cd /otel-webserver-module; ./gradlew runUnitTest'
# - name: update cache
# run: |
# rm -rf /tmp/buildx-cache/apache_centos7
# mv /tmp/buildx-cache/apache_centos7-new /tmp/buildx-cache/apache_centos7
# rm -rf /tmp/buildx-cache/apache_centos7_amd64
# mv /tmp/buildx-cache/apache_centos7_amd64-new /tmp/buildx-cache/apache_centos7_amd64
- name: copy artifacts
id: artifacts
run: |
cd instrumentation/otel-webserver-module
mkdir -p /tmp/apache_centos7/
docker cp apache_centos7_container:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
/tmp/apache_centos7/
mkdir -p /tmp/apache_centos7_amd64/
docker cp apache_centos7_container_amd64:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \
/tmp/apache_centos7_amd64/
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: opentelemetry-webserver-sdk-x64-linux.tgz
path: /tmp/apache_centos7/opentelemetry-webserver-sdk-x64-linux.tgz
path: /tmp/apache_centos7_amd64/opentelemetry-webserver-sdk-x64-linux.tgz
- name: run integrationtest
run: |
docker rm -f apache_centos7_container_amd64
cd instrumentation/otel-webserver-module
docker compose --profile centos7 up -d
docker ps -a
sleep 30
./gradlew :test:integration:integrationTests -i
webserver-build-test-centos7-arm64:
name: webserver-centos7-build-arm64
runs-on: ubuntu-20.04
steps:
- name: checkout otel webserver
uses: actions/checkout@v3
- name: setup qemu
uses: docker/setup-qemu-action@master
- name: setup buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
install: true
platforms: linux/arm64
# - name: cache docker layers
# uses: actions/cache@v3
# with:
# path: /tmp/buildx-cache/
# key: apache-centos7-${{ github.sha }}
# restore-keys: |
# apache-centos7
- name: setup docker image
run: |
cd instrumentation/otel-webserver-module
docker buildx build -t apache_centos7_arm64 -f docker/centos7/Dockerfile \
--load . --platform linux/arm64 --build-arg BUILD_ARCH='arm64' \
--build-arg CMAKE_ARCH='aarch64' --build-arg GOSU_ARCH='arm64' \
--build-arg JDK_ARCH='aarch64' --build-arg NGINX_ARCH='aarch64'
- name: build
run: |
docker run -idt --platform linux/arm64 --name apache_centos7_container_arm64 apache_centos7_arm64 /bin/bash
cd instrumentation/otel-webserver-module
docker exec apache_centos7_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf *;'
docker cp . $(docker inspect --format="{{.Id}}" apache_centos7_container_arm64):/otel-webserver-module/
docker exec apache_centos7_container_arm64 bash -c \
'cd /otel-webserver-module; rm -rf build; \
cp -r /dependencies /otel-webserver-module/; \
cp -r /build-dependencies /otel-webserver-module/; \
./gradlew assembleWebServerModule'
- name: unit test
run: |
docker exec apache_centos7_container_arm64 bash -c \
'cd /otel-webserver-module; ./gradlew runUnitTest'
# - name: update cache
# run: |
# rm -rf /tmp/buildx-cache/apache_centos7_arm64
# mv /tmp/buildx-cache/apache_centos7_arm64-new /tmp/buildx-cache/apache_centos7_arm64
- name: copy artifacts
id: artifacts
run: |
cd instrumentation/otel-webserver-module
mkdir -p /tmp/apache_centos7_arm64/
docker cp apache_centos7_container_arm64:/otel-webserver-module/build/opentelemetry-webserver-sdk-arm64-linux.tgz \
/tmp/apache_centos7_arm64/
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: opentelemetry-webserver-sdk-arm64-linux.tgz
path: /tmp/apache_centos7_arm64/opentelemetry-webserver-sdk-arm64-linux.tgz
- name: run integrationtest
run: |
docker rm -f apache_centos7_container
docker rm -f apache_centos7_container_arm64
cd instrumentation/otel-webserver-module
docker-compose --profile centos7 up -d
docker compose --profile centos7 up -d
docker ps -a
sleep 30
./gradlew :test:integration:integrationTests -i
Expand Down
34 changes: 20 additions & 14 deletions instrumentation/otel-webserver-module/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
FROM centos:6.9

ARG BUILD_NUMBER
ARG BUILD_ARCH='x64'

LABEL NAME=apm/build-image-webserver-agent-centos6-x64 VERSION=$BUILD_NUMBER
LABEL NAME=apm/build-image-webserver-agent-centos6-${BUILD_ARCH} VERSION=$BUILD_NUMBER

ENV GOSU_ARCH amd64
ENV JDK_ARCH x64
ARG GOSU_ARCH='amd64'
ENV GOSU_ARCH=${GOSU_ARCH}
ARG JDK_ARCH='x64'
ENV JDK_ARCH=${JDK_ARCH}

ARG PYTHON_VERSION="2.7.8"
ARG PYTHON_VERSION="2.7.18"
ARG CMAKE_ARCH='x86_64'
ARG CMAKE_VERSION="3.20"
ARG CMAKE_0VERSION="3.20.0"
ARG GRPC_VERSION="1.36.4"
Expand All @@ -18,12 +22,14 @@ ARG APR_VERSION="1.7.0"
ARG EXPAT_VERSION="2.3.0"
ARG EXPAT_RVERSION="R_2_3_0"
ARG APRUTIL_VERSION="1.6.1"
ARG AUTOCONF_BUILD_TYPE='x86_64-unknown-linux-gnu'
ARG AUTOCONF_VERSION="2.68"
ARG LIBTOOL_VERSION="2.4.6"
ARG LOG4CXX_VERSION="0.11.0"
ARG GTEST_VERSION="1.10.0"
ARG AUTOMAKE_VERSION="1.16.3"
ARG PCRE_VERSION="8.44"
ARG NGINX_ARCH='x86_64'
ARG NGINX_VERSION="1.26.0"


Expand Down Expand Up @@ -73,9 +79,9 @@ RUN wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERS
&& rm -rf Python-${PYTHON_VERSION}.tar.xz && rm -rf Python-${PYTHON_VERSION}.tar

# install gosu for easy step-down from root (from https://github.com/tianon/gosu/blob/master/INSTALL.md#from-centos)
ENV GOSU_VERSION=1.10
ENV GOSU_VERSION=1.11

RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \
RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}" \
&& chmod +x /usr/bin/gosu \
# Verify that the binary works
&& gosu nobody true
Expand All @@ -85,11 +91,11 @@ RUN yum install git -y \
&& yum clean all

# install cmake
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz \
&& cd cmake-${CMAKE_0VERSION}-linux-x86_64 \
RUN wget https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
&& tar -xvf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz \
&& cd cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH} \
&& cp -rf * /usr/local/ \
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz
&& cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-${CMAKE_ARCH}.tar.gz

# install grpc. If planning to upgrade, make sure sed command works
RUN git clone https://github.com/grpc/grpc \
Expand Down Expand Up @@ -152,7 +158,7 @@ RUN yum install m4 -y
RUN wget --no-check-certificate https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz \
&& tar xzf autoconf-${AUTOCONF_VERSION}.tar.gz \
&& cd autoconf-${AUTOCONF_VERSION} \
&& ./configure --prefix=/usr/ && make -j && make install && autoconf -V \
&& ./configure --prefix=/usr/ --build=${AUTOCONF_BUILD_TYPE} && make -j && make install && autoconf -V \
&& cd .. && rm -rf autoconf-${AUTOCONF_VERSION}.tar.gz

# install automake
Expand Down Expand Up @@ -257,13 +263,13 @@ RUN cp -r /dependencies /otel-webserver-module/ \

RUN echo '[nginx]' >> /etc/yum.repos.d/nginx.repo \
&& echo 'name=nginx repo' >> /etc/yum.repos.d/nginx.repo \
&& echo 'baseurl=https://nginx.org/packages/centos/6/x86_64' >> /etc/yum.repos.d/nginx.repo \
&& echo "baseurl=https://nginx.org/packages/centos/6/${NGINX_ARCH}" >> /etc/yum.repos.d/nginx.repo \
&& echo 'gpgcheck=0' >> /etc/yum.repos.d/nginx.repo \
&& echo 'enabled=1' >> /etc/yum.repos.d/nginx.repo \
&& yum install nginx -y

RUN cd /otel-webserver-module/build \
&& tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \
&& tar -xf opentelemetry-webserver-sdk-${BUILD_ARCH}-linux.tgz \
&& mv -f opentelemetry-webserver-sdk /opt/ \
&& cd ../ \
&& cp opentelemetry_module.conf /etc/httpd/conf/ \
Expand All @@ -278,7 +284,7 @@ RUN cp /otel-webserver-module/conf/nginx/opentelemetry_module.conf /opt/ \
&& cd /

# Remove unwanted files
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-x86_64 \
RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTOMAKE_VERSION} && rm -rf cmake-${CMAKE_VERSION}-linux-${CMAKE_ARCH} \
&& rm -rf libtool-${LIBTOOL_VERSION} && rm -rf Python-${PYTHON_VERSION} \
&& rm -f apr-${APR_VERSION}.tar.gz && rm -f apr-util-${APRUTIL_VERSION}.tar.gz \
&& rm -f httpd-2.2.31.tar.gz && rm -f httpd-2.4.23.tar.gz
Expand Down
Loading

0 comments on commit f7e0a28

Please sign in to comment.