brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [3/6] brooklyn-dist git commit: Improve DEB package
Date Wed, 13 Sep 2017 13:52:10 GMT
Improve DEB package


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/c640784c
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/c640784c
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/c640784c

Branch: refs/heads/master
Commit: c640784c6efd60afc494b776fe2a00a8c06b02a7
Parents: 4118fc4
Author: Thomas Bouron <thomas.bouron@cloudsoftcorp.com>
Authored: Fri Sep 8 15:47:06 2017 +0100
Committer: Thomas Bouron <thomas.bouron@cloudsoftcorp.com>
Committed: Mon Sep 11 10:19:33 2017 +0100

----------------------------------------------------------------------
 deb-packaging/deb/control/control               |   2 +-
 deb-packaging/deb/control/postinst              |   3 -
 deb-packaging/deb/control/preinst               |  10 ++
 deb-packaging/pom.xml                           | 173 ++++++++++++++-----
 .../resources/service/upstart/deb/brooklyn.conf |  13 +-
 shared-packaging/src/test/yaml/Vagrantfile      |   4 +-
 .../src/test/yaml/package-apps.yaml             |   6 +-
 shared-packaging/src/test/yaml/package.bom      |  12 +-
 8 files changed, 159 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/deb-packaging/deb/control/control
----------------------------------------------------------------------
diff --git a/deb-packaging/deb/control/control b/deb-packaging/deb/control/control
index a1283d4..a3b6e26 100644
--- a/deb-packaging/deb/control/control
+++ b/deb-packaging/deb/control/control
@@ -19,6 +19,6 @@ Version: [[version]]
 Section: misc
 Priority: optional
 Architecture: all
-Depends: default-jre-headless (>= 1.7)
+Depends: java8-runtime
 Maintainer: Aleksandr Vasilev <aleksandr.vasilev@cloudsoftcorp.com>
 Description: Apache Brooklyn is a framework for modeling, monitoring, and managing applications
through autonomic blueprints.

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/deb-packaging/deb/control/postinst
----------------------------------------------------------------------
diff --git a/deb-packaging/deb/control/postinst b/deb-packaging/deb/control/postinst
index 20ddb29..fd786d6 100644
--- a/deb-packaging/deb/control/postinst
+++ b/deb-packaging/deb/control/postinst
@@ -18,7 +18,4 @@
 
 if which systemctl > /dev/null 2>&1; then
     systemctl daemon-reload
-    systemctl start brooklyn.service
-elif which initctl > /dev/null 2>&1; then
-    initctl start brooklyn
 fi

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/deb-packaging/deb/control/preinst
----------------------------------------------------------------------
diff --git a/deb-packaging/deb/control/preinst b/deb-packaging/deb/control/preinst
index 1c613da..4215068 100644
--- a/deb-packaging/deb/control/preinst
+++ b/deb-packaging/deb/control/preinst
@@ -17,3 +17,13 @@
 # under the License.
 /usr/bin/getent group brooklyn || /usr/sbin/groupadd -r brooklyn
 /usr/bin/getent passwd brooklyn || /usr/sbin/useradd -r -g brooklyn -d /opt/brooklyn -s /bin/false
brooklyn
+# Remove the symbolic link "/opt/brooklyn" if exists (means that we are upgrading brooklyn)
+BROOKLYN_ROOT=/opt/brooklyn
+if [[ -L $BROOKLYN_ROOT && -d $BROOKLYN_ROOT ]]; then
+  rm -f $BROOKLYN_ROOT
+fi
+# Remove the symbolic link "/var/log/brooklyn" if exists (means that we are upgrading brooklyn)
+BROOKLYN_LOG=/var/log/brooklyn
+if [[ -L $BROOKLYN_LOG && -d $BROOKLYN_LOG ]]; then
+  rm -f $BROOKLYN_LOG
+fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/deb-packaging/pom.xml
----------------------------------------------------------------------
diff --git a/deb-packaging/pom.xml b/deb-packaging/pom.xml
index a6e5611..27a9af9 100644
--- a/deb-packaging/pom.xml
+++ b/deb-packaging/pom.xml
@@ -26,6 +26,14 @@
         Brooklyn DEB Package for Debian and Ubuntu operating systems
     </description>
 
+    <properties>
+        <brooklyn.directory.permission.default>740</brooklyn.directory.permission.default>
+        <brooklyn.directory.permission.root>740</brooklyn.directory.permission.root>
+        <brooklyn.file.permission.default>740</brooklyn.file.permission.default>
+        <brooklyn.file.permission.bin>740</brooklyn.file.permission.bin>
+        <brooklyn.file.permission.global>664</brooklyn.file.permission.global>
+    </properties>
+
     <parent>
         <groupId>org.apache.brooklyn</groupId>
         <artifactId>brooklyn-dist-root</artifactId>
