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 7727c03863465a0a877a1f296203416f60b62717 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Sat May 29 13:28:43 2021 +0700 JAMES-3261 Package the Distributed server docker image with JIB --- .../run/guice/cassandra-rabbitmq/Dockerfile | 46 -------- .../cassandra-rabbitmq/destination/run_james.sh | 9 -- .../guice/cassandra-rabbitmq-guice/README.adoc | 42 +++++++- .../guice/cassandra-rabbitmq-guice/pom.xml | 120 +++++++++++++++++++++ .../src/main}/extensions-jars/README.md | 2 +- .../src/main}/glowroot/admin.json | 0 .../src/main}/glowroot/plugins/blobstore.json | 0 .../src/main}/glowroot/plugins/imap.json | 0 .../src/main}/glowroot/plugins/jmap.json | 0 .../main}/glowroot/plugins/mailboxListener.json | 0 .../src/main}/glowroot/plugins/smtp.json | 0 .../src/main}/glowroot/plugins/spooler.json | 0 .../src/main}/glowroot/plugins/task.json | 0 .../src/main/scripts/james-cli | 3 + 14 files changed, 165 insertions(+), 57 deletions(-) diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/Dockerfile b/dockerfiles/run/guice/cassandra-rabbitmq/Dockerfile deleted file mode 100644 index 90cfe3c..0000000 --- a/dockerfiles/run/guice/cassandra-rabbitmq/Dockerfile +++ /dev/null @@ -1,46 +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-distributed-guice.zip /root -RUN unzip james-server-distributed-guice.zip && \ - cp -r /root/james-server-distributed-guice/* /root && \ - rm james-server-distributed-guice.zip && \ - rm -r james-server-distributed-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 - -ENV PATH="$PATH:/root/glowroot/lib" \ - JVM_OPTIONS="" \ - GLOWROOT_ACTIVATED="false" - -ENTRYPOINT ./run_james.sh diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/run_james.sh b/dockerfiles/run/guice/cassandra-rabbitmq/destination/run_james.sh deleted file mode 100755 index 3450399..0000000 --- a/dockerfiles/run/guice/cassandra-rabbitmq/destination/run_james.sh +++ /dev/null @@ -1,9 +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-cassandra-rabbitmq-guice.jar \ No newline at end of file diff --git a/server/container/guice/cassandra-rabbitmq-guice/README.adoc b/server/container/guice/cassandra-rabbitmq-guice/README.adoc index 5f521ff..982334e 100644 --- a/server/container/guice/cassandra-rabbitmq-guice/README.adoc +++ b/server/container/guice/cassandra-rabbitmq-guice/README.adoc @@ -43,4 +43,44 @@ Once everything is set up, you just have to run the jar with: $ java -Dworking.directory=. -Dlogback.configurationFile=conf/logback.xml -jar james-server-cassandra-rabbitmq-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:distributed-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:distributed-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:distributed-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/cassandra-rabbitmq-guice/pom.xml b/server/container/guice/cassandra-rabbitmq-guice/pom.xml index bf70ac3..ef79eae 100644 --- a/server/container/guice/cassandra-rabbitmq-guice/pom.xml +++ b/server/container/guice/cassandra-rabbitmq-guice/pom.xml @@ -123,6 +123,11 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>james-server-cli</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>james-server-guice-cassandra</artifactId> </dependency> <dependency> @@ -322,6 +327,121 @@ <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>distributed-latest</tag> + </tags> + </to> + <container> + <mainClass>org.apache.james.CassandraRabbitMQJamesServerMain</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> + <volumes> + <volume>/logs</volume> + <volume>/root/conf</volume> + <volume>/root/glowroot/plugins</volume> + <volume>/root/glowroot/data</volume> + </volumes> + </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/cassandra-rabbitmq/destination/extensions-jars/README.md b/server/container/guice/cassandra-rabbitmq-guice/src/main/extensions-jars/README.md similarity index 74% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/extensions-jars/README.md rename to server/container/guice/cassandra-rabbitmq-guice/src/main/extensions-jars/README.md index 2cea759..dab5c40 100644 --- a/dockerfiles/run/guice/cassandra-rabbitmq/destination/extensions-jars/README.md +++ b/server/container/guice/cassandra-rabbitmq-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/cassandra-rabbitmq/destination/glowroot/admin.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/admin.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/admin.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/admin.json diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/blobstore.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/blobstore.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/blobstore.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/blobstore.json diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/imap.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/imap.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/imap.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/imap.json diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/jmap.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/jmap.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/jmap.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/jmap.json diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/mailboxListener.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/mailboxListener.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/mailboxListener.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/mailboxListener.json diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/smtp.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/smtp.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/smtp.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/smtp.json diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/spooler.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/spooler.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/spooler.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/spooler.json diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/task.json b/server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/task.json similarity index 100% rename from dockerfiles/run/guice/cassandra-rabbitmq/destination/glowroot/plugins/task.json rename to server/container/guice/cassandra-rabbitmq-guice/src/main/glowroot/plugins/task.json diff --git a/server/container/guice/cassandra-rabbitmq-guice/src/main/scripts/james-cli b/server/container/guice/cassandra-rabbitmq-guice/src/main/scripts/james-cli new file mode 100755 index 0000000..19a73b6 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-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