Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newrelic agent to keycloak #3528

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ services:
- '8088:8080'
environment:
- KEYCLOAK_ADMIN_EMAIL=admin@example.com
# Uncomment for local new relic tracking
# - NEW_RELIC_LICENSE_KEY=
# - NEW_RELIC_APP_NAME=keycloak-local
volumes:
- "./services/keycloak/profile.properties:/opt/jboss/keycloak/standalone/configuration/profile.properties"
- "./services/keycloak/startup-scripts:/opt/jboss/startup-scripts"
Expand Down
7 changes: 6 additions & 1 deletion services/keycloak/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENV LAGOON_VERSION=$LAGOON_VERSION

USER root

RUN microdnf install -y nc jq \
RUN microdnf install -y nc jq unzip \
&& microdnf clean all \
&& rm -rf /var/cache/yum

Expand All @@ -40,6 +40,11 @@ RUN rm -f /bin/sh && ln -s /bin/bash /bin/sh
RUN architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) \
&& curl -sL https://github.com/krallin/tini/releases/download/v0.19.0/tini-${architecture} -o /sbin/tini && chmod a+x /sbin/tini

RUN cd /opt \
&& curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip \
&& unzip newrelic-java.zip \
&& rm newrelic-java.zip

ENV TMPDIR=/tmp \
TMP=/tmp \
HOME=/home \
Expand Down
12 changes: 12 additions & 0 deletions services/keycloak/startup-scripts/10-newrelic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

if [ -v NEW_RELIC_LICENSE_KEY ]
then
echo "Enabling newrelic monitor"

cat << 'EOF' >> /opt/jboss/keycloak/bin/standalone.conf

JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/newrelic/newrelic.jar"
EOF

fi