4.4 for centos7
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b527aabf Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b527aabf Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b527aabf Branch: refs/heads/4.4 Commit: b527aabfc352474541a2f6c7831b819356ec453a Parents: f9dce0b Author: Daan Hoogland <dhoogl...@schubergphilis.com> Authored: Mon Mar 23 14:22:08 2015 +0100 Committer: Daan Hoogland <dhoogl...@schubergphilis.com> Committed: Mon Mar 23 14:22:08 2015 +0100 ---------------------------------------------------------------------- packaging/centos7/cloud-agent.rc | 117 ++ packaging/centos7/cloud-ipallocator.rc | 96 ++ packaging/centos7/cloud-management.service | 37 + packaging/centos7/cloud-management.sudoers | 22 + packaging/centos7/cloud-management.sysconfig | 48 + packaging/centos7/cloud-usage-sysd | 90 ++ packaging/centos7/cloud-usage.service | 37 + packaging/centos7/cloud-usage.sysconfig | 31 + packaging/centos7/cloud.limits | 19 + packaging/centos7/cloud.spec | 617 +++++++++ packaging/centos7/cloudstack-agent.te | 33 + packaging/centos7/cloudstack-sccs | 20 + packaging/centos7/replace.properties | 60 + packaging/centos7/tomcat7/catalina.properties | 81 ++ .../centos7/tomcat7/cloud-bridge.properties | 25 + .../centos7/tomcat7/commons-logging.properties | 30 + packaging/centos7/tomcat7/db.properties | 107 ++ .../centos7/tomcat7/ec2-service.properties | 25 + .../centos7/tomcat7/environment.properties | 22 + packaging/centos7/tomcat7/java.security.ciphers | 18 + packaging/centos7/tomcat7/log4j-cloud.xml | 217 ++++ packaging/centos7/tomcat7/server.xml | 112 ++ packaging/centos7/tomcat7/tomcat-users.xml | 31 + packaging/centos7/tomcat7/web.xml | 1188 ++++++++++++++++++ 24 files changed, 3083 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-agent.rc ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-agent.rc b/packaging/centos7/cloud-agent.rc new file mode 100644 index 0000000..6cc6abc --- /dev/null +++ b/packaging/centos7/cloud-agent.rc @@ -0,0 +1,117 @@ +#!/bin/bash + +# chkconfig: 35 99 10 +# description: Cloud Agent + +# 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. + +# WARNING: if this script is changed, then all other initscripts MUST BE changed to match it as well + +. /etc/rc.d/init.d/functions + +# set environment variables + +SHORTNAME=$(basename $0 | sed -e 's/^[SK][0-9][0-9]//') +PIDFILE=/var/run/"$SHORTNAME".pid +LOCKFILE=/var/lock/subsys/"$SHORTNAME" +LOGDIR=/var/log/cloudstack/agent +LOGFILE=${LOGDIR}/agent.log +PROGNAME="Cloud Agent" +CLASS="com.cloud.agent.AgentShell" +JSVC=`which jsvc 2>/dev/null`; + +# exit if we don't find jsvc +if [ -z "$JSVC" ]; then + echo no jsvc found in path; + exit 1; +fi + +unset OPTIONS +[ -r /etc/sysconfig/"$SHORTNAME" ] && source /etc/sysconfig/"$SHORTNAME" + +# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT) +JDK_DIRS="/usr/lib/jvm/jre /usr/lib/jvm/java-7-openjdk /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-openjdk-i386 /usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-sun" + +for jdir in $JDK_DIRS; do + if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then + JAVA_HOME="$jdir" + fi +done +export JAVA_HOME + +ACP=`ls /usr/share/cloudstack-agent/lib/*.jar | tr '\n' ':' | sed s'/.$//'` +PCP=`ls /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'` + +# We need to append the JSVC daemon JAR to the classpath +# AgentShell implements the JSVC daemon methods +export CLASSPATH="/usr/share/java/commons-daemon.jar:$ACP:$PCP:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts" + +start() { + echo -n $"Starting $PROGNAME: " + if hostname --fqdn >/dev/null 2>&1 ; then + $JSVC -Xms256m -Xmx2048m -cp "$CLASSPATH" -pidfile "$PIDFILE" \ + -errfile $LOGDIR/cloudstack-agent.err -outfile $LOGDIR/cloudstack-agent.out $CLASS + RETVAL=$? + echo + else + failure + echo + echo The host name does not resolve properly to an IP address. Cannot start "$PROGNAME". > /dev/stderr + RETVAL=9 + fi + [ $RETVAL = 0 ] && touch ${LOCKFILE} + return $RETVAL +} + +stop() { + echo -n $"Stopping $PROGNAME: " + $JSVC -pidfile "$PIDFILE" -stop $CLASS + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PIDFILE} +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p ${PIDFILE} $SHORTNAME + RETVAL=$? + ;; + restart) + stop + sleep 3 + start + ;; + condrestart) + if status -p ${PIDFILE} $SHORTNAME >&/dev/null; then + stop + sleep 3 + start + fi + ;; + *) + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" + RETVAL=3 +esac + +exit $RETVAL http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-ipallocator.rc ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-ipallocator.rc b/packaging/centos7/cloud-ipallocator.rc new file mode 100644 index 0000000..d26287d --- /dev/null +++ b/packaging/centos7/cloud-ipallocator.rc @@ -0,0 +1,96 @@ +#!/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. + +# chkconfig: 35 99 10 +# description: Cloud Agent + +# WARNING: if this script is changed, then all other initscripts MUST BE changed to match it as well + +. /etc/rc.d/init.d/functions + +# set environment variables + +SHORTNAME=`basename $0` +PIDFILE=/var/run/"$SHORTNAME".pid +LOCKFILE=/var/lock/subsys/"$SHORTNAME" +LOGFILE=/var/log/cloudstack/ipallocator/ipallocator.log +PROGNAME="External IPAllocator" + +unset OPTIONS +[ -r /etc/sysconfig/"$SHORTNAME" ] && source /etc/sysconfig/"$SHORTNAME" +DAEMONIZE=/usr/bin/cloud-daemonize +PROG=/usr/bin/cloud-external-ipallocator.py +OPTIONS=8083 + +start() { + echo -n $"Starting $PROGNAME: " + if hostname --fqdn >/dev/null 2>&1 ; then + daemon --check=$SHORTNAME --pidfile=${PIDFILE} "$DAEMONIZE" \ + -n "$SHORTNAME" -p "$PIDFILE" -l "$LOGFILE" "$PROG" $OPTIONS + RETVAL=$? + echo + else + failure + echo + echo The host name does not resolve properly to an IP address. Cannot start "$PROGNAME". > /dev/stderr + RETVAL=9 + fi + [ $RETVAL = 0 ] && touch ${LOCKFILE} + return $RETVAL +} + +stop() { + echo -n $"Stopping $PROGNAME: " + killproc -p ${PIDFILE} $SHORTNAME # -d 10 $SHORTNAME + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PIDFILE} +} + + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p ${PIDFILE} $SHORTNAME + RETVAL=$? + ;; + restart) + stop + sleep 3 + start + ;; + condrestart) + if status -p ${PIDFILE} $SHORTNAME >&/dev/null; then + stop + sleep 3 + start + fi + ;; + *) + echo $"Usage: $SHORTNAME {start|stop|restart|condrestart|status|help}" + RETVAL=3 +esac + +exit $RETVAL + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-management.service ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-management.service b/packaging/centos7/cloud-management.service new file mode 100644 index 0000000..697ad11 --- /dev/null +++ b/packaging/centos7/cloud-management.service @@ -0,0 +1,37 @@ +# 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. + +# Systemd unit file for CloudStack Management server +# +# clone tomcat service, see /usr/lib/systemd/system/tomcat.service + +[Unit] +Description=CloudStack Management Server +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/sbin/tomcat-sysd start +ExecStop=/usr/sbin/tomcat-sysd stop +SuccessExitStatus=143 +User=cloud +Group=cloud +EnvironmentFile=/etc/sysconfig/cloudstack-management + +[Install] +WantedBy=multi-user.target + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-management.sudoers ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-management.sudoers b/packaging/centos7/cloud-management.sudoers new file mode 100644 index 0000000..ad79cae --- /dev/null +++ b/packaging/centos7/cloud-management.sudoers @@ -0,0 +1,22 @@ +# 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. + +Cmnd_Alias CLOUDSTACK = /bin/mkdir, /bin/mount, /bin/umount, /bin/cp, /bin/chmod, /usr/bin/keytool, /bin/keytool + +Defaults:cloud !requiretty + +cloud ALL=(root) NOPASSWD:CLOUDSTACK http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-management.sysconfig ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-management.sysconfig b/packaging/centos7/cloud-management.sysconfig new file mode 100644 index 0000000..961072a --- /dev/null +++ b/packaging/centos7/cloud-management.sysconfig @@ -0,0 +1,48 @@ +# 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. + +# Required for a tocmat cloned service +SERVICE_NAME=cloudstack-management + +# Where your java installation lives +#JAVA_HOME="/usr/lib/jvm/java" + +# Where your cloudstack-management installation lives +CATALINA_BASE="/usr/share/cloudstack-management" +CATALINA_HOME="/usr/share/cloudstack-management" +JASPER_HOME="/usr/share/cloudstack-management" +CATALINA_TMPDIR="/usr/share/cloudstack-management/temp" + +JAVA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:PermSize=512M -XX:MaxPermSize=800m" + +if [ -r "/etc/cloudstack/management/cloudmanagementserver.keystore" ] ; then + JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=/etc/cloudstack/management/cloudmanagementserver.keystore -Djavax.net.ssl.trustStorePassword=vmops.com " +fi + +TOMCAT_USER="cloud" + +SECURITY_MANAGER="false" + +SHUTDOWN_WAIT="30" + +SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +CATALINA_PID="/var/run/cloudstack-management.pid" + +CLASSPATH=/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup:/usr/share/java/mysql-connector-java.jar + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-usage-sysd ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-usage-sysd b/packaging/centos7/cloud-usage-sysd new file mode 100644 index 0000000..a7c0f2f --- /dev/null +++ b/packaging/centos7/cloud-usage-sysd @@ -0,0 +1,90 @@ +#!/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. + +. /etc/sysconfig/cloudstack-usage + +start() { + if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then + echo "$PROGNAME apparently already running" + exit 0 + fi + + if hostname --fqdn >/dev/null 2>&1 ; then + true + else + echo "The host name does not resolve properly to an IP address. Cannot start $PROGNAME" + exit 1 + fi + + echo -n "Starting $PROGNAME" "$SHORTNAME" + + if /usr/bin/jsvc -pidfile $PIDFILE $DAEMON -home "$JAVA_HOME" -cp "$CLASSPATH" -pidfile "$PIDFILE" -user "$USER" \ + -errfile $LOGDIR/cloudstack-usage.err -outfile $LOGDIR/cloudstack-usage.out -Dpid=$$ $CLASS + RETVAL=$? + then + rc=0 + sleep 1 + if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then + rc=1 + fi + else + rc=1 + fi + + if [ $rc -ne 0 ]; then + echo > "$PIDFILE" + exit 1 + fi +} + +stop() { + echo -n "Stopping $PROGNAME" "$SHORTNAME" + if [ -e $PIDFILE ] ; then + kill $(<$PIDFILE) > /dev/null 2>&1 + echo > $PIDFILE + else + echo Unable to stop $SHORTNAME, no pid file + echo > $PIDFILE + exit 1 + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p $PIDFILE $SHORTNAME + RETVAL=$? + ;; + restart | force-reload) + stop + sleep 3 + start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload|status}" + RETVAL=3 +esac + +exit $RETVAL + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-usage.service ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-usage.service b/packaging/centos7/cloud-usage.service new file mode 100644 index 0000000..a1bbc1dd --- /dev/null +++ b/packaging/centos7/cloud-usage.service @@ -0,0 +1,37 @@ +# 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. + +# Systemd unit file for CloudStack Management server +# +# clone tomcat service, see /usr/lib/systemd/system/tomcat.service + +[Unit] +Description=CloudStack Usage Server +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/sbin/cloudstack-usage-sysd start +ExecStop=/usr/sbin/cloudstack-usage-sysd stop +SuccessExitStatus=143 +User=cloud +Group=cloud +EnvironmentFile=/etc/sysconfig/cloudstack-usage + +[Install] +WantedBy=multi-user.target + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud-usage.sysconfig ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud-usage.sysconfig b/packaging/centos7/cloud-usage.sysconfig new file mode 100644 index 0000000..4154fef --- /dev/null +++ b/packaging/centos7/cloud-usage.sysconfig @@ -0,0 +1,31 @@ +# 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. + +SHORTNAME="cloudstack-usage" +PIDFILE=/var/run/"$SHORTNAME".pid +LOCKFILE=/var/lock/subsys/"$SHORTNAME" +LOGDIR=/var/log/cloudstack/usage +LOGFILE=${LOGDIR}/usage.log +PROGNAME="CloudStack Usage Monitor" +CLASS="com.cloud.usage.UsageServer" +USER=cloud + +UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar`":"`ls /usr/share/cloudstack-usage/lib/*.jar | tr '\n' ':'` +JCP="/usr/share/java/commons-daemon.jar":"/usr/share/java/mysql-connector-java.jar" + +CLASSPATH="$UCP:$JCP:/etc/cloudstack/usage" + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud.limits ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud.limits b/packaging/centos7/cloud.limits new file mode 100644 index 0000000..7debeb2 --- /dev/null +++ b/packaging/centos7/cloud.limits @@ -0,0 +1,19 @@ +# 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. + +cloud hard nofile 4096 +cloud soft nofile 4096 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloud.spec ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec new file mode 100644 index 0000000..ce1b6b8 --- /dev/null +++ b/packaging/centos7/cloud.spec @@ -0,0 +1,617 @@ +# 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. + +%define __os_install_post %{nil} +%global debug_package %{nil} + +# DISABLE the post-percentinstall java repacking and line number stripping +# we need to find a way to just disable the java repacking and line number stripping, but not the autodeps + +Name: cloudstack +Summary: CloudStack IaaS Platform +#http://fedoraproject.org/wiki/PackageNamingGuidelines#Pre-Release_packages +%if "%{?_prerelease}" != "" +%define _maventag %{_ver}-SNAPSHOT +Release: %{_rel}%{dist} +%else +%define _maventag %{_ver} +Release: %{_rel}%{dist} +%endif + +%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} + +Version: %{_ver} +License: ASL 2.0 +Vendor: Apache CloudStack <d...@cloudstack.apache.org> +Packager: Apache CloudStack <d...@cloudstack.apache.org> +Group: System Environment/Libraries +# FIXME do groups for every single one of the subpackages +Source0: %{name}-%{_maventag}.tgz +BuildRoot: %{_tmppath}/%{name}-%{_maventag}-%{release}-build + +BuildRequires: java-1.7.0-openjdk-devel +BuildRequires: tomcat => 7.0 +BuildRequires: ws-commons-util +BuildRequires: jpackage-utils +BuildRequires: gcc +BuildRequires: glibc-devel +BuildRequires: /usr/bin/mkisofs +BuildRequires: MySQL-python +BuildRequires: maven => 3.0.0 + +%description +CloudStack is a highly-scalable elastic, open source, +intelligent IaaS cloud implementation. + +%package management +Summary: CloudStack management server UI +Requires: tomcat => 7.0 +Requires: java => 1.7.0 +Requires: python +Requires: bash +Requires: bzip2 +Requires: gzip +Requires: unzip +Requires: /sbin/mount.nfs +Requires: openssh-clients +Requires: nfs-utils +Requires: wget +Requires: mysql +Requires: mysql-connector-java +Requires: ws-commons-util +Requires: jpackage-utils +Requires: sudo +Requires: /sbin/service +Requires: /sbin/chkconfig +Requires: /usr/bin/ssh-keygen +Requires: mkisofs +Requires: MySQL-python +Requires: ipmitool +Requires: %{name}-common = %{_ver} +Requires: %{name}-awsapi = %{_ver} +Requires: iptables-services +Group: System Environment/Libraries +%description management +The CloudStack management server is the central point of coordination, +management, and intelligence in CloudStack. + +%package common +Summary: Apache CloudStack common files and scripts +Requires: python +Group: System Environment/Libraries +%description common +The Apache CloudStack files shared between agent and management server + +%package agent +Summary: CloudStack Agent for KVM hypervisors +Requires: openssh-clients +Requires: java => 1.7.0 +Requires: %{name}-common = %{_ver} +Requires: libvirt +Requires: bridge-utils +Requires: ebtables +Requires: iptables +Requires: ethtool +Requires: iproute +Requires: ipset +Requires: jsvc +Requires: jakarta-commons-daemon +Requires: jakarta-commons-daemon-jsvc +Requires: perl +Requires: libvirt-python +Requires: qemu-img +Requires: qemu-kvm +Provides: cloud-agent +Group: System Environment/Libraries +%description agent +The CloudStack agent for KVM hypervisors + +%package baremetal-agent +Summary: CloudStack baremetal agent +Requires: tftp-server +Requires: xinetd +Requires: syslinux +Requires: chkconfig +Requires: dhcp +Requires: httpd +Group: System Environment/Libraries +%description baremetal-agent +The CloudStack baremetal agent + +%package usage +Summary: CloudStack Usage calculation server +Requires: java => 1.7.0 +Requires: jsvc +Requires: jakarta-commons-daemon +Requires: jakarta-commons-daemon-jsvc +Requires: mysql-connector-java +Group: System Environment/Libraries +%description usage +The CloudStack usage calculation service + +%package cli +Summary: Apache CloudStack CLI +Provides: python-cloudmonkey +Provides: python-marvin +Group: System Environment/Libraries +%description cli +Apache CloudStack command line interface + +%package awsapi +Summary: Apache CloudStack AWS API compatibility wrapper +Requires: %{name}-management = %{_ver} +Group: System Environment/Libraries +%description awsapi +Apache Cloudstack AWS API compatibility wrapper + +%if "%{_ossnoss}" == "noredist" +%package mysql-ha +Summary: Apache CloudStack Balancing Strategy for MySQL +Requires: mysql-connector-java +Requires: tomcat => 7.0 +Group: System Environmnet/Libraries +%description mysql-ha +Apache CloudStack Balancing Strategy for MySQL + +%endif + +%prep +echo Doing CloudStack build + +%setup -q -n %{name}-%{_maventag} + +%build + +cp packaging/centos7/replace.properties build/replace.properties +echo VERSION=%{_maventag} >> build/replace.properties +echo PACKAGE=%{name} >> build/replace.properties +touch build/gitrev.txt +echo $(git rev-parse HEAD) > build/gitrev.txt + +if [ "%{_ossnoss}" == "NOREDIST" -o "%{_ossnoss}" == "noredist" ] ; then + echo "Adding noredist flag to the maven build" + FLAGS="$FLAGS -Dnoredist" +fi + +if [ "%{_sim}" == "SIMULATOR" -o "%{_sim}" == "simulator" ] ; then + echo "Adding simulator flag to the maven build" + FLAGS="$FLAGS -Dsimulator" +fi + +mvn -Pawsapi,systemvm -DskipTests $FLAGS clean package + +%install +[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT} +# Common directories +mkdir -p ${RPM_BUILD_ROOT}%{_bindir} +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/awsapi +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/ipallocator +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/work +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/temp +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/mnt +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/management +mkdir -p ${RPM_BUILD_ROOT}%{_initrddir} +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig + +# Common +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/vms +mkdir -p ${RPM_BUILD_ROOT}%{python_sitearch}/ +mkdir -p ${RPM_BUILD_ROOT}%/usr/bin +cp -r scripts/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts +install -D systemvm/dist/systemvm.iso ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/vms/systemvm.iso +install -D systemvm/dist/systemvm.zip ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/vms/systemvm.zip +install python/lib/cloud_utils.py ${RPM_BUILD_ROOT}%{python_sitearch}/cloud_utils.py +cp -r python/lib/cloudutils ${RPM_BUILD_ROOT}%{python_sitearch}/ +python -m py_compile ${RPM_BUILD_ROOT}%{python_sitearch}/cloud_utils.py +python -m compileall ${RPM_BUILD_ROOT}%{python_sitearch}/cloudutils +cp build/gitrev.txt ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts +cp packaging/centos7/cloudstack-sccs ${RPM_BUILD_ROOT}/usr/bin + +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts/network/cisco +cp -r plugins/network-elements/cisco-vnmc/scripts/network/cisco/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts/network/cisco + +# Management +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/ +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/setup +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/management +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/awsapi +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/run + +# Specific for tomcat +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client +ln -sf /usr/share/tomcat/bin ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/bin +ln -sf /etc/%{name}/management ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/conf +ln -sf /usr/share/tomcat/lib ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/lib +ln -sf /var/log/%{name}/management ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/logs +ln -sf /var/cache/%{name}/management/temp ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/temp +ln -sf /var/cache/%{name}/management/work ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/work + +/bin/touch ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/management/catalina.out + +install -D client/target/utilities/bin/cloud-migrate-databases ${RPM_BUILD_ROOT}%{_bindir}/%{name}-migrate-databases +install -D client/target/utilities/bin/cloud-set-guest-password ${RPM_BUILD_ROOT}%{_bindir}/%{name}-set-guest-password +install -D client/target/utilities/bin/cloud-set-guest-sshkey ${RPM_BUILD_ROOT}%{_bindir}/%{name}-set-guest-sshkey +install -D client/target/utilities/bin/cloud-setup-databases ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-databases +install -D client/target/utilities/bin/cloud-setup-encryption ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-encryption +install -D client/target/utilities/bin/cloud-setup-management ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-management +install -D client/target/utilities/bin/cloud-setup-baremetal ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-baremetal +install -D client/target/utilities/bin/cloud-sysvmadm ${RPM_BUILD_ROOT}%{_bindir}/%{name}-sysvmadm +install -D client/target/utilities/bin/cloud-update-xenserver-licenses ${RPM_BUILD_ROOT}%{_bindir}/%{name}-update-xenserver-licenses + +cp -r client/target/utilities/scripts/db/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/setup +cp -r client/target/cloud-client-ui-%{_maventag}/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client + +# Don't package the scripts in the management webapp +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/scripts +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/vms + +for name in catalina.properties db.properties log4j-cloud.xml web.xml cloud-bridge.properties\ + ec2-service.properties server.xml commons-logging.properties environment.properties java.security.ciphers tomcat-users.xml +do + cp packaging/centos7/tomcat7/$name \ + ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/$name +done + +#ln -s %{_sysconfdir}/%{name}/management/log4j-cloud.xml \ +# ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/log4j-cloud.xml + +mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/context.xml \ + ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client + +install python/bindir/cloud-external-ipallocator.py ${RPM_BUILD_ROOT}%{_bindir}/%{name}-external-ipallocator.py +install -D client/target/pythonlibs/jasypt-1.9.2.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/jasypt-1.9.2.jar + +install -D packaging/centos7/cloud-ipallocator.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-ipallocator +install -D packaging/centos7/cloud-management.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-management +install -D packaging/centos7/cloud-management.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-management.service +install -D packaging/centos7/cloud-management.sudoers ${RPM_BUILD_ROOT}%{_sysconfdir}/sudoers.d/%{name}-management +install -D packaging/centos7/cloud.limits ${RPM_BUILD_ROOT}%{_sysconfdir}/security/limits.d/cloud +touch ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name}-management.pid + +chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina +chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost +chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/mnt +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/management +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/work +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/temp +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/management +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent + +# KVM Agent +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/plugins +install -D packaging/centos7/cloud-agent.rc ${RPM_BUILD_ROOT}%{_sysconfdir}/init.d/%{name}-agent +install -D agent/target/transformed/agent.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/agent.properties +install -D agent/target/transformed/environment.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/environment.properties +install -D agent/target/transformed/log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/log4j-cloud.xml +install -D agent/target/transformed/cloud-setup-agent ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-agent +install -D agent/target/transformed/cloudstack-agent-upgrade ${RPM_BUILD_ROOT}%{_bindir}/%{name}-agent-upgrade +install -D agent/target/transformed/libvirtqemuhook ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib/libvirtqemuhook +install -D agent/target/transformed/cloud-ssh ${RPM_BUILD_ROOT}%{_bindir}/%{name}-ssh +install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%name-agent/lib/cloud-plugin-hypervisor-kvm-%{_maventag}.jar +cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib + +# Usage server +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/lib +install -D usage/target/cloud-usage-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/cloud-usage-%{_maventag}.jar +install -D usage/target/transformed/db.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage/db.properties +install -D usage/target/transformed/log4j-cloud_usage.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage/log4j-cloud.xml +cp usage/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/lib/ +install -D packaging/centos7/cloud-usage.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-usage.service +install -D packaging/centos7/cloud-usage.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-usage +install -D packaging/centos7/cloud-usage-sysd ${RPM_BUILD_ROOT}/usr/sbin/%{name}-usage-sysd +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/run +touch ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name}-usage.pid +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/usage/ + +# CLI +cp -r cloud-cli/cloudtool ${RPM_BUILD_ROOT}%{python_sitearch}/ +install cloud-cli/cloudapis/cloud.py ${RPM_BUILD_ROOT}%{python_sitearch}/cloudapis.py + +# AWS API +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/setup +cp -r awsapi/target/cloud-awsapi-%{_maventag}/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi +install -D awsapi-setup/setup/cloud-setup-bridge ${RPM_BUILD_ROOT}%{_bindir}/cloudstack-setup-bridge +install -D awsapi-setup/setup/cloudstack-aws-api-register ${RPM_BUILD_ROOT}%{_bindir}/cloudstack-aws-api-register +cp -r awsapi-setup/db/mysql/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/setup +cp awsapi/resource/Axis2/axis2.xml ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/conf +cp awsapi/target/WEB-INF/services/cloud-ec2.aar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/services + + +for name in cloud-bridge.properties commons-logging.properties ec2-service.properties ; do + mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/$name \ + ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/$name +done + +# MYSQL HA +if [ "x%{_ossnoss}" == "xnoredist" ] ; then + mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-mysql-ha/lib + cp -r plugins/database/mysql-ha/target/cloud-plugin-database-mysqlha-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-mysql-ha/lib +fi + +#Don't package the below for AWS API +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/db.properties +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/LICENSE.txt +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/log4j.properties +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/log4j-vmops.xml +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/META-INF +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/NOTICE.txt +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/services.xml + +#License files from whisker +install -D tools/whisker/NOTICE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-management-%{version}/NOTICE +install -D tools/whisker/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-management-%{version}/LICENSE +install -D tools/whisker/NOTICE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-common-%{version}/NOTICE +install -D tools/whisker/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-common-%{version}/LICENSE +install -D tools/whisker/NOTICE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-agent-%{version}/NOTICE +install -D tools/whisker/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-agent-%{version}/LICENSE +install -D tools/whisker/NOTICE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-usage-%{version}/NOTICE +install -D tools/whisker/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-usage-%{version}/LICENSE +install -D tools/whisker/NOTICE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-awsapi-%{version}/NOTICE +install -D tools/whisker/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-awsapi-%{version}/LICENSE +install -D tools/whisker/NOTICE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-cli-%{version}/NOTICE +install -D tools/whisker/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-cli-%{version}/LICENSE +if [ "x%{_ossnoss}" == "xnoredist" ] ; then + install -D tools/whisker/LICENSE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-mysql-ha-%{version}/LICENSE + install -D tools/whisker/NOTICE ${RPM_BUILD_ROOT}%{_defaultdocdir}/%{name}-mysql-ha-%{version}/NOTICE +fi + +%clean +[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT} + +%pre awsapi +id cloud > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \ + -r -s /bin/sh -d %{_localstatedir}/cloudstack/management cloud|| true + +%preun management +/usr/bin/systemctl stop cloudstack-management || true +/usr/bin/systemctl off cloudstack-management || true + +%pre management +id cloud > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \ + -r -s /bin/sh -d %{_localstatedir}/cloudstack/management cloud|| true + +rm -rf %{_localstatedir}/cache/cloudstack + +%post management +if [ "$1" == "1" ] ; then + /usr/bin/systemctl on cloudstack-management > /dev/null 2>&1 || true +fi + +if [ -d "%{_datadir}/%{name}-management" ] ; then + ln -s %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080 +fi + +if [ ! -f %{_datadir}/cloudstack-common/scripts/vm/hypervisor/xenserver/vhd-util ] ; then + echo Please download vhd-util from http://download.cloud.com.s3.amazonaws.com/tools/vhd-util and put it in + echo %{_datadir}/cloudstack-common/scripts/vm/hypervisor/xenserver/ +fi + +%preun agent +/sbin/service cloudstack-agent stop || true +if [ "$1" == "0" ] ; then + /sbin/chkconfig --del cloudstack-agent > /dev/null 2>&1 || true + /sbin/service cloudstack-agent stop > /dev/null 2>&1 || true +fi + +%pre agent + +# save old configs if they exist (for upgrade). Otherwise we may lose them +# when the old packages are erased. There are a lot of properties files here. +if [ -d "%{_sysconfdir}/cloud" ] ; then + mv %{_sysconfdir}/cloud %{_sysconfdir}/cloud.rpmsave +fi + +%post agent +if [ "$1" == "1" ] ; then + echo "Running %{_bindir}/%{name}-agent-upgrade to update bridge name for upgrade from CloudStack 4.0.x (and before) to CloudStack 4.1 (and later)" + %{_bindir}/%{name}-agent-upgrade + if [ ! -d %{_sysconfdir}/libvirt/hooks ] ; then + mkdir %{_sysconfdir}/libvirt/hooks + fi + cp -a ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib/libvirtqemuhook %{_sysconfdir}/libvirt/hooks/qemu + /sbin/service libvirtd restart + /sbin/chkconfig --add cloudstack-agent > /dev/null 2>&1 || true + /sbin/chkconfig --level 345 cloudstack-agent on > /dev/null 2>&1 || true +fi + +# if saved configs from upgrade exist, copy them over +if [ -f "%{_sysconfdir}/cloud.rpmsave/agent/agent.properties" ]; then + mv %{_sysconfdir}/%{name}/agent/agent.properties %{_sysconfdir}/%{name}/agent/agent.properties.rpmnew + cp -p %{_sysconfdir}/cloud.rpmsave/agent/agent.properties %{_sysconfdir}/%{name}/agent + # make sure we only do this on the first install of this RPM, don't want to overwrite on a reinstall + mv %{_sysconfdir}/cloud.rpmsave/agent/agent.properties %{_sysconfdir}/cloud.rpmsave/agent/agent.properties.rpmsave +fi + +%pre usage +id cloud > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \ + -r -s /bin/sh -d %{_localstatedir}/cloudstack/management cloud|| true + +%preun usage +/sbin/service cloudstack-usage stop || true +if [ "$1" == "0" ] ; then + /sbin/chkconfig --del cloudstack-usage > /dev/null 2>&1 || true + /sbin/service cloudstack-usage stop > /dev/null 2>&1 || true +fi + +%post usage +if [ -f "%{_sysconfdir}/%{name}/management/db.properties" ]; then + echo Replacing db.properties with management server db.properties + rm -f %{_sysconfdir}/%{name}/usage/db.properties + ln -s %{_sysconfdir}/%{name}/management/db.properties %{_sysconfdir}/%{name}/usage/db.properties + /sbin/chkconfig --add cloudstack-usage > /dev/null 2>&1 || true + /sbin/chkconfig --level 345 cloudstack-usage on > /dev/null 2>&1 || true +fi + +if [ -f "%{_sysconfdir}/%{name}/management/key" ]; then + echo Replacing key with management server key + rm -f %{_sysconfdir}/%{name}/usage/key + ln -s %{_sysconfdir}/%{name}/management/key %{_sysconfdir}/%{name}/usage/key +fi + +#%post awsapi +#if [ -d "%{_datadir}/%{name}-management" ] ; then +# ln -s %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080 +#fi + +#No default permission as the permission setup is complex +%files management +%defattr(-,root,root,-) +%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina +%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina/localhost +%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina/localhost/client +%dir %{_datadir}/%{name}-management +%dir %attr(0770,root,cloud) %{_localstatedir}/%{name}/mnt +%dir %attr(0770,cloud,cloud) %{_localstatedir}/%{name}/management +%dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management +%dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management/work +%dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management/temp +%dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/management +%dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/awsapi +%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-management +%config(noreplace) %{_sysconfdir}/sudoers.d/%{name}-management +%config(noreplace) %{_sysconfdir}/security/limits.d/cloud +%config(noreplace) %attr(0640,root,cloud) %{_sysconfdir}/%{name}/management/db.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/log4j-cloud.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/Catalina/localhost/client/context.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/catalina.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/tomcat-users.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/web.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/server.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/environment.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/java.security.ciphers +%config(noreplace) %{_sysconfdir}/%{name}/management/cloud-bridge.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/commons-logging.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/ec2-service.properties +%attr(0755,root,root) %{_unitdir}/%{name}-management.service +%attr(0755,cloud,cloud) %{_localstatedir}/run/%{name}-management.pid + +%attr(0755,root,root) %{_bindir}/%{name}-setup-management +%attr(0755,root,root) %{_bindir}/%{name}-update-xenserver-licenses +%{_datadir}/%{name}-management/webapps +%{_datadir}/%{name}-management/bin +%{_datadir}/%{name}-management/conf +%{_datadir}/%{name}-management/lib +%{_datadir}/%{name}-management/logs +%{_datadir}/%{name}-management/temp +%{_datadir}/%{name}-management/work +%attr(0755,root,root) %{_bindir}/%{name}-setup-databases +%attr(0755,root,root) %{_bindir}/%{name}-migrate-databases +%attr(0755,root,root) %{_bindir}/%{name}-set-guest-password +%attr(0755,root,root) %{_bindir}/%{name}-set-guest-sshkey +%attr(0755,root,root) %{_bindir}/%{name}-sysvmadm +%attr(0755,root,root) %{_bindir}/%{name}-setup-encryption +%{_datadir}/%{name}-management/setup/*.sql +%{_datadir}/%{name}-management/setup/db/*.sql +%{_datadir}/%{name}-management/setup/*.sh +%{_datadir}/%{name}-management/setup/server-setup.xml +%attr(0755,root,root) %{_bindir}/%{name}-external-ipallocator.py +%attr(0755,root,root) %{_initrddir}/%{name}-ipallocator +%dir %attr(0770,root,root) %{_localstatedir}/log/%{name}/ipallocator +%{_defaultdocdir}/%{name}-management-%{version}/LICENSE +%{_defaultdocdir}/%{name}-management-%{version}/NOTICE +%attr(0644,cloud,cloud) %{_localstatedir}/log/%{name}/management/catalina.out + +%files agent +%attr(0755,root,root) %{_bindir}/%{name}-setup-agent +%attr(0755,root,root) %{_bindir}/%{name}-agent-upgrade +%attr(0755,root,root) %{_bindir}/%{name}-ssh +%attr(0755,root,root) %{_sysconfdir}/init.d/%{name}-agent +%attr(0755,root,root) %{_datadir}/%{name}-common/scripts/network/cisco +%config(noreplace) %{_sysconfdir}/%{name}/agent +%dir %{_localstatedir}/log/%{name}/agent +%attr(0644,root,root) %{_datadir}/%{name}-agent/lib/*.jar +%attr(0755,root,root) %{_datadir}/%{name}-agent/lib/libvirtqemuhook +%dir %{_datadir}/%{name}-agent/plugins +%{_defaultdocdir}/%{name}-agent-%{version}/LICENSE +%{_defaultdocdir}/%{name}-agent-%{version}/NOTICE + +%files common +%dir %attr(0755,root,root) %{python_sitearch}/cloudutils +%dir %attr(0755,root,root) %{_datadir}/%{name}-common/vms +%attr(0755,root,root) %{_datadir}/%{name}-common/scripts +%attr(0755,root,root) /usr/bin/cloudstack-sccs +%attr(0644, root, root) %{_datadir}/%{name}-common/vms/systemvm.iso +%attr(0644, root, root) %{_datadir}/%{name}-common/vms/systemvm.zip +%attr(0644,root,root) %{python_sitearch}/cloud_utils.py +%attr(0644,root,root) %{python_sitearch}/cloud_utils.pyc +%attr(0644,root,root) %{python_sitearch}/cloudutils/* +%attr(0644, root, root) %{_datadir}/%{name}-common/lib/jasypt-1.9.2.jar +%{_defaultdocdir}/%{name}-common-%{version}/LICENSE +%{_defaultdocdir}/%{name}-common-%{version}/NOTICE + +%files usage +%attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name}-usage +%attr(0755,root,root) /usr/sbin/%{name}-usage-sysd +%attr(0644,root,root) %{_unitdir}/%{name}-usage.service +%attr(0644,root,root) %{_datadir}/%{name}-usage/*.jar +%attr(0644,root,root) %{_datadir}/%{name}-usage/lib/*.jar +%dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/usage +%attr(0644,root,root) %{_sysconfdir}/%{name}/usage/db.properties +%attr(0644,root,root) %{_sysconfdir}/%{name}/usage/log4j-cloud.xml +%attr(0644,cloud,cloud) %{_localstatedir}/run/%{name}-usage.pid +%{_defaultdocdir}/%{name}-usage-%{version}/LICENSE +%{_defaultdocdir}/%{name}-usage-%{version}/NOTICE + +%files cli +%attr(0644,root,root) %{python_sitearch}/cloudapis.py +%attr(0644,root,root) %{python_sitearch}/cloudtool/__init__.py +%attr(0644,root,root) %{python_sitearch}/cloudtool/utils.py +%{_defaultdocdir}/%{name}-cli-%{version}/LICENSE +%{_defaultdocdir}/%{name}-cli-%{version}/NOTICE + +%files awsapi +%defattr(0644,cloud,cloud,0755) +%{_datadir}/%{name}-bridge/webapps/awsapi +%attr(0644,root,root) %{_datadir}/%{name}-bridge/setup/* +%attr(0755,root,root) %{_bindir}/cloudstack-aws-api-register +%attr(0755,root,root) %{_bindir}/cloudstack-setup-bridge +%attr(0666,cloud,cloud) %{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/crypto.properties +%attr(0666,cloud,cloud) %{_datadir}/%{name}-bridge/webapps/awsapi/WEB-INF/classes/xes.keystore + +%{_defaultdocdir}/%{name}-awsapi-%{version}/LICENSE +%{_defaultdocdir}/%{name}-awsapi-%{version}/NOTICE + +%if "%{_ossnoss}" == "noredist" +%files mysql-ha +%defattr(0644,cloud,cloud,0755) +%attr(0644,root,root) %{_datadir}/%{name}-mysql-ha/lib/* +%{_defaultdocdir}/%{name}-mysql-ha-%{version}/LICENSE +%{_defaultdocdir}/%{name}-mysql-ha-%{version}/NOTICE +%endif + +%files baremetal-agent +%attr(0755,root,root) %{_bindir}/cloudstack-setup-baremetal + +%changelog +* Wed Nov 19 2014 Hugo Trippaers <h...@apache.org> 4.6.0 +- Create a specific spec for CentOS 7 + +* Fri Jul 4 2014 Hugo Trippaers <h...@apache.org> 4.5.0 +- Add a package for the mysql ha module + +* Fri Oct 5 2012 Hugo Trippaers <h...@apache.org> 4.1.0 +- new style spec file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloudstack-agent.te ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloudstack-agent.te b/packaging/centos7/cloudstack-agent.te new file mode 100644 index 0000000..4259e17 --- /dev/null +++ b/packaging/centos7/cloudstack-agent.te @@ -0,0 +1,33 @@ +# 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. + +module cloudstack-agent 1.0; + +require { + type nfs_t; + type system_conf_t; + type mount_t; + type qemu_t; + class file unlink; + class filesystem getattr; +} + +#============= mount_t ============== +allow mount_t system_conf_t:file unlink; + +#============= qemu_t ============== +allow qemu_t nfs_t:filesystem getattr; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/cloudstack-sccs ---------------------------------------------------------------------- diff --git a/packaging/centos7/cloudstack-sccs b/packaging/centos7/cloudstack-sccs new file mode 100644 index 0000000..e05d372 --- /dev/null +++ b/packaging/centos7/cloudstack-sccs @@ -0,0 +1,20 @@ +#!/bin/sh + +# 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. + +cat /usr/share/cloudstack-common/scripts/gitrev.txt http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/replace.properties ---------------------------------------------------------------------- diff --git a/packaging/centos7/replace.properties b/packaging/centos7/replace.properties new file mode 100644 index 0000000..f99dab8 --- /dev/null +++ b/packaging/centos7/replace.properties @@ -0,0 +1,60 @@ +# 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. + +DBUSER=cloud +DBPW=cloud +DBROOTPW= +MSLOG=vmops.log +APISERVERLOG=api.log +DBHOST=localhost +COMPONENTS-SPEC=components-premium.xml +AWSAPILOG=awsapi.log +REMOTEHOST=localhost +AGENTCLASSPATH= +AGENTLOG=/var/log/cloudstack/agent/agent.log +AGENTLOGDIR=/var/log/cloudstack/agent/ +AGENTSYSCONFDIR=/etc/cloudstack/agent +APISERVERLOG=/var/log/cloudstack/management/apilog.log +AWSAPILOG=/var/log/cloudstack/awsapi/awsapi.log +BINDIR=/usr/bin +COMMONLIBDIR=/usr/share/cloudstack-common +CONFIGUREVARS= +DEPSCLASSPATH= +DOCDIR= +IPALOCATORLOG=/var/log/cloudstack/management/ipallocator.log +JAVADIR=/usr/share/java +LIBEXECDIR=/usr/libexec +LOCKDIR=/var/lock +MSCLASSPATH= +MSCONF=/etc/cloudstack/management +MSENVIRON=/usr/share/cloudstack-management +MSLOG=/var/log/cloudstack/management/management-server.log +MSLOGDIR=/var/log/cloudstack/management/ +MSMNTDIR=/var/cloudstack/mnt +MSUSER=cloud +PIDDIR=/var/run +PLUGINJAVADIR=/usr/share/cloudstack-management/plugin +PREMIUMJAVADIR=/usr/share/cloudstack-management/premium +PYTHONDIR=/usr/lib/python2.7/site-packages/ +SERVERSYSCONFDIR=/etc/sysconfig +SETUPDATADIR=/usr/share/cloudstack-management/setup +SYSCONFDIR=/etc/sysconfig +SYSTEMCLASSPATH= +SYSTEMJARS= +USAGECLASSPATH= +USAGELOG=/var/log/cloudstack/usage/usage.log +USAGESYSCONFDIR=/etc/sysconfig http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/catalina.properties ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/catalina.properties b/packaging/centos7/tomcat7/catalina.properties new file mode 100644 index 0000000..282892b --- /dev/null +++ b/packaging/centos7/tomcat7/catalina.properties @@ -0,0 +1,81 @@ +# 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. + +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageAccess unless the +# corresponding RuntimePermission ("accessClassInPackage."+package) has +# been granted. +package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans. +# +# List of comma-separated packages that start with or equal this string +# will cause a security exception to be thrown when +# passed to checkPackageDefinition unless the +# corresponding RuntimePermission ("defineClassInPackage."+package) has +# been granted. +# +# by default, no packages are restricted for definition, and none of +# the class loaders supplied with the JDK call checkPackageDefinition. +# +package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper. + +# +# +# List of comma-separated paths defining the contents of the "common" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. +# If left as blank,the JVM system loader will be used as Catalina's "common" +# loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/usr/share/java/mysql-connector-java.jar,/usr/share/cloudstack-mysql-ha/lib/*jar + +# +# List of comma-separated paths defining the contents of the "server" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute. +# If left as blank, the "common" loader will be used as Catalina's "server" +# loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +server.loader= + +# +# List of comma-separated paths defining the contents of the "shared" +# classloader. Prefixes should be used to define what is the repository type. +# Path may be relative to the CATALINA_BASE path or absolute. If left as blank, +# the "common" loader will be used as Catalina's "shared" loader. +# Examples: +# "foo": Add this folder as a class repository +# "foo/*.jar": Add all the JARs of the specified folder as class +# repositories +# "foo/bar.jar": Add bar.jar as a class repository +# Please note that for single jars, e.g. bar.jar, you need the URL form +# starting with file:. +shared.loader= + +# +# String cache configuration. +tomcat.util.buf.StringCache.byte.enabled=true +#tomcat.util.buf.StringCache.char.enabled=true +#tomcat.util.buf.StringCache.trainThreshold=500000 +#tomcat.util.buf.StringCache.cacheSize=5000 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/cloud-bridge.properties ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/cloud-bridge.properties b/packaging/centos7/tomcat7/cloud-bridge.properties new file mode 100644 index 0000000..d0820e8 --- /dev/null +++ b/packaging/centos7/tomcat7/cloud-bridge.properties @@ -0,0 +1,25 @@ +# 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. + +host=http://localhost:7080/awsapi +storage.root=/Users/john1/S3-Mount +storage.multipartDir=__multipart__uploads__ +bucket.dns=false +serviceEndpoint=localhost:7080 + + + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/commons-logging.properties ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/commons-logging.properties b/packaging/centos7/tomcat7/commons-logging.properties new file mode 100644 index 0000000..1e570d6 --- /dev/null +++ b/packaging/centos7/tomcat7/commons-logging.properties @@ -0,0 +1,30 @@ +# +# 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. +# + +# This is the logging properties that goes to the war, there are two logging conf kept at the +# svn, one for developement (one at src/test-resources) and other for producation + +# Uncomment the next line to disable all logging. +#org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog + +# Uncomment the next line to enable the simple log based logging +#org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog + +# Uncomment the next line to enable log4j based logging +org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/db.properties ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/db.properties b/packaging/centos7/tomcat7/db.properties new file mode 100644 index 0000000..ad31894 --- /dev/null +++ b/packaging/centos7/tomcat7/db.properties @@ -0,0 +1,107 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +db.usage.maxActive=100 +# distributed with this work for additional information + + +# to you under the Apache License, Version 2.0 (the +# with the License. You may obtain a copy of the License at +# "License"); you may not use this file except in compliance +# http://www.apache.org/licenses/LICENSE-2.0 +# software distributed under the License is distributed on an +# regarding copyright ownership. The ASF licenses this file +# Unless required by applicable law or agreed to in writing, +db.cloud.name=cloud +db.cloud.password=ENC(vlzQjmqOV4s5q7n+S1OMbA==) +# specific language governing permissions and limitations +# KIND, either express or implied. See the License for the + +# + + + +# in which the management server(Tomcat) is running +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# under the License. +# management server clustering parameters, change cluster.node.IP to the machine IP address + +# usage database tuning parameters + +db.usage.maxWait=10000 +db.cloud.port=3306 +# High Availability And Cluster Properties +db.usage.maxIdle=30 +# CloudStack database settings +cluster.node.IP=127.0.0.1 +db.cloud.testOnBorrow=true +db.cloud.maxIdle=30 +db.cloud.autoReconnectForPools=true +db.cloud.trustStore= +region.id=1 +cluster.servlet.port=9090 +db.cloud.host=localhost +db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true +# CloudStack database tuning parameters +db.usage.name=cloud_usage +db.cloud.poolPreparedStatements=false +db.ha.enabled=false +db.cloud.keyStorePassphrase=vmops.com +db.simulator.maxActive=250 +db.cloud.username=cloud +db.usage.port=3306 +db.cloud.maxWait=10000 +db.cloud.timeBetweenEvictionRunsMillis=40000 +db.cloud.keyStorePassword= +# usage database settings +db.cloud.queriesBeforeRetryMaster=5000 +db.cloud.validationQuery=SELECT 1 +db.usage.failOverReadOnly=false +db.cloud.maxActive=250 + +db.cloud.useSSL=false +db.usage.host=localhost +db.cloud.initialTimeout=3600 +# Encryption Settings +db.cloud.minEvictableIdleTimeMillis=240000 +db.cloud.testWhileIdle=true +# CloudStack database SSL settings +db.cloud.slaves=localhost,localhost +db.simulator.maxIdle=30 +db.cloud.keyStore= +db.cloud.encrypt.secret=ENC(zaGuSF5a4KyWayn2t0yyjDa0HjdToVtZ) +db.cloud.encryption.type=file +db.cloud.failOverReadOnly=false + +db.simulator.port=3306 +db.awsapi.host=localhost +db.usage.password=ENC(cQEcN5aVucSYK+WUkPjDcw==) +db.usage.username=cloud +db.cloud.trustStorePassword= +db.awsapi.password=cloud +db.simulator.username=cloud +db.usage.url.params= +db.usage.initialTimeout=3600 + +# Simulator database settings +db.cloud.reconnectAtTxEnd=true +db.usage.autoReconnect=true +#usage Database +db.simulator.maxWait=10000 +# cloud stack Database +db.simulator.password=cloud +db.awsapi.username=cloud +db.usage.reconnectAtTxEnd=true +db.simulator.autoReconnect=true + +# awsapi database settings +db.awsapi.port=3306 +db.ha.loadBalanceStrategy=com.cloud.utils.db.StaticStrategy +db.awsapi.name=cloudbridge +db.cloud.autoReconnect=true +db.simulator.host=localhost +db.simulator.name=simulator +db.usage.queriesBeforeRetryMaster=5000 +db.usage.slaves=localhost,localhost +db.usage.secondsBeforeRetryMaster=3600 +db.usage.autoReconnectForPools=true +db.cloud.secondsBeforeRetryMaster=3600 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/ec2-service.properties ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/ec2-service.properties b/packaging/centos7/tomcat7/ec2-service.properties new file mode 100644 index 0000000..82f5ad8 --- /dev/null +++ b/packaging/centos7/tomcat7/ec2-service.properties @@ -0,0 +1,25 @@ +# 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. + +managementServer=127.0.0.1 +cloudAPIPort=8080 +cloudstackVersion=2.2.0 +WSDLVersion=2012-08-15 +keystore=xes.keystore +keystorePass=apache + + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/environment.properties ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/environment.properties b/packaging/centos7/tomcat7/environment.properties new file mode 100644 index 0000000..3254cf6 --- /dev/null +++ b/packaging/centos7/tomcat7/environment.properties @@ -0,0 +1,22 @@ +# 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. + +# management server compile-time environment parameters + +paths.script=/usr/share/cloudstack-common +mount.parent=/var/cloudstack/mnt +cloud-stack-components-specification=components.xml http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/java.security.ciphers ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/java.security.ciphers b/packaging/centos7/tomcat7/java.security.ciphers new file mode 100644 index 0000000..986abf6 --- /dev/null +++ b/packaging/centos7/tomcat7/java.security.ciphers @@ -0,0 +1,18 @@ + # 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. + +jdk.tls.disabledAlgorithms=DH keySize < 128, RSA keySize < 128, DES keySize < 128, SHA1 keySize < 128, MD5 keySize < 128, RC4 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/log4j-cloud.xml ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/log4j-cloud.xml b/packaging/centos7/tomcat7/log4j-cloud.xml new file mode 100644 index 0000000..ef7904c --- /dev/null +++ b/packaging/centos7/tomcat7/log4j-cloud.xml @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> + <throwableRenderer class="com.cloud.utils.log.CglibThrowableRenderer"/> + + <!-- ================================= --> + <!-- Preserve messages in a local file --> + <!-- ================================= --> + + <!-- A regular appender FIXME implement code that will close/reopen logs on SIGHUP by logrotate FIXME make the paths configurable using the build system --> + <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender"> + <param name="Append" value="true"/> + <param name="Threshold" value="TRACE"/> + <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> + <param name="FileNamePattern" value="/var/log/cloudstack/management/management-server.log.%d{yyyy-MM-dd}.gz"/> + <param name="ActiveFileName" value="/var/log/cloudstack/management/management-server.log"/> + </rollingPolicy> + <layout class="org.apache.log4j.EnhancedPatternLayout"> + <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1.}] (%t:%x) %m%n"/> + </layout> + </appender> + + <appender name="APISERVER" class="org.apache.log4j.rolling.RollingFileAppender"> + <param name="Append" value="true"/> + <param name="Threshold" value="DEBUG"/> + <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> + <param name="FileNamePattern" value="/var/log/cloudstack/management/apilog.log.%d{yyyy-MM-dd}.gz"/> + <param name="ActiveFileName" value="/var/log/cloudstack/management/apilog.log"/> + </rollingPolicy> + <layout class="org.apache.log4j.EnhancedPatternLayout"> + <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1.}] (%t:%x) %m%n"/> + </layout> + </appender> + + <appender name="AWSAPI" class="org.apache.log4j.rolling.RollingFileAppender"> + <param name="Append" value="true"/> + <param name="Threshold" value="DEBUG"/> + <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"> + <param name="FileNamePattern" value="/var/log/cloudstack/awsapi/awsapi.log.%d{yyyy-MM-dd}.gz"/> + <param name="ActiveFileName" value="/var/log/cloudstack/awsapi/awsapi.log"/> + </rollingPolicy> + <layout class="org.apache.log4j.EnhancedPatternLayout"> + <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1.}] (%t:%x) %m%n"/> + </layout> + </appender> + <!-- ============================== --> + <!-- Append warnings+ to the syslog if it is listening on UDP port FIXME make sysloghost configurable! --> + <!-- ============================== --> + + <appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender"> + <param name="Threshold" value="WARN"/> + <param name="SyslogHost" value="localhost"/> + <param name="Facility" value="LOCAL6"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%-5p [%c{3}] (%t:%x) %m%n"/> + </layout> + </appender> + + <!-- ============================== --> + <!-- Append alerts to the syslog if it is configured --> + <!-- ============================== --> + + <appender name="ALERTSYSLOG" class="org.apache.cloudstack.syslog.AlertsSyslogAppender"> + <param name="Threshold" value="WARN"/> + <param name="SyslogHosts" value=""/> + <param name="Facility" value="LOCAL6"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%-5p [%c{3}] (%t:%x) %m%n"/> + </layout> + </appender> + + <!-- ============================== --> + <!-- send alert warnings+ as the SNMP trap if it is configured! --> + <!-- ============================== --> + + <appender name="SNMP" class="org.apache.cloudstack.alert.snmp.SnmpTrapAppender"> + <param name="Threshold" value="WARN"/> + <param name="SnmpManagerIpAddresses" value=""/> + <param name="SnmpManagerPorts" value=""/> + <param name="SnmpManagerCommunities" value=""/> + <layout class="org.apache.cloudstack.alert.snmp.SnmpEnhancedPatternLayout"> + <param name="PairDelimiter" value="//"/> + <param name="KeyValueDelimiter" value="::"/> + </layout> + </appender> + + <!-- ============================== --> + <!-- Append messages to the console --> + <!-- ============================== --> + + <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> + <param name="Target" value="System.out"/> + <param name="Threshold" value="INFO"/> + <layout class="org.apache.log4j.EnhancedPatternLayout"> + <param name="ConversionPattern" value="%-5p [%c{1.}] (%t:%x) %m%n"/> + </layout> + </appender> + + <!-- ================ --> + <!-- Limit categories --> + <!-- ================ --> + + <category name="com.cloud"> + <priority value="DEBUG"/> + </category> + + <category name="org.apache.cloudstack"> + <priority value="DEBUG"/> + </category> + + <category name="org.apache.cloudstack"> + <priority value="DEBUG"/> + </category> + + <category name="com.cloud.utils.nio"> + <priority value="INFO"/> + </category> + + <!-- Limit the org.apache category to INFO as its DEBUG is verbose --> + <category name="org.apache"> + <priority value="INFO"/> + </category> + + <category name="org.apache.cloudstack"> + <priority value="DEBUG"/> + </category> + + <category name="org.apache.cloudstack.api.command"> + <priority value="TRACE"/> + </category> + + <category name="org"> + <priority value="INFO"/> + </category> + + <category name="org.springframework"> + <priority value="WARN"/> + </category> + + <category name="org.apache.cloudstack.spring.module.context.ResourceApplicationContext"> + <priority value="WARN"/> + </category> + + <category name="net"> + <priority value="INFO"/> + </category> + + <category name="apiserver.com.cloud"> + <priority value="DEBUG"/> + </category> + + <logger name="apiserver.com.cloud" additivity="false"> + <level value="DEBUG"/> + <appender-ref ref="APISERVER"/> + </logger> + + + <logger name="com.cloud.bridge" additivity="false"> + <level value="DEBUG"/> + <appender-ref ref="AWSAPI"/> + </logger> + + <logger name="com.cloud.stack" additivity="false"> + <level value="DEBUG"/> + <appender-ref ref="AWSAPI"/> + </logger> + + + <logger name="org.apache.axis2" additivity="false"> + <level value="INFO"/> + <appender-ref ref="AWSAPI"/> + </logger> + + <!-- ============================== --> + <!-- Add or remove these logger for SNMP, this logger is for SNMP alerts plugin --> + <!-- ============================== --> + + <logger name="org.apache.cloudstack.alerts" additivity="false"> + <level value="WARN"/> + <appender-ref ref="SYSLOG"/> + <appender-ref ref="CONSOLE"/> + <appender-ref ref="FILE"/> + <appender-ref ref="SNMP"/> + <appender-ref ref="ALERTSYSLOG"/> + </logger> + + <!-- ======================= --> + <!-- Setup the Root category --> + <!-- ======================= --> + + <root> + <level value="INFO"/> + <appender-ref ref="SYSLOG"/> + <appender-ref ref="CONSOLE"/> + <appender-ref ref="FILE"/> + </root> + +</log4j:configuration> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/server.xml ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/server.xml b/packaging/centos7/tomcat7/server.xml new file mode 100644 index 0000000..6a3c974 --- /dev/null +++ b/packaging/centos7/tomcat7/server.xml @@ -0,0 +1,112 @@ +<?xml version='1.0' encoding='utf-8'?> +<!-- + 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. +--> +<!-- Note: A "Server" is not itself a "Container", so you may not + define subcomponents such as "Valves" at this level. + Documentation at /docs/config/server.html + --> +<Server port="8005" shutdown="SHUTDOWN"> + <!-- Security listener. Documentation at /docs/config/listeners.html + <Listener className="org.apache.catalina.security.SecurityListener" /> + --> + <!--APR library loader. Documentation at /docs/apr.html --> + <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> + <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> + <Listener className="org.apache.catalina.core.JasperListener" /> + <!-- Prevent memory leaks due to use of particular java/javax APIs--> + <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> + <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> + <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> + + <!-- Global JNDI resources + Documentation at /docs/jndi-resources-howto.html + --> + <GlobalNamingResources> + <!-- Editable user database that can also be used by + UserDatabaseRealm to authenticate users + --> + <Resource name="UserDatabase" auth="Container" + type="org.apache.catalina.UserDatabase" + description="User database that can be updated and saved" + factory="org.apache.catalina.users.MemoryUserDatabaseFactory" + pathname="conf/tomcat-users.xml" /> + </GlobalNamingResources> + + <Service name="CloudStackManagement"> + + <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" + maxThreads="150" minSpareThreads="25"/> + + <Connector executor="tomcatThreadPool" + port="8080" protocol="HTTP/1.1" + connectionTimeout="20000" + acceptCount="150" + enableLookups="false" + maxThreads="150" + maxHttpHeaderSize="8192" + redirectPort="8443" /> + + <Engine name="Catalina" defaultHost="localhost"> + + <Realm className="org.apache.catalina.realm.LockOutRealm"> + <Realm className="org.apache.catalina.realm.UserDatabaseRealm" + resourceName="UserDatabase"/> + </Realm> + + <Host name="localhost" appBase="webapps" + unpackWARs="true" autoDeploy="true"> + + <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" + prefix="localhost_access_log." suffix=".txt" + pattern="%h %l %u %t "%r" %s %b" /> + + </Host> + </Engine> + </Service> + + <Service name="CloudStackAwsApi"> + + <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" + maxThreads="150" minSpareThreads="25"/> + + <Connector executor="tomcatThreadPool" + port="7080" protocol="HTTP/1.1" + connectionTimeout="20000" + acceptCount="150" + enableLookups="false" + maxThreads="150" + maxHttpHeaderSize="8192" + redirectPort="8443" /> + + <Engine name="Catalina7080" defaultHost="localhost"> + + <Realm className="org.apache.catalina.realm.LockOutRealm"> + <Realm className="org.apache.catalina.realm.UserDatabaseRealm" + resourceName="UserDatabase"/> + </Realm> + + <Host name="localhost" appBase="webapps7080" + unpackWARs="true" autoDeploy="true"> + + <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" + prefix="localhost_7080_access_log." suffix=".txt" + pattern="%h %l %u %t "%r" %s %b" /> + + </Host> + </Engine> + </Service> +</Server> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b527aabf/packaging/centos7/tomcat7/tomcat-users.xml ---------------------------------------------------------------------- diff --git a/packaging/centos7/tomcat7/tomcat-users.xml b/packaging/centos7/tomcat7/tomcat-users.xml new file mode 100644 index 0000000..81422a0 --- /dev/null +++ b/packaging/centos7/tomcat7/tomcat-users.xml @@ -0,0 +1,31 @@ +<?xml version='1.0' encoding='utf-8'?> +<!-- + 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. +--> +<tomcat-users> +<!-- + <role rolename="tomcat"/> + <role rolename="role1"/> + <user username="tomcat" password="tomcat" roles="tomcat"/> + <user username="both" password="tomcat" roles="tomcat,role1"/> + <user username="role1" password="tomcat" roles="role1"/> +--> + +<!-- The host manager webapp is restricted to users with role "admin" --> +<!--<user name="tomcat" password="password" roles="admin" />--> +<!-- The manager webapp is restricted to users with role "manager" --> +<!--<user name="tomcat" password="password" roles="manager" />--> +</tomcat-users>