From f6d29426ee9b4d6b476c09ca3cb9bed3cf23906f Mon Sep 17 00:00:00 2001 From: Aryan Ishan <54237311+aryanishan1001@users.noreply.github.com> Date: Tue, 24 Sep 2024 13:22:01 +0530 Subject: [PATCH] Almalinux8 support for otel-webserver (#485) --- .github/workflows/webserver.yml | 122 ++++---- .../otel-webserver-module/README.md | 14 +- .../otel-webserver-module/codeql-env.sh | 2 +- .../otel-webserver-module/docker-compose.yml | 41 ++- .../docker/almalinux8/Dockerfile | 262 ++++++++++++++++++ .../docker/centos7/Dockerfile | 2 +- 6 files changed, 373 insertions(+), 70 deletions(-) create mode 100644 instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile diff --git a/.github/workflows/webserver.yml b/.github/workflows/webserver.yml index d6317dccf..b48f5d5ec 100644 --- a/.github/workflows/webserver.yml +++ b/.github/workflows/webserver.yml @@ -102,18 +102,87 @@ jobs: # run: | # rm -rf /tmp/buildx-cache/apache_centos7 # mv /tmp/buildx-cache/apache_centos7-new /tmp/buildx-cache/apache_centos7 + # - 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/ + # - 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 + # - name: run integrationtest + # run: | + # docker ps + # docker rm -f apache_centos7_container + # cd instrumentation/otel-webserver-module + # docker-compose --profile centos7 up -d + # docker ps -a + # sleep 30 + # ./gradlew :test:integration:integrationTests -i + # curl http://localhost:9411/api/v2/spans?serviceName=demoservice + + + webserver-build-test-almalinux8: + name: webserver-almalinux8-build + 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 + # - name: cache docker layers + # uses: actions/cache@v3 + # with: + # path: /tmp/buildx-cache/ + # key: apache-almalinux8-${{ github.sha }} + # restore-keys: | + # apache-almalinux8 + - name: setup docker image + run: | + cd instrumentation/otel-webserver-module + docker buildx build -t apache_almalinux8 -f docker/almalinux8/Dockerfile \ + --load . + - name: build + run: | + cat /etc/os-release + java -version + docker run -idt --name apache_almalinux8_container apache_almalinux8 /bin/bash + cd instrumentation/otel-webserver-module + docker exec apache_almalinux8_container bash -c \ + 'cd /otel-webserver-module; rm -rf *;' + docker cp . $(docker inspect --format="{{.Id}}" apache_almalinux8_container):/otel-webserver-module/ + docker exec apache_almalinux8_container 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_almalinux8_container bash -c \ + 'cd /otel-webserver-module; ./gradlew runUnitTest' + # - name: update cache + # run: | + # rm -rf /tmp/buildx-cache/apache_almalinux8 + # mv /tmp/buildx-cache/apache_almalinux8-new /tmp/buildx-cache/apache_almalinux8 - 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_almalinux8/ + docker cp apache_almalinux8_container:/otel-webserver-module/build/opentelemetry-webserver-sdk-x64-linux.tgz \ + /tmp/apache_almalinux8/ - 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_almalinux8/opentelemetry-webserver-sdk-x64-linux.tgz # - name: run integrationtest # run: | # docker ps @@ -125,51 +194,6 @@ jobs: # ./gradlew :test:integration:integrationTests -i # curl http://localhost:9411/api/v2/spans?serviceName=demoservice - # webserver-build-test-centos6: - # name: webserver-centos6-build - # 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 - # - name: cache docker layers - # uses: actions/cache@v3 - # with: - # path: /tmp/buildx-cache/ - # key: apache-centos6-${{ github.sha }} - # restore-keys: | - # apache-centos6 - # - name: setup docker image - # run: | - # cd instrumentation/otel-webserver-module - # docker buildx build -t apache_centos6 -f Dockerfile \ - # --cache-from type=local,src=/tmp/buildx-cache/apache_centos6 \ - # --cache-to type=local,dest=/tmp/buildx-cache/apache_centos6-new \ - # --load . - # - name: build - # run: | - # docker run -idt --name apache_centos6_container apache_centos6 /bin/bash - # cd instrumentation/otel-webserver-module - # docker exec apache_centos6_container bash -c \ - # 'cd /otel-webserver-module; rm -rf *;' - # docker cp . $(docker inspect --format="{{.Id}}" apache_centos6_container):/otel-webserver-module/ - # docker exec apache_centos6_container 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_centos6_container bash -c \ - # 'cd /otel-webserver-module; ./gradlew runUnitTest' - # - name: update cache - # run: | - # rm -rf /tmp/buildx-cache/apache_centos6 - # mv /tmp/buildx-cache/apache_centos6-new /tmp/buildx-cache/apache_centos6 Codeql-build: name: static-analysis diff --git a/instrumentation/otel-webserver-module/README.md b/instrumentation/otel-webserver-module/README.md index 3e9b622b7..5ebdeea95 100644 --- a/instrumentation/otel-webserver-module/README.md +++ b/instrumentation/otel-webserver-module/README.md @@ -68,7 +68,7 @@ A sample configuration is mentioned in [opentelemetry_module.conf](https://githu #### Platform Supported - The build is supported for **x86-64** platforms. -- OS support: **Centos6**, **Centos7, ubuntu20.04**. +- OS support: **Centos7, Almalinux8, ubuntu20.04**. #### Automatic build and Installation @@ -78,7 +78,7 @@ Then execute the following commands -: docker-compose --profile default build docker-compose --profile default up ``` -Alternatively, replace the value of *profile* from **'default'** to **'centos7'** or **'ubuntu20.04'** to build in respective supported platforms. +Alternatively, replace the value of *profile* from **'default'** to **'centos7'** or **'almalinux8'** or **'ubuntu20.04'** to build in respective supported platforms. This would start the container alongwith the Opentelemetry Collector and Zipkin. You can check the traces on Zipkin dashboard by checking the port number of Zipkin using ```docker ps``` command. Multiple requests can be sent using the browser. @@ -194,15 +194,15 @@ Currently, Nginx Webserver module monitores some fixed set of modules, which get - Supports both stable(1.26.0) and mainline(1.25.5). - Earlier support of v1.18.0 is deprecated. - The build is supported for **x86-64** platforms. -- OS support: **Centos6**, **Centos7, ubuntu20.04**. +- OS support: **Centos7, Almalinux8, ubuntu20.04**. #### Automatic build and Installation We will use Docker to run the Module. First, it is to be made sure that the Docker is up and running. Then execute the following commands -: ``` -docker-compose --profile centos_nginx build -docker-compose --profile centos_nginx up +docker-compose --profile nginx_almalinix8 build +docker-compose --profile nginx_almalinix8 up ``` Alternatively, replace the value of *centos_nginx* from **'centos_nginx'** to **'centos7_nginx'** or **'ubuntu20.04_nginx'** to build in respective supported platforms. @@ -258,14 +258,14 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/opentelemetry-webserver-sdk/sdk_lib ``` ### Usability of the downloaded artifact -The downloaded artifact from [Release/Tag](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases) or [GitHub Actions](https://github.com/open-telemetry/opentelemetry-cpp-contrib/actions/workflows/webserver.yml) is built on CentOS7. This contains shared libraries for both apache and nginx instrumentation. The shared libraries can be located at ```WebServerModule/Apache``` or ```WebServerModule/Nginx``` for respective webservers. But, the common libraries, related to opentelemetry, are located at ```sdk_lib/lib/``` which are used by both apache and nginx instrumentation. +The downloaded artifact from [Release/Tag](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases) or [GitHub Actions](https://github.com/open-telemetry/opentelemetry-cpp-contrib/actions/workflows/webserver.yml) is built on Almalinux8. This contains shared libraries for both apache and nginx instrumentation. The shared libraries can be located at ```WebServerModule/Apache``` or ```WebServerModule/Nginx``` for respective webservers. But, the common libraries, related to opentelemetry, are located at ```sdk_lib/lib/``` which are used by both apache and nginx instrumentation. Currently, artifact is generated on x86-64 is published. **Therefore, the artifact should work on any linux distribution running on x86-64 plarform and having glibc version >= 2.17.** ### Maintainers -* [Debajit Das](https://github.com/DebajitDas), Cisco * [Aryan Ishan](https://github.com/aryanishan1001), Cisco +* [Debajit Das](https://github.com/DebajitDas), Cisco ### Blogs * [Instrument Apache HttpServer with OpenTelemetry](https://opentelemetry.io/blog/2022/instrument-apache-httpd-server/) diff --git a/instrumentation/otel-webserver-module/codeql-env.sh b/instrumentation/otel-webserver-module/codeql-env.sh index 5402efa1b..622816644 100755 --- a/instrumentation/otel-webserver-module/codeql-env.sh +++ b/instrumentation/otel-webserver-module/codeql-env.sh @@ -36,7 +36,7 @@ APRUTIL_VERSION="1.6.1" LOG4CXX_VERSION="0.11.0" GTEST_VERSION="1.10.0" PCRE_VERSION="8.44" -NGINX_VERSION="1.26.0" +NGINX_VERSION="1.26.2" # Install GRPC git clone --shallow-submodules --depth 1 --recurse-submodules -b v${GRPC_VERSION} \ diff --git a/instrumentation/otel-webserver-module/docker-compose.yml b/instrumentation/otel-webserver-module/docker-compose.yml index 6c35ac6ac..deec27993 100644 --- a/instrumentation/otel-webserver-module/docker-compose.yml +++ b/instrumentation/otel-webserver-module/docker-compose.yml @@ -3,18 +3,6 @@ networks: default: name: webserver-network services: - webserver_centos: - build: - context: . - dockerfile: Dockerfile - image: apache_centos - profiles: - - default - hostname: webserver - container_name: webserver_centos - command: bash -c " httpd -k start && tail -f /dev/null " - ports: - - "8000:80" webserver_centos7: build: context: . @@ -43,6 +31,21 @@ services: - "9000:80" depends_on: - otel-collector + webserver_almalinux8: + build: + context: . + dockerfile: docker/almalinux8/Dockerfile + image: apache_almalinux8 + hostname: webserver + container_name: webserver_almalinux8 + command: bash -c "apache2ctl -k start && tail -f /dev/null " + profiles: + - default + - almalinux8 + ports: + - "9000:80" + depends_on: + - otel-collector nginx_centos: build: context: . @@ -85,6 +88,20 @@ services: - "8016:80" depends_on: - otel-collector + nginx_almalinix8: + build: + context: . + dockerfile: docker/almalinux8/Dockerfile + image: nginx_almalinix8 + hostname: webserver + container_name: nginx_almalinix8 + command: bash -c "echo 'hahaha' && tail -f /dev/null" + profiles: + - almalinux8_nginx + ports: + - "8020:80" + depends_on: + - otel-collector # Collector diff --git a/instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile b/instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile new file mode 100644 index 000000000..6a864201b --- /dev/null +++ b/instrumentation/otel-webserver-module/docker/almalinux8/Dockerfile @@ -0,0 +1,262 @@ +FROM almalinux:8.10 + +ARG BUILD_NUMBER + +LABEL NAME=apm/build-image-webserver-agent-centos6-x64 VERSION=$BUILD_NUMBER + +ENV GOSU_ARCH amd64 +ENV JDK_ARCH x64 + +ARG PYTHON_VERSION="2.7.18" +ARG CMAKE_VERSION="3.20" +ARG CMAKE_0VERSION="3.20.0" +ARG GRPC_VERSION="1.36.4" +ARG OPENTELEMETRY_VERSION="1.2.0" +ARG BOOST_VERSION="1.75.0" +ARG BOOST_FILENAME="boost_1_75_0" +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_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 PERL_VERSION="5.20.2" +ARG PERL_CPANVERSION="5.0" +ARG PCRE_VERSION="8.44" +ARG NGINX_VERSION="1.26.0" + +# create default non-root user +RUN groupadd -r swuser && useradd -u 1000 -g swuser -m -s /sbin/nologin -c "default non-root user" swuser + +RUN chmod -R 777 /opt + +# install required packages + + +RUN dnf install wget -y \ + && dnf install java-1.8.0-openjdk -y \ + && dnf install java-1.8.0-openjdk-devel -y \ + && dnf install pcre-devel -y \ + && dnf install httpd -y \ + && dnf install git -y + +RUN dnf groupinstall "Development Tools" -y \ + && dnf install wget bzip2 xz-devel openssl-devel libffi-devel zlib-devel -y + + +# install python 2.7.18 +RUN wget http://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz \ + && unxz Python-${PYTHON_VERSION}.tar.xz \ + && tar -xf Python-${PYTHON_VERSION}.tar \ + && cd Python-${PYTHON_VERSION} && ./configure --prefix=/usr/local && make && make install \ + && cd .. \ + && rm -rf Python-${PYTHON_VERSION}.tar.xz && rm -rf Python-${PYTHON_VERSION}.tar + + +ENV GOSU_VERSION=1.10 + +RUN curl -o /usr/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" \ + && chmod +x /usr/bin/gosu \ + # Verify that the binary works + && gosu nobody true + +# install cmake 3.20 +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 \ + && cp -rf * /usr/local/ \ + && cd .. && rm -rf cmake-${CMAKE_0VERSION}-linux-x86_64.tar.gz + + +# install grpc. If planning to upgrade, make sure sed command works +RUN git clone https://github.com/grpc/grpc \ + && cd grpc \ + && git checkout tags/v${GRPC_VERSION} -b v${GRPC_VERSION} \ + && git submodule update --init \ + && sed -i "s/target_link_libraries(bssl ssl crypto)/target_link_libraries(bssl ssl crypto rt)/g" third_party/boringssl-with-bazel/CMakeLists.txt \ + && mkdir -p cmake/build \ + && cd cmake/build \ + && cmake ../.. -DgRPC_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DgRPC_ABSL_PROVIDER=module -DgRPC_CARES_PROVIDER=module -DgRPC_PROTOBUF_PROVIDER=module -DgRPC_RE2_PROVIDER=module -DgRPC_SSL_PROVIDER=module -DgRPC_ZLIB_PROVIDER=module \ + && make \ + && make install \ + && cd ../../.. + + +# Create dependencies folder to store all dependencies. +RUN mkdir -p dependencies + +# install boost version 1.75.0 +RUN wget https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_FILENAME}_rc1.tar.gz \ + && tar -xvf ${BOOST_FILENAME}_rc1.tar.gz \ + && cd ${BOOST_FILENAME} \ + && ./bootstrap.sh --with-libraries=filesystem,system --prefix=/dependencies/boost/${BOOST_VERSION}/ \ + && ./b2 install define=BOOST_ERROR_CODE_HEADER_ONLY link=static threading=multi cxxflags="-fvisibility=hidden -fPIC" cflags="-fvisibility=hidden -fPIC" \ + && cd .. && rm -rf ${BOOST_FILENAME} && rm ${BOOST_FILENAME}_rc1.tar.gz + +#install Apr +RUN mkdir -p dependencies/apr/${APR_VERSION} \ + && wget https://archive.apache.org/dist/apr/apr-${APR_VERSION}.tar.gz --no-check-certificate \ + && tar -xf apr-${APR_VERSION}.tar.gz \ + && cd apr-${APR_VERSION} \ + && ./configure --prefix=/dependencies/apr/${APR_VERSION} --enable-static=yes --enable-shared=no --with-pic && echo $? \ + && make -j 6 \ + && make install \ + && cd ../ && rm -rf apr-${APR_VERSION} && rm -rf apr-${APR_VERSION}.tar.gz + +# install libexpat +RUN mkdir -p dependencies/expat/${EXPAT_VERSION} \ + && wget https://github.com/libexpat/libexpat/releases/download/${EXPAT_RVERSION}/expat-${EXPAT_VERSION}.tar.gz --no-check-certificate \ + && tar -xf expat-${EXPAT_VERSION}.tar.gz \ + && cd expat-${EXPAT_VERSION} \ + && ./configure --prefix=/dependencies/expat/${EXPAT_VERSION} --enable-static=yes --enable-shared=no --with-pic && echo $? \ + && make -j 6 \ + && make install \ + && cd ../ && rm -rf expat-${EXPAT_VERSION} && rm -rf expat-${EXPAT_VERSION}.tar.gz + +# install Apr-util +RUN mkdir -p dependencies/apr-util/${APRUTIL_VERSION} \ + && wget https://archive.apache.org/dist/apr/apr-util-${APRUTIL_VERSION}.tar.gz --no-check-certificate \ + && tar -xf apr-util-${APRUTIL_VERSION}.tar.gz \ + && cd apr-util-${APRUTIL_VERSION} \ + && ./configure --prefix=/dependencies/apr-util/${APRUTIL_VERSION} --enable-static=yes --enable-shared=no --with-pic --with-apr=/dependencies/apr/${APR_VERSION} --with-expat=/dependencies/expat/${EXPAT_VERSION} && echo $? \ + && make -j 6 \ + && make install \ + && cd ../ && rm -rf apr-util-${APRUTIL_VERSION} && rm -rf apr-util-${APRUTIL_VERSION}.tar.gz + + +# install autoconf +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 \ + && cd .. && rm -rf autoconf-${AUTOCONF_VERSION}.tar.gz + +# install automake +RUN wget --no-check-certificate https://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VERSION}.tar.gz \ + && tar xzf automake-${AUTOMAKE_VERSION}.tar.gz \ + && cd automake-${AUTOMAKE_VERSION} \ + && ./configure --prefix=/usr --libdir=/usr/lib64 \ + && make -j && make install \ + && automake --version \ + && cd .. && rm -rf automake-${AUTOMAKE_VERSION}.tar.gz + +# install libtool +RUN wget --no-check-certificate https://ftpmirror.gnu.org/libtool/libtool-${LIBTOOL_VERSION}.tar.gz \ + && tar xzf libtool-${LIBTOOL_VERSION}.tar.gz \ + && cd libtool-${LIBTOOL_VERSION} \ + && ./configure --prefix=/usr \ + && make -j 6 \ + && make install \ + && libtool --version \ + && cd .. && rm -rf libtool--${LIBTOOL_VERSION}.tar.gz + +#install log4cxx +RUN mkdir -p dependencies/apache-log4cxx/${LOG4CXX_VERSION} \ + && wget https://archive.apache.org/dist/logging/log4cxx/${LOG4CXX_VERSION}/apache-log4cxx-${LOG4CXX_VERSION}.tar.gz --no-check-certificate \ + && tar -xf apache-log4cxx-${LOG4CXX_VERSION}.tar.gz \ + && cd apache-log4cxx-${LOG4CXX_VERSION} \ + && ./configure --prefix=/dependencies/apache-log4cxx/${LOG4CXX_VERSION}/ --enable-static=yes --enable-shared=no --with-pic --with-apr=/dependencies/apr/${APR_VERSION}/ --with-apr-util=/dependencies/apr-util/${APRUTIL_VERSION}/ && echo $? \ + && make -j 6 ; echo 0 \ + && automake --add-missing \ + && make install \ + && cd .. && rm -rf apache-log4cxx-${LOG4CXX_VERSION}.tar.gz && rm -rf apache-log4cxx-${LOG4CXX_VERSION} + +# install opentelemetry +RUN mkdir -p dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/lib \ + && mkdir -p dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/include \ + && git clone https://github.com/open-telemetry/opentelemetry-cpp \ + && cd opentelemetry-cpp/ \ + && git checkout tags/v${OPENTELEMETRY_VERSION} -b v${OPENTELEMETRY_VERSION} \ + && git submodule update --init --recursive \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DWITH_OTLP=ON -DCMAKE_INSTALL_PREFIX=/dependencies/opentelemetry/${OPENTELEMETRY_VERSION} \ + && cmake --build . --target all \ + && cd .. \ + && find . -name "*.so" -type f -exec cp {} /dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/lib/ \; \ + && cp build/libopentelemetry_proto.a /dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/lib \ + && cp -r api/include/ /dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/ \ + && for dir in exporters/*; do if [ -d "$dir" ]; then cp -rf "$dir/include" /dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/; fi; done \ + && cp -r sdk/include/ /dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/ \ + && cp -r build/generated/third_party/opentelemetry-proto/opentelemetry/proto/ /dependencies/opentelemetry/${OPENTELEMETRY_VERSION}/include/opentelemetry/ \ + && cd .. && rm -rf opentelemetry-cpp + +# install googletest +RUN mkdir -p dependencies/googletest/${GTEST_VERSION}/ \ + && wget https://github.com/google/googletest/archive/refs/tags/release-${GTEST_VERSION}.tar.gz --no-check-certificate \ + && tar -xf release-${GTEST_VERSION}.tar.gz \ + && cd googletest-release-${GTEST_VERSION}/ \ + && mkdir build && cd build \ + && cmake .. -DCMAKE_INSTALL_PREFIX=/dependencies/googletest/${GTEST_VERSION}/ \ + && make \ + && make install \ + && cd ../.. && rm -rf release-${GTEST_VERSION}.tar.gz && rm -rf googletest-release-${GTEST_VERSION}/ + +# install pcre +RUN mkdir -p dependencies/pcre/${PCRE_VERSION}/ \ + && wget https://ftp.exim.org/pub/pcre/pcre-${PCRE_VERSION}.tar.gz --no-check-certificate \ + && tar -xvf pcre-${PCRE_VERSION}.tar.gz \ + && cd pcre-${PCRE_VERSION} \ + && ./configure --prefix=/dependencies/pcre/${PCRE_VERSION} --enable-jit \ + && make && make install \ + && cd .. && rm -rf ${PCRE_VERSION}.tar.gz && rm -rf pcre-${PCRE_VERSION} + +#Installing Apache and apr source code +RUN mkdir build-dependencies \ + && wget --no-check-certificate https://archive.apache.org/dist/apr/apr-${APR_VERSION}.tar.gz \ + && tar -xf apr-${APR_VERSION}.tar.gz \ + && mv -f apr-${APR_VERSION} build-dependencies \ + && wget --no-check-certificate https://archive.apache.org/dist/apr/apr-util-${APRUTIL_VERSION}.tar.gz \ + && tar -xf apr-util-${APRUTIL_VERSION}.tar.gz \ + && mv -f apr-util-${APRUTIL_VERSION} build-dependencies \ + && wget --no-check-certificate http://archive.apache.org/dist/httpd/httpd-2.2.31.tar.gz \ + && tar -xf httpd-2.2.31.tar.gz \ + && mv -f httpd-2.2.31 build-dependencies \ + && wget --no-check-certificate http://archive.apache.org/dist/httpd/httpd-2.4.23.tar.gz \ + && tar -xf httpd-2.4.23.tar.gz \ + && mv -f httpd-2.4.23 build-dependencies + +# install nginx +RUN wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \ + && tar -xvf nginx-${NGINX_VERSION}.tar.gz -C /build-dependencies \ + && rm -rf nginx-${NGINX_VERSION}.tar.gz + +# Build Webserver Module +COPY . /otel-webserver-module + +RUN cp -r /dependencies /otel-webserver-module/ \ + && cp -r /build-dependencies /otel-webserver-module/ \ + && cd otel-webserver-module \ + && ./gradlew assembleWebServerModule + +RUN echo '[nginx-stable]' >> /etc/yum.repos.d/nginx.repo \ + && echo 'name=nginx stable repo' >> /etc/yum.repos.d/nginx.repo \ + && echo 'baseurl=http://nginx.org/packages/centos/8/$basearch/' >> /etc/yum.repos.d/nginx.repo \ + && echo 'gpgcheck=1' >> /etc/yum.repos.d/nginx.repo \ + && echo 'enabled=1' >> /etc/yum.repos.d/nginx.repo \ + && echo 'gpgkey=https://nginx.org/keys/nginx_signing.key' >> /etc/yum.repos.d/nginx.repo \ + && echo 'module_hotfixes=true' >> /etc/yum.repos.d/nginx.repo \ + && dnf install nginx-${NGINX_VERSION} -y + +RUN cd /otel-webserver-module/build \ + && tar -xf opentelemetry-webserver-sdk-x64-linux.tgz \ + && mv -f opentelemetry-webserver-sdk /opt/ \ + && cd ../ \ + && cp opentelemetry_module.conf /etc/httpd/conf/ \ + && sed -i "s/libmod_apache_otel22.so/libmod_apache_otel.so/g" /etc/httpd/conf/opentelemetry_module.conf \ + && echo 'Include conf/opentelemetry_module.conf' >> /etc/httpd/conf/httpd.conf \ + && cd /opt/opentelemetry-webserver-sdk \ + && ./install.sh \ + && cd / + + +RUN cp /otel-webserver-module/conf/nginx/opentelemetry_module.conf /opt/ \ + && sed -i '8i load_module /opt/opentelemetry-webserver-sdk/WebServerModule/Nginx/1.26.2/ngx_http_opentelemetry_module.so;' /etc/nginx/nginx.conf \ + && sed -i '33i include /opt/opentelemetry_module.conf;' /etc/nginx/nginx.conf \ + && cd / + +COPY entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["entrypoint.sh"] \ No newline at end of file diff --git a/instrumentation/otel-webserver-module/docker/centos7/Dockerfile b/instrumentation/otel-webserver-module/docker/centos7/Dockerfile index 3f6c1d187..4efe31583 100644 --- a/instrumentation/otel-webserver-module/docker/centos7/Dockerfile +++ b/instrumentation/otel-webserver-module/docker/centos7/Dockerfile @@ -303,4 +303,4 @@ RUN rm -rf grpc && rm -rf autoconf-${AUTOCONF_VERSION} && rm -rf automake-${AUTO && rm -f httpd-2.2.31.tar.gz && rm -f httpd-2.4.23.tar.gz COPY entrypoint.sh /usr/local/bin/ -ENTRYPOINT ["entrypoint.sh"] +ENTRYPOINT ["entrypoint.sh"] \ No newline at end of file