Skip to content

Instantly share code, notes, and snippets.

@jonbartels
Created May 26, 2023 00:55
Show Gist options
  • Save jonbartels/3de018cecf64636b33b8e062cdace2f9 to your computer and use it in GitHub Desktop.
Save jonbartels/3de018cecf64636b33b8e062cdace2f9 to your computer and use it in GitHub Desktop.
Use SumoLogic logging in Mirth Connect. Shows the JARs to load to get MC to tolerate the Sumo appender for Log4j2
FROM nextgenhealthcare/connect:4.3.0 as connect
#clone some boilerplate from MC image
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
#TODO using a tarball and ADD also sets us up to get these artifacts from artifactory instead of from git
#TODO the parent entrypoint.sh does something with a custom-extensions directory, review it and see if it does this unpacking for us
#TODO I still think ADD is best here since it can fetch from remote URLs, it sets us up to use artifactory
#TODO: https://github.com/nextgenhealthcare/connect-docker#additional-extensions - these can just be volume mounted or use `EXTENSIONS_DOWNLOAD` URL
ADD --chown=mirth:1000 ./plugins/*.tar.gz /opt/connect/extensions
#This should be a resource directory not custom-lib
COPY --chown=mirth:1000 ./java-jwt-3.14.0.jar /opt/connect/custom-lib
#base on the latest OpenJDK layer to get Java patches
#temurin is a good replacement for openjdk
FROM eclipse-temurin:20-jre
#the rest of this file is from the nextgenhealthcare/connect image we have to re-do these tasks
RUN useradd -u 1000 mirth
RUN mkdir -p /opt/connect/appdata
VOLUME /opt/connect/appdata
COPY --from=connect entrypoint.sh /
RUN chmod 755 /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
COPY --from=connect /opt/connect /opt/connect
#Grab a specific version of the Sumo JAR from maven repos
RUN wget "https://repo1.maven.org/maven2/com/sumologic/plugins/log4j/sumologic-log4j2-appender/2.1.0/sumologic-log4j2-appender-2.1.0.jar"
RUN wget "https://repo1.maven.org/maven2/com/sumologic/plugins/http/sumologic-http-core/2.1/sumologic-http-core-2.1.jar"
RUN wget "https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.7/slf4j-api-2.0.7.jar"
RUN mv sumologic-*-2.1*.jar /opt/connect/server-launcher-lib
RUN mv slf4j-api-2.0.7.jar /opt/connect/server-launcher-lib
COPY --chown=mirth:1000 ./log4j2.with.sumo.xml /opt/connect/conf/log4j2.xml
RUN rm /opt/connect/conf/log4j2.properties
#server-lib should be on the classpath already, copy the HTTP JARs over though
RUN cp /opt/connect/server-lib/commons/http*.jar /opt/connect/server-launcher-lib
#JSON log appender experiment for https://jira.teladoc.net/browse/DEVSD-3573
#copy the log4j 1.x GELF appender to server-launcher-lib so it loads on boot
#COPY --chown=mirth:1000 ./logstash-gelf-1.15.0.jar /opt/connect/server-launcher-lib
#copy the updated log4j config file
#COPY --chown=mirth:1000 ./log4j.with.json.properties /opt/connect/conf/log4j.properties
COPY ./newrelic /opt/connect/newrelic
RUN chown -R mirth:mirth /opt/connect
WORKDIR /opt/connect
#copy file contents for... reasons?? IDK
RUN (cat mcserver.vmoptions /opt/connect/docs/mcservice-java9+.vmoptions ; echo "") > mcserver_base.vmoptions
EXPOSE 8443
USER mirth
CMD ["./mcserver"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment