Skip to content

Commit

Permalink
Merge pull request #414 from groldan/yjp
Browse files Browse the repository at this point in the history
Install Yourkit Java Profiler agent in the geoserver base image
  • Loading branch information
groldan authored Jan 20, 2024
2 parents 1106ec0 + 0f515a3 commit feabe78
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .env.yjp.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This is a sample docker compose env file to run the geoserver services
# with the Yourkit Java Profiles connection broker.
# Copy as .yjp.env and replace <broker-id> and <broker-token> with the values
# sent to you by email.
# Then run with docker compose --env-file .env --env-file .env.yjp -f ... up -d
# See https://www.yourkit.com/docs/connection-broker/2023.9/help/

YJP_OPTS=-agentpath:/usr/local/YourKit-JavaProfiler-2023.9/bin/linux-x86-64/libyjpagent.so=broker_url=https://broker.yourkit.com/<broker-id>/,broker_token=<broker-token>

WFS_JAVA_OPTS=$YJP_OPTS,sessionname=wfs-service
WMS_JAVA_OPTS=$YJP_OPTS,sessionname=wms-service
WCS_JAVA_OPTS=$YJP_OPTS,sessionname=wcs-service
WPS_JAVA_OPTS=$YJP_OPTS,sessionname=wps-service
REST_JAVA_OPTS=$YJP_OPTS,sessionname=rest-service
WEBUI_JAVA_OPTS=$YJP_OPTS,sessionname=webui-service
GWC_JAVA_OPTS=$YJP_OPTS,sessionname=gwc-service

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ docker-compose_datadir*
/.metadata/

.vscode

# Yourkit Java Profiler docker compose env file with private token
.env.yjp
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ services:
- discovery
environment:
SPRING_PROFILES_ACTIVE: "${GEOSERVER_DEFAULT_PROFILES}"
JAVA_OPTS: "${GWC_JAVA_OPTS}"
RETRY_MAX_ATTEMPTS: 100
networks:
- gs-cloud-network
Expand Down
9 changes: 9 additions & 0 deletions src/apps/base-images/geoserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ ARG TAG=latest
FROM geoservercloud/gs-cloud-base-jre:$TAG as builder
ARG JAR_FILE=target/gs-cloud-*-bin.jar

RUN apt update && apt install -y --no-install-recommends unzip

COPY ${JAR_FILE} application.jar

RUN java -Djarmode=layertools -jar application.jar extract

RUN wget -q https://www.yourkit.com/download/docker/YourKit-JavaProfiler-2023.9-docker.zip -P /tmp/ && \
unzip /tmp/YourKit-JavaProfiler-2023.9-docker.zip -d /tmp && \
rm /tmp/YourKit-JavaProfiler-2023.9-docker.zip

##########
FROM geoservercloud/gs-cloud-base-spring-boot:$TAG

Expand All @@ -25,6 +31,8 @@ fonts-roboto \
&& rm -rf /var/cache/apt/* \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /tmp/YourKit-JavaProfiler-2023.9 /usr/local/YourKit-JavaProfiler-2023.9

RUN mkdir -p /opt/app/data_directory /data/geowebcache \
&& chmod 0777 /opt/app/data_directory /data/geowebcache

Expand All @@ -36,3 +44,4 @@ WORKDIR /opt/app/bin
COPY --from=builder dependencies/ ./
COPY --from=builder snapshot-dependencies/ ./
COPY --from=builder spring-boot-loader/ ./

0 comments on commit feabe78

Please sign in to comment.