@@ -36,8 +44,9 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
-            <artifactId>brooklyn-dist</artifactId>
+            <artifactId>apache-brooklyn</artifactId>
             <version>${project.version}</version>
+            <type>zip</type>
         </dependency>
         <dependency>
             <groupId>org.apache.brooklyn</groupId>
@@ -58,23 +67,22 @@
                             <goal>unpack</goal>
                         </goals>
                         <configuration>
-                          <artifactItems>
-                            <artifactItem>
-                              <groupId>org.apache.brooklyn</groupId>
-                              <artifactId>brooklyn-dist</artifactId>
-                              <version>${project.version}</version>
-                              <classifier>dist</classifier>
-                              <type>tar.gz</type>
-                              <outputDirectory>${project.build.directory}/deps</outputDirectory>
-                            </artifactItem>
-                            <artifactItem>
-                              <groupId>org.apache.brooklyn</groupId>
-                              <artifactId>shared-packaging</artifactId>
-                              <version>${project.version}</version>
-                              <type>jar</type>
-                              <outputDirectory>${project.build.directory}/deps/shared-packaging</outputDirectory>
-                            </artifactItem>
-                          </artifactItems>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.brooklyn</groupId>
+                                    <artifactId>apache-brooklyn</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>zip</type>
+                                    <outputDirectory>${project.build.directory}/deps</outputDirectory>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.brooklyn</groupId>
+                                    <artifactId>shared-packaging</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>jar</type>
+                                    <outputDirectory>${project.build.directory}/deps/shared-packaging</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
                         </configuration>
                     </execution>
                 </executions>
@@ -92,86 +100,159 @@
                         <configuration>
                             <verbose>false</verbose>
                             <skipPOMs>false</skipPOMs>
-                            <deb>${project.build.directory}/apache-brooklyn_${project.version}_all.deb</deb>
+                            <!-- Try to follow the deb package naming convention, restricted
by the maven artifact naming -->
+                            <classifier>all</classifier>
+                            <deb>${project.build.directory}/apache-brooklyn-${project.version}-all.deb</deb>
                             <controlDir>${basedir}/deb/control</controlDir>
                             <dataSet>
                                 <data>
-                                    <src>${project.build.directory}/deps/brooklyn-dist-${project.version}</src>
+                                    <src>${project.build.directory}/deps/apache-brooklyn-${project.version}/bin</src>
                                     <type>directory</type>
                                     <mapper>
                                         <type>perm</type>
-                                        <prefix>/opt/brooklyn</prefix>
+                                        <prefix>/opt/brooklyn-${project.version}/bin</prefix>
                                         <user>brooklyn</user>
                                         <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.bin}</filemode>
                                     </mapper>
                                 </data>
                                 <data>
-                                    <src>${project.build.directory}/deps/shared-packaging/service/upstart/deb/brooklyn.conf</src>
-                                    <type>file</type>
+                                    <src>${project.build.directory}/deps/apache-brooklyn-${project.version}/catalog</src>
+                                    <type>directory</type>
                                     <mapper>
                                         <type>perm</type>
-                                        <prefix>/etc/init</prefix>
-                                        <filemode>644</filemode>
+                                        <prefix>/opt/brooklyn-${project.version}/catalog</prefix>
+                                        <user>brooklyn</user>
+                                        <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
                                     </mapper>
                                 </data>
                                 <data>
-                                    <!-- TODO Probably should live in /usr/lib/systemd/system
with a symlink in the following folder -->
-                                    <src>${project.build.directory}/deps/shared-packaging/service/systemd/brooklyn.service</src>
-                                    <type>file</type>
+                                    <src>${project.build.directory}/deps/apache-brooklyn-${project.version}/data</src>
+                                    <type>directory</type>
                                     <mapper>
                                         <type>perm</type>
-                                        <prefix>/etc/systemd/system/multi-user.target.wants</prefix>
-                                        <filemode>644</filemode>
+                                        <prefix>/opt/brooklyn-${project.version}/data</prefix>
+                                        <user>brooklyn</user>
+                                        <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
+                                    </mapper>
+                                </data>
+                                <data>
+                                    <src>${project.build.directory}/deps/apache-brooklyn-${project.version}/deploy</src>
+                                    <type>directory</type>
+                                    <mapper>
+                                        <type>perm</type>
+                                        <prefix>/opt/brooklyn-${project.version}/deploy</prefix>
+                                        <user>brooklyn</user>
+                                        <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
+                                    </mapper>
+                                </data>
+                                <data>
+                                    <src>${project.build.directory}/deps/apache-brooklyn-${project.version}/etc</src>
+                                    <type>directory</type>
+                                    <conffile>true</conffile>
+                                    <mapper>
+                                        <type>perm</type>
+                                        <prefix>/etc/brooklyn</prefix>
+                                        <user>brooklyn</user>
+                                        <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
+                                    </mapper>
+                                </data>
+                                <data>
+                                    <src>${project.build.directory}/deps/apache-brooklyn-${project.version}/lib</src>
+                                    <type>directory</type>
+                                    <mapper>
+                                        <type>perm</type>
+                                        <prefix>/opt/brooklyn-${project.version}/lib</prefix>
+                                        <user>brooklyn</user>
+                                        <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
+                                    </mapper>
+                                </data>
+                                <data>
+                                    <src>${project.build.directory}/deps/apache-brooklyn-${project.version}/system</src>
+                                    <type>directory</type>
+                                    <mapper>
+                                        <type>perm</type>
+                                        <prefix>/opt/brooklyn-${project.version}/system</prefix>
+                                        <user>brooklyn</user>
+                                        <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
                                     </mapper>
                                 </data>
                                 <data>
                                     <type>template</type>
                                     <paths>
-                                        <path>etc/brooklyn</path>
-                                        <path>var/lib/brooklyn</path>
+                                        <path>/opt/brooklyn-${project.version}/data/log</path>
                                     </paths>
                                     <mapper>
                                         <type>perm</type>
                                         <user>brooklyn</user>
                                         <group>brooklyn</group>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
                                     </mapper>
                                 </data>
                                 <data>
                                     <type>template</type>
                                     <paths>
-                                        <path>var/log/brooklyn</path>
+                                        <path>/var/lib/brooklyn</path>
                                     </paths>
                                     <mapper>
                                         <type>perm</type>
                                         <user>brooklyn</user>
                                         <group>brooklyn</group>
-                                        <filemode>700</filemode>
+                                        <filemode>${brooklyn.file.permission.default}</filemode>
                                     </mapper>
                                 </data>
                                 <data>
-                                    <src>${project.build.directory}/deps/shared-packaging/conf/brooklyn.conf</src>
+                                    <src>${project.build.directory}/deps/shared-packaging/service/upstart/deb/brooklyn.conf</src>
                                     <type>file</type>
-                                    <conffile>true</conffile>
                                     <mapper>
                                         <type>perm</type>
-                                        <prefix>/etc/brooklyn</prefix>
-                                        <user>brooklyn</user>
-                                        <group>brooklyn</group>
-                                        <filemode>600</filemode>
+                                        <prefix>/etc/init</prefix>
+                                        <filemode>${brooklyn.file.permission.global}</filemode>
                                     </mapper>
                                 </data>
                                 <data>
-                                    <src>${project.build.directory}/deps/shared-packaging/conf/logback.xml</src>
+                                    <src>${project.build.directory}/deps/shared-packaging/service/systemd/brooklyn.service</src>
                                     <type>file</type>
-                                    <conffile>true</conffile>
                                     <mapper>
                                         <type>perm</type>
-                                        <prefix>/etc/brooklyn</prefix>
-                                        <user>brooklyn</user>
-                                        <group>brooklyn</group>
-                                        <filemode>644</filemode>
+                                        <prefix>/lib/systemd/system</prefix>
+                                        <filemode>${brooklyn.file.permission.global}</filemode>
+                                    </mapper>
+                                </data>
+                                <data>
+                                    <!-- TODO Probably should live in /usr/lib/systemd/system
with a symlink in the following folder -->
+                                    <src>${project.build.directory}/deps/shared-packaging/service/systemd/brooklyn.service</src>
+                                    <type>file</type>
+                                    <mapper>
+                                        <type>perm</type>
+                                        <prefix>/etc/systemd/system/multi-user.target.wants</prefix>
+                                        <filemode>${brooklyn.file.permission.global}</filemode>
                                     </mapper>
                                 </data>
