Install - Java Agent Controller on Containerized Springboot Alpine App for Dynamic Analysis
Installation Steps
- Download the latest vFunction Sudoless Alpine Controller Installation TGZ
- Download a sample installation.yaml
- Set the Configurable Settings in the downloaded installation.yaml
- Create a startup.sh and edit the “Running application” Section to be relevant for your Application
#!/usr/bin/env sh
set -x
echo "Restarting the controller"
sh /tmp/vfunction/opt/vfunction/controller-installation/restart-controller.sh -i default-java || echo "Failed to restart the controller"
jvm_args=$(cat /tmp/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vmargs-examples/raw)
export JAVA_TOOL_OPTIONS="$jvm_args"
echo "Running application"
cd /opt/application/lib
jar_name=$(ls -1 *.jar)
java -jar $jar_name
- Create a folder for vFunction artifacts in the Artifact Repository accessible by the Docker Build
- Add the vFunction Sudoless Controller Installation TGZ, the installation.yaml and the startup.sh to the Artifact Repository
- Create a vFunction specific branch to add the vFunction artificats to the Application’s Dockerfile
- Modify the Application’s Dockerfile
FROM alpine:latest
ARG NAME
ARG VERSION
ARG RELEASE
ENV SUMMARY="SpringBoot application wrapper for vFunction Controller." \
DESCRIPTION="SpringBoot application wrapper for vFunction Controller."
LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.description="$DESCRIPTION" \
name="vfunction/$NAME" \
vendor="vFunction" \
version="$VERSION" \
release="$RELEASE"
RUN echo "http://na.edge.kernel.org/alpine/edge/main" > /etc/apk/repositories \
&& echo "http://na.edge.kernel.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk update \
&& apk upgrade --update-cache --available \
&& apk add --no-cache --upgrade openjdk17 \
&& adduser --disabled-password --uid "1500" "appuser" \
&& mkdir -p /opt/application/lib
COPY ARTIFACT_REPOSITORY/vfunction/vfunction-controller-alpine-sudo-less-installation*.tgz /tmp/vfunction-controller-sudo-less-installation.tgz
COPY ARTIFACT_REPOSITORY/vfunction/*.yaml /tmp/
COPY ARTIFACT_REPOSITORY/vfunction/startup.sh /usr/bin/startup.sh
RUN cd /tmp && tar zxvf /tmp/vfunction-controller-sudo-less-installation.tgz && \
rm -rf /tmp/vfunction-controller-sudo-less-installation.tgz && \
mv /tmp/installation.yaml /tmp/vfunction/etc/sysconfig/vfunction/installation/instances/default-java/ && \
sh /tmp/vfunction/opt/vfunction/controller-installation/install.sh -i default-java -n -a && \
chmod +x /usr/bin/startup.sh && \
chmod -R 777 /usr/bin/ /tmp/vfunction && \
EXPOSE 8080
USER 1500
ENTRYPOINT ["/bin/sh"]
CMD ["/usr/bin/startup.sh"]
- Build and deploy the Application
- Confirm that the Application comes up and functions as expected
- If any issues arise: