From d1b541abd040d5c97a99c1242a25c205aa6fbade Mon Sep 17 00:00:00 2001 From: alrick87 Date: Wed, 30 Mar 2016 13:55:24 +0300 Subject: [PATCH] Add deb packaging files --- deb-packaging/pom.xml | 122 ++++++++++++++++++ .../src/conf/brooklyn.conf | 0 .../src/conf/logback.xml | 0 deb-packaging/src/deb/control/control | 24 ++++ deb-packaging/src/deb/control/postinst | 20 +++ deb-packaging/src/deb/control/postrm | 18 +++ deb-packaging/src/deb/control/preinst | 19 +++ deb-packaging/src/deb/control/prerm | 18 +++ deb-packaging/src/deb/init.d/brooklyn | 93 +++++++++++++ pom.xml | 14 +- {packaging => rpm-packaging}/pom.xml | 2 +- rpm-packaging/src/conf/brooklyn.conf | 26 ++++ rpm-packaging/src/conf/logback.xml | 24 ++++ .../src/service/brooklyn.service | 0 14 files changed, 378 insertions(+), 2 deletions(-) create mode 100644 deb-packaging/pom.xml rename {packaging => deb-packaging}/src/conf/brooklyn.conf (100%) rename {packaging => deb-packaging}/src/conf/logback.xml (100%) create mode 100644 deb-packaging/src/deb/control/control create mode 100644 deb-packaging/src/deb/control/postinst create mode 100644 deb-packaging/src/deb/control/postrm create mode 100644 deb-packaging/src/deb/control/preinst create mode 100644 deb-packaging/src/deb/control/prerm create mode 100644 deb-packaging/src/deb/init.d/brooklyn rename {packaging => rpm-packaging}/pom.xml (99%) create mode 100644 rpm-packaging/src/conf/brooklyn.conf create mode 100644 rpm-packaging/src/conf/logback.xml rename {packaging => rpm-packaging}/src/service/brooklyn.service (100%) diff --git a/deb-packaging/pom.xml b/deb-packaging/pom.xml new file mode 100644 index 0000000000..566f93a60e --- /dev/null +++ b/deb-packaging/pom.xml @@ -0,0 +1,122 @@ + + + + 4.0.0 + deb-packaging + Brooklyn DEB Package + + Brooklyn DEB Package for Debian and Ubuntu operating systems + + + + org.apache.brooklyn + brooklyn-dist-root + 0.10.0-SNAPSHOT + ../pom.xml + + + + + org.apache.brooklyn + brooklyn-dist + ${project.version} + + + + + + jdeb + org.vafer + 1.5 + + + package + + jdeb + + + true + target/apache-brooklyn_${project.version}_all.deb + ${basedir}/src/deb/control + + + ../dist/target/brooklyn-dist + directory + + perm + /opt + brooklyn + brooklyn + + + + ${basedir}/src/deb/init.d/brooklyn + file + + perm + /etc/init.d + 755 + + + + template + + etc/brooklyn + var/lib/brooklyn + var/log/brooklyn + + + perm + brooklyn + brooklyn + + + + ${basedir}/src/conf/brooklyn.conf + file + true + + perm + /etc/brooklyn + brooklyn + brooklyn + 600 + + + + ${basedir}/src/conf/logback.xml + file + true + + perm + /etc/brooklyn + brooklyn + brooklyn + 644 + + + + + + + + + + diff --git a/packaging/src/conf/brooklyn.conf b/deb-packaging/src/conf/brooklyn.conf similarity index 100% rename from packaging/src/conf/brooklyn.conf rename to deb-packaging/src/conf/brooklyn.conf diff --git a/packaging/src/conf/logback.xml b/deb-packaging/src/conf/logback.xml similarity index 100% rename from packaging/src/conf/logback.xml rename to deb-packaging/src/conf/logback.xml diff --git a/deb-packaging/src/deb/control/control b/deb-packaging/src/deb/control/control new file mode 100644 index 0000000000..1729a3635b --- /dev/null +++ b/deb-packaging/src/deb/control/control @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +Package: apache-brooklyn +Version: [[version]] +Section: misc +Priority: optional +Architecture: all +Depends: jdk (>= 1.7) +Maintainer: Aleksandr Vasilev +Description: Apache Brooklyn is a framework for modeling, monitoring, and managing applications through autonomic blueprints. diff --git a/deb-packaging/src/deb/control/postinst b/deb-packaging/src/deb/control/postinst new file mode 100644 index 0000000000..657467ab67 --- /dev/null +++ b/deb-packaging/src/deb/control/postinst @@ -0,0 +1,20 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +/usr/sbin/update-rc.d -f brooklyn defaults +/usr/sbin/update-rc.d brooklyn enable +service brooklyn start diff --git a/deb-packaging/src/deb/control/postrm b/deb-packaging/src/deb/control/postrm new file mode 100644 index 0000000000..55360bda39 --- /dev/null +++ b/deb-packaging/src/deb/control/postrm @@ -0,0 +1,18 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +/usr/sbin/userdel brooklyn diff --git a/deb-packaging/src/deb/control/preinst b/deb-packaging/src/deb/control/preinst new file mode 100644 index 0000000000..81f1c87f99 --- /dev/null +++ b/deb-packaging/src/deb/control/preinst @@ -0,0 +1,19 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# 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 diff --git a/deb-packaging/src/deb/control/prerm b/deb-packaging/src/deb/control/prerm new file mode 100644 index 0000000000..69d5fff4de --- /dev/null +++ b/deb-packaging/src/deb/control/prerm @@ -0,0 +1,18 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +service brooklyn stop diff --git a/deb-packaging/src/deb/init.d/brooklyn b/deb-packaging/src/deb/init.d/brooklyn new file mode 100644 index 0000000000..99c7d12bcf --- /dev/null +++ b/deb-packaging/src/deb/init.d/brooklyn @@ -0,0 +1,93 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +### BEGIN INIT INFO +# Provides: brooklyn +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Apache Brooklyn +# Description: Apache Brooklyn init script +### END INIT INFO + +# Author: Aleksandr Vasilev + +[ -d /opt/brooklyn ] || exit 0 + +SERVICE_NAME="brooklyn" +PID_FILE="/var/lib/${SERVICE_NAME}/${SERVICE_NAME}.pid" +LOG_FILE="/var/log/brooklyn/service.log" +JAVA_OPTS="-Dbrooklyn.location.localhost.address=127.0.0.1 -Dlogback.configurationFile=/etc/${SERVICE_NAME}/logback.xml -Xms256m -Xmx1g -XX:MaxPermSize=256m" +CLASSPATH="/opt/${SERVICE_NAME}/conf:/opt/${SERVICE_NAME}/lib/patch/*:/opt/${SERVICE_NAME}/lib/${SERVICE_NAME}/*:/opt/${SERVICE_NAME}/lib/dropins/*" +EXEC_START="/usr/bin/java $JAVA_OPTS -cp "$CLASSPATH" org.apache.brooklyn.cli.Main launch --noGlobalBrooklynProperties --localBrooklynProperties /etc/brooklyn/brooklyn.conf --persist auto" + +do_start() { + if [ -f ${PID_FILE} ] && kill -0 $(cat ${PID_FILE}) > /dev/null 2>&1; then + echo "${SERVICE_NAME} is running, pid $(cat ${PID_FILE})" + exit 1 + else + nohup ${EXEC_START} >> ${LOG_FILE} 2>&1 & + if [ $? -eq 0 ]; then + PID=$! + echo ${PID} > ${PID_FILE} + echo "${SERVICE_NAME} started, pid ${PID}" + else + echo "${SERVICE_NAME} failed to start, exiting..." + exit 1 + fi + fi +} + +do_stop() { + if [ ! -f ${PID_FILE} ] || ! kill -0 $(cat ${PID_FILE}) > /dev/null 2>&1; then + echo "${SERVICE_NAME} is not running" + exit 1 + else + kill $(cat ${PID_FILE}) && rm -f ${PID_FILE} + echo "${SERVICE_NAME} stopped" + fi +} + +do_status() { + if [ -f ${PID_FILE} ] && kill -0 $(cat ${PID_FILE}) > /dev/null 2>&1; then + echo "${SERVICE_NAME} is running, pid $(cat ${PID_FILE})" + else + echo "${SERVICE_NAME} is not running" + fi +} + +case $1 in + start) + do_start + ;; + stop) + do_stop + ;; + restart|force-reload) + do_stop + do_start + ;; + status) + do_status + ;; + *) + echo $"Usage: $0 {start|stop|restart|status}" + exit 1 +esac diff --git a/pom.xml b/pom.xml index 494ba7d100..bd8bc94ada 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,19 @@ - packaging + rpm-packaging + + + + + deb-module + + + !no-deb + + + + deb-packaging diff --git a/packaging/pom.xml b/rpm-packaging/pom.xml similarity index 99% rename from packaging/pom.xml rename to rpm-packaging/pom.xml index 7c51c67f76..26c7ef9290 100644 --- a/packaging/pom.xml +++ b/rpm-packaging/pom.xml @@ -20,7 +20,7 @@ 4.0.0 pom - brooklyn-packaging + rpm-packaging Brooklyn RPM Package Brooklyn RPM Package for Centos 7 and RHEL 7 operating systems diff --git a/rpm-packaging/src/conf/brooklyn.conf b/rpm-packaging/src/conf/brooklyn.conf new file mode 100644 index 0000000000..3fe950c39e --- /dev/null +++ b/rpm-packaging/src/conf/brooklyn.conf @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +################################## Welcome! ############################################ + +# It's great to have you here. +# Documentation is available at https://brooklyn.apache.org/documentation/index.html +########################################################################################## + +brooklyn.base.dir=/var/lib/brooklyn/ +brooklyn.persistence.dir=data +brooklyn.persistence.backups.dir=backups diff --git a/rpm-packaging/src/conf/logback.xml b/rpm-packaging/src/conf/logback.xml new file mode 100644 index 0000000000..00e800113d --- /dev/null +++ b/rpm-packaging/src/conf/logback.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/packaging/src/service/brooklyn.service b/rpm-packaging/src/service/brooklyn.service similarity index 100% rename from packaging/src/service/brooklyn.service rename to rpm-packaging/src/service/brooklyn.service