james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [20/21] james-project git commit: JAMES-2274 Script helper for per-commit packages generation
Date Thu, 04 Jan 2018 08:13:35 GMT
JAMES-2274 Script helper for per-commit packages generation


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/fe9c6256
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/fe9c6256
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/fe9c6256

Branch: refs/heads/master
Commit: fe9c62560d3eea74edce46228b38bbd4cba1e7fb
Parents: 0e6e17d
Author: benwa <btellier@linagora.com>
Authored: Thu Dec 28 13:52:00 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Thu Jan 4 15:12:47 2018 +0700

----------------------------------------------------------------------
 README.adoc                                     |  5 ++
 .../packaging/guice/cassandra/Dockerfile        |  4 +-
 .../packaging/guice/cassandra/james.postinst    |  6 --
 .../guice/cassandra/james.rpm.postinst          |  8 ---
 .../guice/cassandra/james.rpm.postremove        |  7 --
 .../guice/cassandra/james.rpm.postupgrade       |  5 --
 .../packaging/guice/cassandra/james.service     | 34 ----------
 .../packaging/guice/cassandra/package.sh        | 68 +++++++-------------
 .../guice/cassandra/scripts/james.postinst      |  6 ++
 .../guice/cassandra/scripts/james.rpm.postinst  |  8 +++
 .../cassandra/scripts/james.rpm.postremove      |  7 ++
 .../cassandra/scripts/james.rpm.postupgrade     |  5 ++
 .../guice/cassandra/scripts/james.service       | 34 ++++++++++
 .../guice/cassandra/scripts/james.service.rhel  | 34 ++++++++++
 .../guice/cassandra/scripts/package.sh          | 61 ++++++++++++++++++
 dockerfiles/packaging/james.service.rhel        | 34 ----------
 16 files changed, 186 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/README.adoc
----------------------------------------------------------------------
diff --git a/README.adoc b/README.adoc
index 7e3acc9..7245fb2 100644
--- a/README.adoc
+++ b/README.adoc
@@ -375,3 +375,8 @@ Then, you have to run the container:
 Where:
 
 - $PWD/result is the folder where the deb and the RPM packages will be copied
+
+Note: A helper script is provided for the generation of packages for a specific git commit.
For instance:
+
+    $ sh dockerfiles/packaging/guice/cassandra/package.sh 3.0.1 1 c298195e84 $PWD/result
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/Dockerfile
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/Dockerfile b/dockerfiles/packaging/guice/cassandra/Dockerfile
index 21b99c6..632a40d 100644
--- a/dockerfiles/packaging/guice/cassandra/Dockerfile
+++ b/dockerfiles/packaging/guice/cassandra/Dockerfile
@@ -8,9 +8,9 @@ RUN apt-get install -y ruby-dev ruby build-essential
 RUN gem install fpm
 RUN apt-get install -y rpm
 
-ADD . /packages
+ADD scripts/ /packages
 