+                                <data>
+                                    <type>link</type>
+                                    <linkName>/opt/brooklyn</linkName>
+                                    <linkTarget>/opt/brooklyn-${project.version}</linkTarget>
+                                    <symlink>true</symlink>
+                                </data>
+                                <data>
+                                    <type>link</type>
+                                    <linkName>/opt/brooklyn-${project.version}/etc</linkName>
+                                    <linkTarget>/etc/brooklyn</linkTarget>
+                                    <symlink>true</symlink>
+                                </data>
+                                <data>
+                                    <type>link</type>
+                                    <linkName>/var/log/brooklyn</linkName>
+                                    <linkTarget>/opt/brooklyn-${project.version}/data/log</linkTarget>
+                                    <symlink>true</symlink>
+                                </data>
                             </dataSet>
                         </configuration>
                     </execution>

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf
----------------------------------------------------------------------
diff --git a/shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf b/shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf
index 931fffd..c62a98e 100644
--- a/shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf
+++ b/shared-packaging/src/main/resources/service/upstart/deb/brooklyn.conf
@@ -22,6 +22,7 @@ start on started networking
 stop on runlevel [016]
 respawn
 respawn limit 5 10
+umask 0066
 
 setuid brooklyn
 setgid brooklyn
@@ -33,11 +34,13 @@ pre-start script
 end script
 
 script
-    BROOKLYN_HOME="/opt/brooklyn/"
-    JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1
-Dlogback.configurationFile=/etc/brooklyn/logback.xml -Xms256m -Xmx1g"
-    CLASSPATH="/opt/brooklyn/conf:/opt/brooklyn/lib/patch/*:/opt/brooklyn/lib/brooklyn/*:/opt/brooklyn/lib/dropins/*"
-    export BROOKLYN_HOME
-    exec java ${JAVA_OPTS} -cp "${CLASSPATH}" org.apache.brooklyn.cli.Main launch --noGlobalBrooklynProperties
--localBrooklynProperties /etc/brooklyn/brooklyn.conf --persist auto
+    EXTRA_JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -XX:SoftRefLRUPolicyMSPerMB=1
-Xms256m -Xmx1g"
+    KARAF_HOME="/opt/brooklyn/"
+    KARAF_ETC="/etc/brooklyn/"
+    KARAF_REDIRECT=/dev/null
+    BROOKLYN_PERSISTENCE_DIR="/var/lib/brooklyn"
+    export EXTRA_JAVA_OPTS KARAF_REDIRECT KARAF_HOME KARAF_ETC BROOKLYN_PERSISTENCE_DIR
+    exec /opt/brooklyn/bin/karaf server  >> "$KARAF_REDIRECT" 2>&1
 end script
 
 pre-stop script

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/shared-packaging/src/test/yaml/Vagrantfile
----------------------------------------------------------------------
diff --git a/shared-packaging/src/test/yaml/Vagrantfile b/shared-packaging/src/test/yaml/Vagrantfile
index 9855aff..3e561bd 100644
--- a/shared-packaging/src/test/yaml/Vagrantfile
+++ b/shared-packaging/src/test/yaml/Vagrantfile
@@ -33,8 +33,10 @@ Vagrant.configure(2) do |config|
   config.vm.provision "shell", name:"set key permissions", privileged:false, inline: "chmod
400 ~/.ssh/authorized_keys"
 
   config.vm.define "apt-systemd" do |config|
-    config.vm.box = "ubuntu/wily64"
+    config.vm.box = "ubuntu/xenial64"
     config.vm.network "private_network", ip: "172.28.128.3"
+    config.ssh.insert_key = true
+    config.ssh.forward_agent = true
   end
   config.vm.define "apt-upstart" do |config|
     config.vm.box = "ubuntu/trusty64"

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/shared-packaging/src/test/yaml/package-apps.yaml
----------------------------------------------------------------------
diff --git a/shared-packaging/src/test/yaml/package-apps.yaml b/shared-packaging/src/test/yaml/package-apps.yaml
index bda0c51..0900dd7 100644
--- a/shared-packaging/src/test/yaml/package-apps.yaml
+++ b/shared-packaging/src/test/yaml/package-apps.yaml
@@ -23,9 +23,9 @@ services:
     byon:
       hosts: ["172.28.128.3"]
       # privateKeyFile: ~/.ssh/<private key>
-      user: vagrant
+      user: ubuntu
   brooklyn.config:
-    package.file:  ~/.m2/repository/org/apache/brooklyn/deb-packaging/0.12.0-SNAPSHOT/deb-packaging-0.12.0-SNAPSHOT.deb
# BROOKLYN_VERSION
+    package.file:  ~/.m2/repository/org/apache/brooklyn/deb-packaging/0.12.0-SNAPSHOT/deb-packaging-0.12.0-SNAPSHOT-all.deb
# BROOKLYN_VERSION
 
 ---
 
