This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 1180ca66484ff3d3555b08408eb7a7661aeda7b2 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Sat May 29 13:52:57 2021 +0700 JAMES-3261 Package the JPA server docker image with JIB --- dockerfiles/run/guice/jpa/Dockerfile | 50 --------- dockerfiles/run/guice/jpa/destination/run_james.sh | 10 -- server/container/guice/jpa-guice/README.adoc | 43 +++++++- server/container/guice/jpa-guice/pom.xml | 114 +++++++++++++++++++++ .../jpa-guice/src/main}/extensions-jars/README.md | 2 +- .../guice/jpa-guice/src/main}/glowroot/admin.json | 0 .../jpa-guice/src/main}/glowroot/plugins/imap.json | 0 .../jpa-guice/src/main}/glowroot/plugins/jmap.json | 0 .../main}/glowroot/plugins/mailboxListener.json | 0 .../jpa-guice/src/main}/glowroot/plugins/smtp.json | 0 .../src/main}/glowroot/plugins/spooler.json | 0 .../jpa-guice/src/main}/glowroot/plugins/task.json | 0 .../guice/jpa-guice/src/main/scripts/james-cli | 3 + 13 files changed, 160 insertions(+), 62 deletions(-) diff --git a/dockerfiles/run/guice/jpa/Dockerfile b/dockerfiles/run/guice/jpa/Dockerfile deleted file mode 100644 index 32fe284..0000000 --- a/dockerfiles/run/guice/jpa/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -# Run James -# -# VERSION 1.0 - -FROM adoptopenjdk:11-jre-hotspot - -# Ports that are used -# -# 25 SMTP without authentication -# 110 POP3 -# 143 IMAP with startTLS enabled -# 465 SMTP with authentication and socketTLS enabled -# 587 SMTP with authentication and startTLS enabled -# 993 IMAP with socketTLS enabled -# 8000 Web Admin interface (unsecured: expose at your own risks) - -EXPOSE 25 110 143 465 587 993 4000 8000 - -WORKDIR /root -RUN apt-get update && apt-get install -y unzip - -# Get data we need to run James : build results and configuration -ADD destination/james-server-jpa-guice.zip /root -RUN unzip james-server-jpa-guice.zip && \ - cp -r /root/james-server-jpa-guice/* /root && \ - rm james-server-jpa-guice.zip && \ - rm -r james-server-jpa-guice -ADD destination/james-server-cli.jar /root/james-cli.jar -ADD destination/james-server-cli.lib /root/james-server-cli.lib -ADD destination/glowroot/plugins /root/glowroot/plugins -ADD destination/glowroot/glowroot.jar /root/glowroot/glowroot.jar -ADD destination/glowroot/lib/glowroot-embedded-collector.jar /root/glowroot/lib/glowroot-embedded-collector.jar -ADD destination/glowroot/lib/glowroot-logging-logstash.jar /root/glowroot/lib/glowroot-logging-logstash.jar -ADD destination/glowroot/admin.json /root/glowroot/admin.json -ADD destination/run_james.sh /root/run_james.sh - -VOLUME /logs -VOLUME /root/conf -VOLUME /root/glowroot/plugins -VOLUME /root/glowroot/data -# Data for ActiveMQ mailQueue -VOLUME /root/var -# Data for derby database -VOLUME /var/store - -ENV PATH="$PATH:/root/glowroot/lib" \ - JVM_OPTIONS="" \ - GLOWROOT_ACTIVATED="false" - -ENTRYPOINT ./run_james.sh diff --git a/dockerfiles/run/guice/jpa/destination/run_james.sh b/dockerfiles/run/guice/jpa/destination/run_james.sh deleted file mode 100755 index ec4cc1a..0000000 --- a/dockerfiles/run/guice/jpa/destination/run_james.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -if [ "$GLOWROOT_ACTIVATED" == "true" ]; then - GLOWROOT_OPTIONS=-javaagent:/root/glowroot/glowroot.jar -fi - -java -Dworking.directory=. \ - $GLOWROOT_OPTIONS \ - $JVM_OPTIONS \ - -Dlogback.configurationFile=conf/logback.xml -jar james-server-jpa-guice.jar - diff --git a/server/container/guice/jpa-guice/README.adoc b/server/container/guice/jpa-guice/README.adoc index 091a607..5f9b170 100644 --- a/server/container/guice/jpa-guice/README.adoc +++ b/server/container/guice/jpa-guice/README.adoc @@ -28,4 +28,45 @@ Once everything is set up, you just have to run the jar with: $ java -javaagent:james-server-jpa-guice.lib/openjpa-3.1.2.jar -Dworking.directory=. -Dlogback.configurationFile=conf/logback.xml -jar james-server-jpa-guice.jar ---- -Note that binding ports below 1024 requires administrative rights. \ No newline at end of file +Note that binding ports below 1024 requires administrative rights. + +== Docker distribution + +To import the image locally: + +[source] +---- +docker image load -i target/jib-image.tar +---- + +Then run it: + +[source] +---- +docker run apache/james:jpa-latest +---- + +Use the [JAVA_TOOL_OPTIONS environment option](https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#jvm-flags) +to pass extra JVM flags. For instance: + +[source] +---- +docker run -e "JAVA_TOOL_OPTIONS=-Xmx500m -Xms500m" apache/james:jpa-latest +---- + +[Glowroot APM](https://glowroot.org/) is packaged as part of the docker distribution to easily enable valuable performances insights. +Disabled by default, its java agent can easily be enabled: + + +[source] +---- +docker run -e "JAVA_TOOL_OPTIONS=-javaagent:/root/glowroot.jar" apache/james:jpa-latest +---- + +The [CLI](https://james.apache.org/server/manage-cli.html) can easily be used: + + +[source] +---- +docker exec CONTAINER-ID james-cli ListDomains +---- \ No newline at end of file diff --git a/server/container/guice/jpa-guice/pom.xml b/server/container/guice/jpa-guice/pom.xml index a1951f7..4a7f09f 100644 --- a/server/container/guice/jpa-guice/pom.xml +++ b/server/container/guice/jpa-guice/pom.xml @@ -59,6 +59,11 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>james-server-cli</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>james-server-data-jpa</artifactId> </dependency> <dependency> @@ -206,6 +211,115 @@ <build> <plugins> <plugin> + <groupId>com.googlecode.maven-download-plugin</groupId> + <artifactId>download-maven-plugin</artifactId> + <executions> + <execution> + <id>install-glowroot</id> + <goals> + <goal>wget</goal> + </goals> + <phase>package</phase> + <configuration> + <url>https://github.com/glowroot/glowroot/releases/download/v0.13.4/glowroot-0.13.4-dist.zip</url> + <unpack>true</unpack> + <outputDirectory>${project.build.directory}</outputDirectory> + <md5>93d472281a67ab8404033a88280c23c9</md5> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-glowroot-resources</id> + <goals> + <goal>copy-resources</goal> + </goals> + <phase>package</phase> + <configuration> + <outputDirectory>${basedir}/target/glowroot</outputDirectory> + <resources> + <resource> + <directory>src/main/glowroot</directory> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>com.google.cloud.tools</groupId> + <artifactId>jib-maven-plugin</artifactId> + <configuration> + <from> + <image>adoptopenjdk:11-jdk-hotspot</image> + </from> + <to> + <image>apache/james</image> + <tags> + <tag>jpa-latest</tag> + </tags> + </to> + <container> + <mainClass>org.apache.james.JPAJamesServerMain</mainClass> + <ports> + <port>80</port> <!-- JMAP --> + <port>143</port> <!-- IMAP --> + <port>993</port> <!-- IMAPS --> + <port>25</port> <!-- SMTP --> + <port>465</port> <!-- SMTP + STARTTLS --> + <port>587</port> <!-- SMTPS --> + <port>4000</port> <!-- GLOWROOT, if activated --> + <port>8000</port> <!-- WEBADMIN --> + </ports> + <appRoot>/root</appRoot> + <jvmFlags> + <jvmFlag>-Dlogback.configurationFile=/root/conf/logback.xml</jvmFlag> + <jvmFlag>-Dworking.directory=/root/</jvmFlag> + </jvmFlags> + <creationTime>USE_CURRENT_TIMESTAMP</creationTime> + </container> + <extraDirectories> + <paths> + <path> + <from>sample-configuration</from> + <into>/root/conf</into> + </path> + <path> + <from>src/main/scripts</from> + <into>/usr/bin</into> + </path> + <path> + <from>target/glowroot</from> + <into>/root</into> + </path> + <path> + <from>src/main/extensions-jars</from> + <into>/root/extensions-jars</into> + </path> + </paths> + <permissions> + <permission> + <file>/usr/bin/james-cli</file> + <mode>755</mode> <!-- Read/write/execute for owner, read/execute for group/other --> + </permission> + </permissions> + </extraDirectories> + </configuration> + <executions> + <execution> + <goals> + <goal>buildTar</goal> + </goals> + <phase>package</phase> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> diff --git a/dockerfiles/run/guice/jpa/destination/extensions-jars/README.md b/server/container/guice/jpa-guice/src/main/extensions-jars/README.md similarity index 74% rename from dockerfiles/run/guice/jpa/destination/extensions-jars/README.md rename to server/container/guice/jpa-guice/src/main/extensions-jars/README.md index 2cea759..dab5c40 100644 --- a/dockerfiles/run/guice/jpa/destination/extensions-jars/README.md +++ b/server/container/guice/jpa-guice/src/main/extensions-jars/README.md @@ -2,4 +2,4 @@ The jar in this folder will be added to JAMES classpath when mounted under /root/extensions-jars inside the running container. -You can use it to add you customs Mailets/Matchers. +You can use it to add your custom Mailets/Matchers. diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/admin.json b/server/container/guice/jpa-guice/src/main/glowroot/admin.json similarity index 100% rename from dockerfiles/run/guice/jpa/destination/glowroot/admin.json rename to server/container/guice/jpa-guice/src/main/glowroot/admin.json diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/imap.json b/server/container/guice/jpa-guice/src/main/glowroot/plugins/imap.json similarity index 100% rename from dockerfiles/run/guice/jpa/destination/glowroot/plugins/imap.json rename to server/container/guice/jpa-guice/src/main/glowroot/plugins/imap.json diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/jmap.json b/server/container/guice/jpa-guice/src/main/glowroot/plugins/jmap.json similarity index 100% rename from dockerfiles/run/guice/jpa/destination/glowroot/plugins/jmap.json rename to server/container/guice/jpa-guice/src/main/glowroot/plugins/jmap.json diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/mailboxListener.json b/server/container/guice/jpa-guice/src/main/glowroot/plugins/mailboxListener.json similarity index 100% rename from dockerfiles/run/guice/jpa/destination/glowroot/plugins/mailboxListener.json rename to server/container/guice/jpa-guice/src/main/glowroot/plugins/mailboxListener.json diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/smtp.json b/server/container/guice/jpa-guice/src/main/glowroot/plugins/smtp.json similarity index 100% rename from dockerfiles/run/guice/jpa/destination/glowroot/plugins/smtp.json rename to server/container/guice/jpa-guice/src/main/glowroot/plugins/smtp.json diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/spooler.json b/server/container/guice/jpa-guice/src/main/glowroot/plugins/spooler.json similarity index 100% rename from dockerfiles/run/guice/jpa/destination/glowroot/plugins/spooler.json rename to server/container/guice/jpa-guice/src/main/glowroot/plugins/spooler.json diff --git a/dockerfiles/run/guice/jpa/destination/glowroot/plugins/task.json b/server/container/guice/jpa-guice/src/main/glowroot/plugins/task.json similarity index 100% rename from dockerfiles/run/guice/jpa/destination/glowroot/plugins/task.json rename to server/container/guice/jpa-guice/src/main/glowroot/plugins/task.json diff --git a/server/container/guice/jpa-guice/src/main/scripts/james-cli b/server/container/guice/jpa-guice/src/main/scripts/james-cli new file mode 100755 index 0000000..19a73b6 --- /dev/null +++ b/server/container/guice/jpa-guice/src/main/scripts/james-cli @@ -0,0 +1,3 @@ +#!/bin/bash + +java -cp /root/resources:/root/classes:/root/libs/* org.apache.james.cli.ServerCmd "$@" \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org