-COPY james.service /packages/package/usr/share/james/
+COPY scripts/james.service /packages/package/usr/share/james/
 COPY --from=source /root/*.jar /packages/package/usr/share/james/
 COPY --from=source /root/james-server-cassandra-guice.lib/ /packages/package/usr/share/james/james-server-cassandra-guice.lib/
 COPY --from=source /root/james-server-cli.lib/ /packages/package/usr/share/james/james-server-cli.lib/

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/james.postinst
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/james.postinst b/dockerfiles/packaging/guice/cassandra/james.postinst
deleted file mode 100644
index 82306a7..0000000
--- a/dockerfiles/packaging/guice/cassandra/james.postinst
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /bin/sh -e
-
-ln -s /etc/james /var/lib/james/conf
-
-systemctl enable james
-

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/james.rpm.postinst
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/james.rpm.postinst b/dockerfiles/packaging/guice/cassandra/james.rpm.postinst
deleted file mode 100644
index 447b4c1..0000000
--- a/dockerfiles/packaging/guice/cassandra/james.rpm.postinst
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /bin/sh -e
- 
-ln -s /etc/james /var/lib/james/conf
-
-#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
-cp /usr/share/james/james.service /etc/systemd/system/
-systemctl enable james
-

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/james.rpm.postremove
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/james.rpm.postremove b/dockerfiles/packaging/guice/cassandra/james.rpm.postremove
deleted file mode 100644
index d70a3ed..0000000
--- a/dockerfiles/packaging/guice/cassandra/james.rpm.postremove
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/sh -e
- 
-#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
-systemctl stop james
-systemctl disable james
-rm /etc/systemd/system/james.service
-

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/james.rpm.postupgrade
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/james.rpm.postupgrade b/dockerfiles/packaging/guice/cassandra/james.rpm.postupgrade
deleted file mode 100644
index 8e2c81c..0000000
--- a/dockerfiles/packaging/guice/cassandra/james.rpm.postupgrade
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh -e
- 
-#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
-systemctl try-restart james
-

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/james.service
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/james.service b/dockerfiles/packaging/guice/cassandra/james.service
deleted file mode 100644
index 2c55df6..0000000
--- a/dockerfiles/packaging/guice/cassandra/james.service
+++ /dev/null
@@ -1,34 +0,0 @@
-[Unit]
-Description=James stands for Java Apache Mail Enterprise Server! It has a modular architecture
based on a rich set of modern and efficient components which provides at the end complete,
stable, secure and extendable Mail Servers running on the JVM.
-Documentation=http://james.apache.org
-Wants=network-online.target cassandra.service elasticsearch.service
-After=network-online.target cassandra.service elasticsearch.service
-
-[Service]
-Environment=WORKING_DIRECTORY=/var/lib/james
-Environment=XMX=1024m
-
-User=root
-Group=root
-
-ExecStart=/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Dworking.directory=${WORKING_DIRECTORY}
-Xmx${XMX} -Dlogback.configurationFile=/etc/james/logback.xml -jar /usr/share/james/james-server.jar

-
-StandardOutput=journal
-StandardError=inherit
-
-# Specifies the maximum number of bytes of memory that may be locked into RAM
-# Set to "infinity" if you use the 'bootstrap.mlockall: true' option
-# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/default/elasticsearch
-#LimitMEMLOCK=infinity
-
-# SIGTERM signal is used to stop the Java process
-KillSignal=SIGTERM
-
-# Java process is never killed
-SendSIGKILL=no
-
-# When a JVM receives a SIGTERM signal it exits with code 143
-SuccessExitStatus=143
-
-[Install]
-WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/package.sh
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/package.sh b/dockerfiles/packaging/guice/cassandra/package.sh
old mode 100755
new mode 100644
index ce89168..2d4805d
--- a/dockerfiles/packaging/guice/cassandra/package.sh
+++ b/dockerfiles/packaging/guice/cassandra/package.sh
@@ -2,60 +2,40 @@
 
 printUsage() {
    echo "Usage : "
-   echo "./package.sh RELEASE ITERATION"
+   echo "./package.sh RELEASE ITERATION SHA1 DIRECTORY"
    echo "    RELEASE  : The release to be generated."
    echo "    ITERATION: The iteration to give to the package."
+   echo "    SHA1: The SHA-1 to build packages against"
+   echo "    DIRECTORY: The directory where to put build results"
    exit 1
 }
 
-if [ "$#" -ne 2 ]; then
+
+if [ "$#" -ne 4 ]; then
     printUsage
 fi
 
 RELEASE=$1
 ITERATION=$2
+SHA1=$3
+DIRECTORY=$4
 
-fpm -s dir -t deb \
- -n james \
- -v $RELEASE \
- -a x86_64 \
- -d openjdk-8-jre \
- -C package \
- --deb-systemd james.service \
- --after-install james.postinst \
- --provides mail-transport-agent \
- --provides default-mta \
- --iteration $ITERATION \
- --license http://www.apache.org/licenses/LICENSE-2.0 \
- --description "$(printf "James stands for Java Apache Mail Enterprise Server!\nIt has a
modular architecture based on a rich set of modern and efficient components which provides
at the end complete, stable, secure and extendable Mail Servers running on the JVM.")" \
- --vendor "Apache" \
- --maintainer "Apache" \
- --url http://james.apache.org/ \
- --category web \
- .
-
-#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
-cp james.service.rhel package/usr/share/james/james.service
+# Compile James
+docker build -t james/project dockerfiles/compilation/java-8
+docker run \
+   --rm \
+   --volume $PWD/.m2:/root/.m2 \
+   --volume $PWD:/origin \
+   --volume $PWD/dockerfiles/run/guice/cassandra/destination:/cassandra/destination \
+   -t james/project -s $SHA1
 
-fpm -s dir -t rpm \
- -n james \
- -v $RELEASE \
- -a x86_64 \
- -d java-1.8.0-openjdk-headless \
- -C package \
- --after-install james.rpm.postinst \
- --after-upgrade james.rpm.postupgrade \
- --after-remove james.rpm.postremove \
- --provides mail-transport-agent \
- --provides default-mta \
- --iteration $ITERATION \
- --license http://www.apache.org/licenses/LICENSE-2.0 \
- --description "$(printf "James stands for Java Apache Mail Enterprise Server!\nIt has a
modular architecture based on a rich set of modern and efficient components which provides
at the end complete, stable, secure and extendable Mail Servers running on the JVM.")" \
- --vendor "Apache" \
- --maintainer "Apache" \
- --url http://james.apache.org/ \
- --category web \
- .
+# Build image
+docker build -t james_run dockerfiles/run/guice/cassandra
 
-cp /packages/james*.deb /result/
-cp /packages/james*.rpm /result/
+# Build packages
+docker build -t build-james-packages \
+  --build-arg RELEASE=$RELEASE-$SHA1 \
+  --build-arg ITERATION=$ITERATION \
+  --build-arg BASE=james_run \
+  dockerfiles/packaging/guice/cassandra
+docker run --rm --name james-packages -v $DIRECTORY:/result build-james-packages
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/scripts/james.postinst
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/scripts/james.postinst b/dockerfiles/packaging/guice/cassandra/scripts/james.postinst
new file mode 100644
index 0000000..82306a7
--- /dev/null
+++ b/dockerfiles/packaging/guice/cassandra/scripts/james.postinst
@@ -0,0 +1,6 @@
+#! /bin/sh -e
+
+ln -s /etc/james /var/lib/james/conf
+
+systemctl enable james
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postinst
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postinst b/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postinst
new file mode 100644
index 0000000..447b4c1
--- /dev/null
+++ b/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postinst
@@ -0,0 +1,8 @@
+#! /bin/sh -e
+ 
+ln -s /etc/james /var/lib/james/conf
+
+#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
+cp /usr/share/james/james.service /etc/systemd/system/
+systemctl enable james
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postremove
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postremove b/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postremove
new file mode 100644
index 0000000..d70a3ed
--- /dev/null
+++ b/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postremove
@@ -0,0 +1,7 @@
+#! /bin/sh -e
+ 
+#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
+systemctl stop james
+systemctl disable james
+rm /etc/systemd/system/james.service
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postupgrade
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postupgrade b/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postupgrade
new file mode 100644
index 0000000..8e2c81c
--- /dev/null
+++ b/dockerfiles/packaging/guice/cassandra/scripts/james.rpm.postupgrade
@@ -0,0 +1,5 @@
+#! /bin/sh -e
+ 
+#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
+systemctl try-restart james
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/scripts/james.service
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/scripts/james.service b/dockerfiles/packaging/guice/cassandra/scripts/james.service
new file mode 100644
index 0000000..2c55df6
--- /dev/null
+++ b/dockerfiles/packaging/guice/cassandra/scripts/james.service
@@ -0,0 +1,34 @@
+[Unit]
+Description=James stands for Java Apache Mail Enterprise Server! It has a modular architecture
based on a rich set of modern and efficient components which provides at the end complete,
stable, secure and extendable Mail Servers running on the JVM.
+Documentation=http://james.apache.org
+Wants=network-online.target cassandra.service elasticsearch.service
+After=network-online.target cassandra.service elasticsearch.service
+
+[Service]
+Environment=WORKING_DIRECTORY=/var/lib/james
+Environment=XMX=1024m
+
+User=root
+Group=root
+
+ExecStart=/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Dworking.directory=${WORKING_DIRECTORY}
-Xmx${XMX} -Dlogback.configurationFile=/etc/james/logback.xml -jar /usr/share/james/james-server.jar

+
+StandardOutput=journal
+StandardError=inherit
+
+# Specifies the maximum number of bytes of memory that may be locked into RAM
+# Set to "infinity" if you use the 'bootstrap.mlockall: true' option
+# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/default/elasticsearch
+#LimitMEMLOCK=infinity
+
+# SIGTERM signal is used to stop the Java process
+KillSignal=SIGTERM
+
+# Java process is never killed
+SendSIGKILL=no
+
+# When a JVM receives a SIGTERM signal it exits with code 143
+SuccessExitStatus=143
+
+[Install]
+WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/scripts/james.service.rhel
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/scripts/james.service.rhel b/dockerfiles/packaging/guice/cassandra/scripts/james.service.rhel
new file mode 100644
index 0000000..af48a62
--- /dev/null
+++ b/dockerfiles/packaging/guice/cassandra/scripts/james.service.rhel
@@ -0,0 +1,34 @@
+[Unit]
+Description=James stands for Java Apache Mail Enterprise Server! It has a modular architecture
based on a rich set of modern and efficient components which provides at the end complete,
stable, secure and extendable Mail Servers running on the JVM.
+Documentation=http://james.apache.org
+Wants=network-online.target cassandra.service elasticsearch.service
+After=network-online.target cassandra.service elasticsearch.service
+
+[Service]
+Environment=WORKING_DIRECTORY=/var/lib/james
+Environment=XMX=1024m
+
+User=root
+Group=root
+
+ExecStart=/usr/lib/jvm/jre-1.8.0-openjdk/bin/java -Dworking.directory=${WORKING_DIRECTORY}
-Xmx${XMX} -Dlogback.configurationFile=/etc/james/logback.xml -jar /usr/share/james/james-server.jar

+
+StandardOutput=journal
+StandardError=inherit
+
+# Specifies the maximum number of bytes of memory that may be locked into RAM
+# Set to "infinity" if you use the 'bootstrap.mlockall: true' option
+# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/default/elasticsearch
+#LimitMEMLOCK=infinity
+
+# SIGTERM signal is used to stop the Java process
+KillSignal=SIGTERM
+
+# Java process is never killed
+SendSIGKILL=no
+
+# When a JVM receives a SIGTERM signal it exits with code 143
+SuccessExitStatus=143
+
+[Install]
+WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/guice/cassandra/scripts/package.sh
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/guice/cassandra/scripts/package.sh b/dockerfiles/packaging/guice/cassandra/scripts/package.sh
new file mode 100755
index 0000000..da86f36
--- /dev/null
+++ b/dockerfiles/packaging/guice/cassandra/scripts/package.sh
@@ -0,0 +1,61 @@
+#!/bin/sh -e
+
+printUsage() {
+   echo "Usage : "
+   echo "./package.sh RELEASE ITERATION"
+   echo "    RELEASE  : The release to be generated."
+   echo "    ITERATION: The iteration to give to the package."
+   exit 1
+}
+
+if [ "$#" -ne 2 ]; then
+    printUsage
+fi
+
+RELEASE=$1
+ITERATION=$2
+
+fpm -s dir -t deb \
+ -n james \
+ -v $RELEASE \
+ -a x86_64 \
+ -d openjdk-8-jre \
+ -C package \
+ --deb-systemd james.service \
+ --after-install james.postinst \
+ --provides mail-transport-agent \
+ --provides default-mta \
+ --iteration $ITERATION \
+ --license http://www.apache.org/licenses/LICENSE-2.0 \
+ --description "$(printf "James stands for Java Apache Mail Enterprise Server!\nIt has a
modular architecture based on a rich set of modern and efficient components which provides
at the end complete, stable, secure and extendable Mail Servers running on the JVM.")" \
+ --vendor "Apache" \
+ --maintainer "Apache" \
+ --url http://james.apache.org/ \
+ --category web \
+ .
+
+#Workaround waiting for https://github.com/jordansissel/fpm/issues/1163 to be released
+cp james.service.rhel package/usr/share/james/james.service
+
+fpm -s dir -t rpm \
+ -n james \
+ -v $RELEASE \
+ -a x86_64 \
+ -d java-1.8.0-openjdk-headless \
+ -C package \
+ --after-install james.rpm.postinst \
+ --after-upgrade james.rpm.postupgrade \
+ --after-remove james.rpm.postremove \
+ --provides mail-transport-agent \
+ --provides default-mta \
+ --iteration $ITERATION \
+ --license http://www.apache.org/licenses/LICENSE-2.0 \
+ --description "$(printf "James stands for Java Apache Mail Enterprise Server!\nIt has a
modular architecture based on a rich set of modern and efficient components which provides
at the end complete, stable, secure and extendable Mail Servers running on the JVM.")" \
+ --vendor "Apache" \
+ --maintainer "Apache" \
+ --url http://james.apache.org/ \
+ --category web \
+ .
+
+cp /packages/james*.deb /result/
+cp /packages/james*.rpm /result/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/fe9c6256/dockerfiles/packaging/james.service.rhel
----------------------------------------------------------------------
diff --git a/dockerfiles/packaging/james.service.rhel b/dockerfiles/packaging/james.service.rhel
deleted file mode 100644
index af48a62..0000000
--- a/dockerfiles/packaging/james.service.rhel
+++ /dev/null
@@ -1,34 +0,0 @@
-[Unit]
-Description=James stands for Java Apache Mail Enterprise Server! It has a modular architecture
based on a rich set of modern and efficient components which provides at the end complete,
stable, secure and extendable Mail Servers running on the JVM.
-Documentation=http://james.apache.org
-Wants=network-online.target cassandra.service elasticsearch.service
-After=network-online.target cassandra.service elasticsearch.service
-
-[Service]
-Environment=WORKING_DIRECTORY=/var/lib/james
-Environment=XMX=1024m
-
-User=root
-Group=root
-
-ExecStart=/usr/lib/jvm/jre-1.8.0-openjdk/bin/java -Dworking.directory=${WORKING_DIRECTORY}
-Xmx${XMX} -Dlogback.configurationFile=/etc/james/logback.xml -jar /usr/share/james/james-server.jar

-
-StandardOutput=journal
-StandardError=inherit
-
-# Specifies the maximum number of bytes of memory that may be locked into RAM
-# Set to "infinity" if you use the 'bootstrap.mlockall: true' option
-# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/default/elasticsearch
-#LimitMEMLOCK=infinity
-
-# SIGTERM signal is used to stop the Java process
-KillSignal=SIGTERM
-
-# Java process is never killed
-SendSIGKILL=no
-
-# When a JVM receives a SIGTERM signal it exits with code 143
-SuccessExitStatus=143
-
-[Install]
-WantedBy=multi-user.target


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message