@@ -38,7 +38,7 @@ services:
       # privateKeyFile: ~/.ssh/<private key>
       user: vagrant
   brooklyn.config:
-    package.file: ~/.m2/repository/org/apache/brooklyn/deb-packaging/0.12.0-SNAPSHOT/deb-packaging-0.12.0-SNAPSHOT.deb
# BROOKLYN_VERSION
+    package.file: ~/.m2/repository/org/apache/brooklyn/deb-packaging/0.12.0-SNAPSHOT/deb-packaging-0.12.0-SNAPSHOT-all.deb
# BROOKLYN_VERSION
 
 ---
 

http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/c640784c/shared-packaging/src/test/yaml/package.bom
----------------------------------------------------------------------
diff --git a/shared-packaging/src/test/yaml/package.bom b/shared-packaging/src/test/yaml/package.bom
index bc1780d..ba5615a 100644
--- a/shared-packaging/src/test/yaml/package.bom
+++ b/shared-packaging/src/test/yaml/package.bom
@@ -53,6 +53,7 @@ brooklyn.catalog:
           sudo apt-get update
           sudo apt-get install -y default-jre-headless
           sudo dpkg -i brooklyn-package.deb
+          sudo systemctl start brooklyn
 
   - id: apt-upstart-brooklyn
     item:
@@ -65,6 +66,7 @@ brooklyn.catalog:
           sudo apt-get update
           sudo apt-get install -y default-jre-headless
           sudo dpkg -i brooklyn-package.deb
+          sudo initctl start brooklyn
 
   - id: yum-systemd-brooklyn
     item:
@@ -166,17 +168,17 @@ brooklyn.catalog:
       name: Check paths permissions
       command: |
         BROOKLYN_DIRECTORIES="/opt/brooklyn/ /etc/brooklyn/ /var/lib/brooklyn/ /var/log/brooklyn/"
-        [ "$(sudo stat -c "%A %U %G" /opt/brooklyn)" = "lrwxrwxrwx brooklyn brooklyn" ]
+        [ "$(sudo stat -c "%A" /opt/brooklyn)" = "lrwxrwxrwx" ]
         [ "$(sudo stat -c "%A %U %G" /etc/init)" = "drwxr-xr-x root root" ]
         [ "$(sudo stat -c "%A %U %G" /lib/systemd/system/)" = "drwxr-xr-x root root" ]
         [ "$(sudo stat -c "%A %U %G" /etc/init/brooklyn.conf)" = "-rw-rw-r-- root root" ]
         [ "$(sudo stat -c "%A %U %G" /lib/systemd/system/brooklyn.service)" = "-rw-rw-r--
root root" ]
         if hash systemctl ; then
-          [ "$(sudo stat -c "%A %U %G" /etc/systemd/system/multi-user.target.wants/brooklyn.service)"
= "-rwxr----- root root" ]
+          [ "$(sudo stat -c "%A %U %G" /etc/systemd/system/multi-user.target.wants/brooklyn.service)"
= "-rw-rw-r-- root root" ]
         fi
-        ! sudo ls -d /opt/brooklyn-* | xargs stat -c "%F %a %U %G" | grep -v -E "^directory\s740\sbrooklyn\sbrooklyn$"
-        ! sudo find ${BROOKLYN_DIRECTORIES} -type f | xargs sudo stat -c "%a %U %G" | grep
-v -E "^[6,7][0,4,6][0]\sbrooklyn\sbrooklyn"
-        ! sudo find ${BROOKLYN_DIRECTORIES} -type d | xargs sudo stat -c "%a %U %G" | grep
-v -E "^[6,7][0,1,4][0-1]\sbrooklyn\sbrooklyn"
+        ! sudo ls -d /opt/brooklyn-* | xargs stat -c "%F %a %U %G" | grep -v -E "^directory\s[7][4,5][0,5]\sbrooklyn\sbrooklyn$"
+        ! sudo find ${BROOKLYN_DIRECTORIES} -type f | xargs sudo stat -c "%a %U %G" | grep
-v -E "^[6,7][0,4,6][0]\sbrooklyn\s(brooklyn|wheel)"
+        ! sudo find ${BROOKLYN_DIRECTORIES} -type d | xargs sudo stat -c "%a %U %G" | grep
-v -E "^[6,7][0,1,4,5][0,1,5]\sbrooklyn\s(brooklyn|wheel)"
       assertStatus:
         equals: 0
   - id: test-log-files-exist


Mime
View raw message