Skip to content

Commit

Permalink
Almalinux8 support for otel-webserver (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanishan1001 authored Sep 24, 2024
1 parent 22e7fe2 commit f6d2942
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 70 deletions.
122 changes: 73 additions & 49 deletions .github/workflows/webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions instrumentation/otel-webserver-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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/)
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/otel-webserver-module/codeql-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand Down
41 changes: 29 additions & 12 deletions instrumentation/otel-webserver-module/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand Down Expand Up @@ -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: .
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit f6d2942

Please sign in to comment.