plugabble custom notificator

GregoryO5 years ago

Hi,

I wrote custom notificator as in this example: https://github.com/traccar/traccar/issues/3953 .
Compiled and running very fine. However I do use docker and it's quite troublesome to always a have to compile fork of traccar server.
Is there a way to supply the notificator implementation to tracker-server.jar as a separate jar file, so it can be just added to the my own docker image?
without hardcoding it to traccar sourcecode.

I imagine that as a supplying the external jar somewhere and traccar docker image can make use of that and load that jar at the begging.

BR,
Gregory

Anton Tananaev5 years ago

I think it should be possible, but you'll have to figure out how to add your JAR to the classpath.

GregoryO5 years ago

Hi,
I ended up adding custom classes in docker image by adding them using "zip -ur" command. Directly to tracker-server.jar .

GregoryO5 years ago

Attaching my dockerfile if anybody looking for same:

FROM openjdk:8-jre-alpine

ENV TRACCAR_VERSION 4.2

WORKDIR /opt/traccar

RUN set -ex && \
    apk add --no-cache --no-progress wget && \
    wget -qO /tmp/traccar.zip https://github.com/traccar/traccar/releases/download/v$TRACCAR_VERSION/traccar-other-$TRACCAR_VERSION.zip && \
    unzip -qo /tmp/traccar.zip -d /opt/traccar && \
    rm /tmp/traccar.zip && \
    apk del wget


USER root
RUN apk --no-cache add zip tzdata
ENV TZ Europe/Warsaw

ADD org/traccar/notificators/* /opt/traccar/org/traccar/notificators/ 

RUN mkdir -p /opt/traccar/org/traccar/notificators/
RUN zip -qur tracker-server.jar org/traccar/notificators/
RUN ls -la /opt/traccar/org/traccar/notificators/
RUN addgroup -S trusr && adduser -S -G trusr trusr
RUN chown -R trusr:trusr /opt/traccar/

USER trusr 

WORKDIR /opt/traccar
ENTRYPOINT ["java", "-Xms512m", "-Xmx512m", "-Djava.net.preferIPv4Stack=true"]

CMD ["-jar", "tracker-server.jar", "conf/traccar.xml"]