You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ka...@apache.org on 2017/10/30 17:53:46 UTC
mesos git commit: Binary packaging for Centos.
Repository: mesos
Updated Branches:
refs/heads/master 8687b928f -> ff01d0c44
Binary packaging for Centos.
Review: https://reviews.apache.org/r/62616
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ff01d0c4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ff01d0c4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ff01d0c4
Branch: refs/heads/master
Commit: ff01d0c44251e2ffaa2f4f47b33c790594d194d9
Parents: 8687b92
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Thu Sep 21 16:07:13 2017 -0400
Committer: Kapil Arya <ka...@mesosphere.io>
Committed: Mon Oct 30 13:49:43 2017 -0400
----------------------------------------------------------------------
support/packaging/Jenkinsfile | 52 ++++++
support/packaging/centos/build_rpm.sh | 49 ++++++
support/packaging/centos/centos6.dockerfile | 38 +++++
support/packaging/centos/centos7.dockerfile | 35 ++++
support/packaging/centos/mesos.spec | 189 +++++++++++++++++++++
support/packaging/common/mesos | 2 +
support/packaging/common/mesos-init-wrapper | 177 +++++++++++++++++++
support/packaging/common/mesos-master | 2 +
support/packaging/common/mesos-master.service | 13 ++
support/packaging/common/mesos-master.upstart | 10 ++
support/packaging/common/mesos-slave | 1 +
support/packaging/common/mesos-slave.service | 16 ++
support/packaging/common/mesos-slave.upstart | 10 ++
13 files changed, 594 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/Jenkinsfile
----------------------------------------------------------------------
diff --git a/support/packaging/Jenkinsfile b/support/packaging/Jenkinsfile
new file mode 100644
index 0000000..abfd59d
--- /dev/null
+++ b/support/packaging/Jenkinsfile
@@ -0,0 +1,52 @@
+def dockerArgs() {
+ def workspace_dir = pwd()
+ sh "mkdir -p ${workspace_dir}/.m2"
+
+ def args = "-e MESOS_TAG=${params.MESOS_TAG}"
+ args = "${args} -e MESOS_RELEASE=${params.MESOS_RELEASE}"
+ args = "${args} -v=/etc/passwd:/etc/passwd"
+ args = "${args} -v=/etc/group:/etc/group"
+ args = "${args} -v=${workspace_dir}/.m2:$HOME/.m2:rw,z"
+ return args
+}
+
+parallel(centos7: {
+ node {
+ checkout scm
+
+ def img
+ if (params.REBUILD_DOCKER_IMAGE == "true") {
+ img = docker.build("mesos/packaging:centos7",
+ "-f support/packaging/centos/centos7.dockerfile support/packaging/centos")
+ } else {
+ img = docker.image("mesos/packaging:centos7")
+ }
+
+ img.inside(dockerArgs()) {
+ sh 'hostname && hostname && cat /etc/*rel* || true'
+ sh 'support/packaging/centos/build_rpm.sh'
+ }
+
+ archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
+ }
+},
+centos6: {
+ node {
+ checkout scm
+
+ def img
+ if (params.REBUILD_DOCKER_IMAGE == "true") {
+ img = docker.build("mesos/packaging:centos6",
+ "-f support/packaging/centos/centos6.dockerfile support/packaging/centos")
+ } else {
+ img = docker.image("mesos/packaging:centos6")
+ }
+
+ img.inside(dockerArgs()) {
+ sh 'hostname && hostname && cat /etc/*rel* || true'
+ sh 'support/packaging/centos/build_rpm.sh'
+ }
+
+ archiveArtifacts artifacts: '**/*.rpm', fingerprint: true
+ }
+})
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/centos/build_rpm.sh
----------------------------------------------------------------------
diff --git a/support/packaging/centos/build_rpm.sh b/support/packaging/centos/build_rpm.sh
new file mode 100755
index 0000000..3a7a347
--- /dev/null
+++ b/support/packaging/centos/build_rpm.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+CENTOS_VERSION=$(rpm --eval '%{centos_ver}')
+MESOS_VERSION=${MESOS_TAG%[-]*}
+MESOS_RELEASE=${MESOS_RELEASE:-1}
+
+export HOME="${PWD}/centos${CENTOS_VERSION}"
+mkdir -p $HOME/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
+
+PACKAGING_DIR=$(readlink -e "$(dirname "$(dirname "$0")")")
+MESOS_DIR=$(readlink -e $PACKAGING_DIR/../../)
+cp ${PACKAGING_DIR}/common/* $HOME/rpmbuild/SOURCES
+cp ${PACKAGING_DIR}/centos/mesos.spec $HOME/rpmbuild/SPECS
+
+if [ "$CENTOS_VERSION" = "6" ]; then
+ source scl_source enable devtoolset-3
+fi
+
+if [ -z "$MESOS_TAG" ]; then
+ gitsha=$(git rev-parse --short HEAD)
+ snapshot_version=$(date -u +'%Y%m%d')git$gitsha
+ MESOS_RELEASE=0.1.pre.$snapshot_version
+
+ pushd $MESOS_DIR
+ ./bootstrap
+ popd
+
+ TMP_BUILD_DIR=`mktemp -d ./mesos-centos-rpm-build-XXXX`
+ pushd $TMP_BUILD_DIR
+ $MESOS_DIR/configure && make dist
+ MESOS_VERSION=$($MESOS_DIR/configure --version|head -1|cut -d' ' -f3)
+ popd
+
+ cp -f $TMP_BUILD_DIR/mesos-$MESOS_VERSION.tar.gz $HOME/rpmbuild/SOURCES/
+ rm -rf $TMP_BUILD_DIR
+elif [ "$MESOS_VERSION" = "$MESOS_TAG" ]; then
+ curl -sSL \
+ https://dist.apache.org/repos/dist/release/mesos/${MESOS_VERSION}/mesos-${MESOS_VERSION}.tar.gz \
+ -o $HOME/rpmbuild/SOURCES/mesos-${MESOS_VERSION}.tar.gz
+else
+ curl -sSL \
+ https://dist.apache.org/repos/dist/dev/mesos/${MESOS_TAG}/mesos-${MESOS_VERSION}.tar.gz \
+ -o $HOME/rpmbuild/SOURCES/mesos-${MESOS_VERSION}.tar.gz
+fi
+
+rpmbuild \
+ --define "MESOS_VERSION $MESOS_VERSION" \
+ --define "MESOS_RELEASE $MESOS_RELEASE" \
+ -ba $HOME/rpmbuild/SPECS/mesos.spec
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/centos/centos6.dockerfile
----------------------------------------------------------------------
diff --git a/support/packaging/centos/centos6.dockerfile b/support/packaging/centos/centos6.dockerfile
new file mode 100644
index 0000000..ec13b24
--- /dev/null
+++ b/support/packaging/centos/centos6.dockerfile
@@ -0,0 +1,38 @@
+FROM centos:6
+MAINTAINER Kapil Arya <ka...@apache.org>
+
+# Get curl.
+RUN yum install -y \
+ centos-release-scl \
+ epel-release \
+ git \
+ redhat-rpm-config \
+ rpm-build \
+ scl-utils \
+ yum-utils
+
+# Add the Subversion repo.
+RUN echo -e '[WANdiscoSVN]\n\
+name=WANdisco SVN Repo 1.9\n\
+enabled=1\n\
+baseurl=http://opensource.wandisco.com/centos/6/svn-1.9/RPMS/\$basearch/\n\
+gpgcheck=1\n\
+gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco' \
+>> /etc/yum.repos.d/wandisco-svn.repo
+
+# Add the Apache Maven repo.
+RUN curl -sSL \
+ http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo \
+ -o /etc/yum.repos.d/epel-apache-maven.repo
+
+# PostgreSQL repo for libevent2.
+RUN rpm -Uvh --replacepkgs \
+ http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-centos95-9.5-2.noarch.rpm
+
+# Setup JDK
+RUN echo -e 'export JAVA_HOME=/usr/lib/jvm/java-openjdk' >> /etc/profile.d/java-home.sh
+
+ADD mesos.spec /mesos.spec
+
+RUN yum makecache && \
+ yum-builddep -y /mesos.spec
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/centos/centos7.dockerfile
----------------------------------------------------------------------
diff --git a/support/packaging/centos/centos7.dockerfile b/support/packaging/centos/centos7.dockerfile
new file mode 100644
index 0000000..95b4d28
--- /dev/null
+++ b/support/packaging/centos/centos7.dockerfile
@@ -0,0 +1,35 @@
+FROM centos:7
+MAINTAINER Kapil Arya <ka...@apache.org>
+
+# Get curl.
+RUN yum install -y \
+ curl \
+ epel-release \
+ git \
+ redhat-rpm-config \
+ rpm-build
+
+# Add the Subversion repo.
+RUN echo -e '[WANdiscoSVN]\n\
+name=WANdisco SVN Repo 1.9\n\
+enabled=1\n\
+baseurl=http://opensource.wandisco.com/centos/7/svn-1.9/RPMS/\$basearch/\n\
+gpgcheck=1\n\
+gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco' \
+>> /etc/yum.repos.d/wandisco-svn.repo
+
+# Add the Apache Maven repo.
+RUN curl -sSL \
+ http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo \
+ -o /etc/yum.repos.d/epel-apache-maven.repo
+
+# Setup JDK
+RUN echo -e 'export JAVA_HOME=/usr/lib/jvm/java-openjdk' >> /etc/profile.d/java-home.sh
+
+# Remove 'centos' from the rpm version string.
+RUN sed -i -e's:.el7.centos:.el7:' /etc/rpm/macros.dist
+
+ADD mesos.spec /mesos.spec
+
+RUN yum makecache && \
+ yum-builddep -y /mesos.spec
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/centos/mesos.spec
----------------------------------------------------------------------
diff --git a/support/packaging/centos/mesos.spec b/support/packaging/centos/mesos.spec
new file mode 100644
index 0000000..561c75f
--- /dev/null
+++ b/support/packaging/centos/mesos.spec
@@ -0,0 +1,189 @@
+%global MESOS_VERSION
+%global MESOS_RELEASE
+
+Name: mesos
+Version: %{MESOS_VERSION}
+Release: %{MESOS_RELEASE}%{?dist}
+Summary: Cluster manager for sharing distributed application frameworks
+License: ASL 2.0
+URL: http://mesos.apache.org/
+
+ExclusiveArch: x86_64
+
+Source0: %{name}-%{version}.tar.gz
+Source1: mesos-init-wrapper
+Source2: %{name}
+Source3: %{name}-master
+Source4: %{name}-slave
+
+%if 0%{?el6}
+Source5: %{name}-master.upstart
+Source6: %{name}-slave.upstart
+%endif
+
+%if 0%{?el7}
+Source5: %{name}-master.service
+Source6: %{name}-slave.service
+%endif
+
+
+BuildRequires: apache-maven
+BuildRequires: libtool
+BuildRequires: automake
+BuildRequires: autoconf
+BuildRequires: make
+BuildRequires: python-devel
+BuildRequires: java-1.8.0-openjdk-devel
+BuildRequires: libnl3-devel
+BuildRequires: zlib-devel
+BuildRequires: libcurl-devel
+BuildRequires: openssl-devel
+BuildRequires: cyrus-sasl-devel
+BuildRequires: cyrus-sasl-md5
+BuildRequires: elfutils-libelf-devel
+BuildRequires: libblkid-devel
+BuildRequires: kernel-headers
+BuildRequires: subversion-devel >= 1.9
+BuildRequires: subversion-devel < 2.0
+BuildRequires: patch
+
+%if 0%{?el6}
+BuildRequires: devtoolset-3-gcc
+BuildRequires: devtoolset-3-gcc-c++
+BuildRequires: epel-rpm-macros
+BuildRequires: libevent2-devel
+%define _with_xfs no
+%else
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: libevent-devel
+BuildRequires: which
+BuildRequires: xfsprogs-devel
+%define _with_xfs yes
+%endif
+
+BuildRequires: apr-devel
+BuildRequires: apr-util-devel
+
+Requires: cyrus-sasl-md5
+%{?el7:Requires: systemd}
+
+Requires: ntp
+
+%description
+Apache Mesos is a cluster manager that provides efficient resource
+isolation and sharing across distributed applications, or frameworks.
+It can run Hadoop, MPI, Hypertable, Spark, and other applications on
+a dynamically shared pool of nodes.
+
+%package -n mesos-devel
+Summary: Mesos developer package
+Group: Development/Libraries
+Requires: mesos%{?_isa} = %{version}-%{release}
+
+%description -n mesos-devel
+This package provides files for developing Mesos frameworks/modules.
+
+%prep
+%setup -q
+
+%build
+%configure \
+ --enable-optimize \
+ --disable-python-dependency-install \
+ --enable-install-module-dependencies \
+ --enable-libevent \
+ --enable-ssl \
+ --enable-hardening \
+ --enable-xfs-disk-isolator=%{_with_xfs}
+
+%make_build %{?_smp_mflags} V=0
+
+%check
+
+%install
+%make_install
+
+mkdir -p -m0755 %{buildroot}%{_sysconfdir}/default
+mkdir -p -m0755 %{buildroot}%{_sysconfdir}/%{name}
+mkdir -p -m0755 %{buildroot}%{_sysconfdir}/%{name}-master
+mkdir -p -m0755 %{buildroot}%{_sysconfdir}/%{name}-slave
+mkdir -p -m0755 %{buildroot}/%{_var}/log/%{name}
+mkdir -p -m0755 %{buildroot}/%{_var}/lib/%{name}
+
+echo zk://localhost:2181/mesos > %{buildroot}%{_sysconfdir}/mesos/zk
+echo %{_var}/log/%{name} > %{buildroot}%{_sysconfdir}/mesos-master/work_dir
+echo %{_var}/log/%{name} > %{buildroot}%{_sysconfdir}/mesos-slave/work_dir
+echo 1 > %{buildroot}%{_sysconfdir}/mesos-master/quorum
+
+install -m 0644 %{SOURCE1} %{buildroot}%{_bindir}/
+install -m 0644 %{SOURCE2} %{SOURCE3} %{SOURCE4} %{buildroot}%{_sysconfdir}/default
+
+%if 0%{?el6}
+mkdir -p -m0755 %{buildroot}%{_sysconfdir}/init
+install -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/init/mesos-master.conf
+install -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/init/mesos-slave.conf
+%endif
+
+%if 0%{?el7}
+mkdir -p -m0755 %{buildroot}%{_unitdir}/
+install -m 0644 %{SOURCE5} %{SOURCE6} %{buildroot}%{_unitdir}
+%endif
+
+mkdir -p -m0755 %{buildroot}%{_datadir}/java
+install -m 0644 src/java/target/mesos-*.jar %{buildroot}%{_datadir}/java/
+
+
+%files
+%doc LICENSE NOTICE
+%{_libdir}/*.so
+%{_libdir}/mesos/modules/*.so
+%{_bindir}/mesos*
+%{_sbindir}/mesos-*
+%{_datadir}/%{name}/
+%{_libexecdir}/%{name}/
+%{python_sitelib}/%{name}*
+%attr(0755,mesos,mesos) %{_var}/log/%{name}/
+%attr(0755,mesos,mesos) %{_var}/lib/%{name}/
+%config(noreplace) %{_sysconfdir}/%{name}*
+%config(noreplace) %{_sysconfdir}/default/%{name}*
+
+%if 0%{?el6}
+%config(noreplace) %{_sysconfdir}/init/%{name}-*
+%endif
+
+%if 0%{?el7}
+%{_unitdir}/%{name}*.service
+%endif
+
+%{_datadir}/java/%{name}-*.jar
+
+######################
+%files devel
+%doc LICENSE NOTICE
+%{_includedir}/mesos/
+%{_includedir}/stout/
+%{_includedir}/process/
+%{_includedir}/elfio/
+%{_includedir}/picojson.h
+%{_libdir}/pkgconfig/%{name}.pc
+%{_libdir}/*.la
+%{_libdir}/mesos/modules/*.la
+%{_libdir}/mesos/3rdparty/
+
+%pre
+
+%post
+/sbin/ldconfig
+%if 0%{?el7}
+%systemd_post %{name}-slave.service %{name}-master.service
+%endif
+
+%preun
+
+%postun
+/sbin/ldconfig
+
+%changelog
+* Mon Jan 16 2017 Kapil Arya <ka...@mesosphere.io> - 1.1.0-0.1
+- Initial release
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos b/support/packaging/common/mesos
new file mode 100644
index 0000000..2deb46e
--- /dev/null
+++ b/support/packaging/common/mesos
@@ -0,0 +1,2 @@
+LOGS=/var/log/mesos
+ULIMIT="-n 16384"
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos-init-wrapper
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos-init-wrapper b/support/packaging/common/mesos-init-wrapper
new file mode 100755
index 0000000..1ec1921
--- /dev/null
+++ b/support/packaging/common/mesos-init-wrapper
@@ -0,0 +1,177 @@
+#!/bin/bash
+set -o errexit -o nounset -o pipefail
+function -h {
+cat <<USAGE
+ USAGE: mesos-init-wrapper (master|agent)
+
+ Run Mesos in master or agent mode, loading environment files, setting up
+ logging and loading config parameters as appropriate.
+
+ To configure Mesos, you have many options:
+
+ * Set a Zookeeper URL in
+
+ /etc/mesos/zk
+
+ and it will be picked up by the agent and master.
+
+ * You can set environment variables (including the MESOS_* variables) in
+ files under /etc/default/:
+
+ /etc/default/mesos # For both agent and master.
+ /etc/default/mesos-master # For the master only.
+ /etc/default/mesos-agent # For the agent only.
+
+ * To set command line options for the agent or master, you can create files
+ under certain directories:
+
+ /etc/mesos-agent # For the agent only.
+ /etc/mesos-master # For the master only.
+
+ For example, to set the port for the agent:
+
+ echo 5050 > /etc/mesos-agent/port
+
+ To set the switch user flag:
+
+ touch /etc/mesos-agent/?switch_user
+
+ To explicitly disable it:
+
+ touch /etc/mesos-agent/?no-switch_user
+
+ Adding attributes and resources to the agents is slightly more granular.
+ Although you can pass them all at once with files called 'attributes' and
+ 'resources', you can also set them by creating files under directories
+ labeled 'attributes' or 'resources':
+
+ echo north-west > /etc/mesos-agent/attributes/rack
+
+ This is intended to allow easy addition and removal of attributes and
+ resources from the agent configuration.
+
+USAGE
+}; function --help { -h ;} # A nice way to handle -h and --help
+export LC_ALL=en_US.UTF-8 # A locale that works consistently
+
+function main {
+ err "Please use \`master' or \`agent'."
+}
+
+function agent {
+ local etc_agent=/etc/mesos-agent
+ local args=()
+ local attributes=()
+ local resources=()
+ # Call mesosphere-dnsconfig if present on the system to generate config files.
+ [ -x /usr/bin/mesosphere-dnsconfig ] && mesosphere-dnsconfig -write -service=mesos-agent
+ set -o allexport
+ [[ ! -f /etc/default/mesos ]] || . /etc/default/mesos
+ [[ ! -f /etc/default/mesos-agent ]] || . /etc/default/mesos-agent
+ set +o allexport
+ [[ ! ${ULIMIT:-} ]] || ulimit $ULIMIT
+ [[ ! ${MASTER:-} ]] || args+=( --master="$MASTER" )
+ [[ ! ${IP:-} ]] || args+=( --ip="$IP" )
+ [[ ! ${LOGS:-} ]] || args+=( --log_dir="$LOGS" )
+ [[ ! ${ISOLATION:-} ]] || args+=( --isolation="$ISOLATION" )
+ for f in "$etc_agent"/* # attributes ip resources isolation &al.
+ do
+ if [[ -f $f ]]
+ then
+ local name="$(basename "$f")"
+ if [[ $name == '?'* ]] # Recognize flags (options without values)
+ then args+=( --"${name#'?'}" )
+ else args+=( --"$name"="$(cat "$f")" )
+ fi
+ fi
+ done
+ # We allow the great multitude of attributes and resources to be specified
+ # in directories, where the filename is the key and the contents its value.
+ for f in "$etc_agent"/attributes/*
+ do [[ ! -s $f ]] || attributes+=( "$(basename "$f")":"$(cat "$f")" )
+ done
+ if [[ ${#attributes[@]} -gt 0 ]]
+ then
+ local formatted="$(printf ';%s' "${attributes[@]}")"
+ args+=( --attributes="${formatted:1}" ) # NB: Leading ';' is clipped
+ fi
+ for f in "$etc_agent"/resources/*
+ do [[ ! -s $f ]] || resources+=( "$(basename "$f")":"$(cat "$f")" )
+ done
+ if [[ ${#resources[@]} -gt 0 ]]
+ then
+ local formatted="$(printf ';%s' "${resources[@]}")"
+ args+=( --resources="${formatted:1}" ) # NB: Leading ';' is clipped
+ fi
+
+ if [[ "${args[@]:-}" == *'--no-logger'* ]]
+ then
+ local clean_args=()
+ for i in "${args[@]}"; do
+ if [[ "${i}" != "--no-logger" ]]; then
+ clean_args+=( "${i}" )
+ fi
+ done
+ exec /usr/sbin/mesos-agent "${clean_args[@]}"
+ else
+ logged /usr/sbin/mesos-agent "${args[@]:-}"
+ fi
+}
+
+function master {
+ local etc_master=/etc/mesos-master
+ local args=()
+ # Call mesosphere-dnsconfig if present on the system to generate config files.
+ [ -x /usr/bin/mesosphere-dnsconfig ] && mesosphere-dnsconfig -write -service=mesos-master
+ set -o allexport
+ [[ ! -f /etc/default/mesos ]] || . /etc/default/mesos
+ [[ ! -f /etc/default/mesos-master ]] || . /etc/default/mesos-master
+ set +o allexport
+ [[ ! ${ULIMIT:-} ]] || ulimit $ULIMIT
+ [[ ! ${ZK:-} ]] || args+=( --zk="$ZK" )
+ [[ ! ${IP:-} ]] || args+=( --ip="$IP" )
+ [[ ! ${PORT:-} ]] || args+=( --port="$PORT" )
+ [[ ! ${CLUSTER:-} ]] || args+=( --cluster="$CLUSTER" )
+ [[ ! ${LOGS:-} ]] || args+=( --log_dir="$LOGS" )
+ for f in "$etc_master"/* # cluster log_dir port &al.
+ do
+ if [[ -f $f ]]
+ then
+ local name="$(basename "$f")"
+ if [[ $name == '?'* ]] # Recognize flags (options without values)
+ then args+=( --"${name#'?'}" )
+ else args+=( --"$name"="$(cat "$f")" )
+ fi
+ fi
+ done
+
+ if [[ "${args[@]:-}" == *'--no-logger'* ]]
+ then
+ local clean_args=()
+ for i in "${args[@]}"; do
+ if [[ "${i}" != "--no-logger" ]]; then
+ clean_args+=( "${i}" )
+ fi
+ done
+ exec /usr/sbin/mesos-master "${clean_args[@]}"
+ else
+ logged /usr/sbin/mesos-master "${args[@]:-}"
+ fi
+}
+
+# Send all output to syslog and tag with PID and executable basename.
+function logged {
+ local tag="${1##*/}[$$]"
+ exec 1> >(exec logger -p user.info -t "$tag")
+ exec 2> >(exec logger -p user.err -t "$tag")
+ exec "$@"
+}
+
+function msg { out "$*" >&2 ;}
+function err { local x=$? ; msg "$*" ; return $(( $x == 0 ? 1 : $x )) ;}
+function out { printf '%s\n' "$*" ;}
+
+if [[ ${1:-} ]] && declare -F | cut -d' ' -f3 | fgrep -qx -- "${1:-}"
+then "$@"
+else main "$@"
+fi
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos-master
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos-master b/support/packaging/common/mesos-master
new file mode 100644
index 0000000..37726ce
--- /dev/null
+++ b/support/packaging/common/mesos-master
@@ -0,0 +1,2 @@
+PORT=5050
+ZK=`cat /etc/mesos/zk`
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos-master.service
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos-master.service b/support/packaging/common/mesos-master.service
new file mode 100644
index 0000000..bd5aec6
--- /dev/null
+++ b/support/packaging/common/mesos-master.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Mesos Master
+After=network.target
+Wants=network.target
+
+[Service]
+ExecStart=/usr/bin/mesos-init-wrapper master
+Restart=always
+RestartSec=20
+LimitNOFILE=16384
+
+[Install]
+WantedBy=multi-user.target
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos-master.upstart
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos-master.upstart b/support/packaging/common/mesos-master.upstart
new file mode 100644
index 0000000..26cbf06
--- /dev/null
+++ b/support/packaging/common/mesos-master.upstart
@@ -0,0 +1,10 @@
+description "mesos master"
+
+# Start just after the System-V jobs (rc) to ensure networking and zookeeper
+# are started. This is as simple as possible to ensure compatibility with
+# Ubuntu, Debian, CentOS, and RHEL distros. See:
+# http://upstart.ubuntu.com/cookbook/#standard-idioms
+start on stopped rc RUNLEVEL=[2345]
+respawn
+
+exec /usr/bin/mesos-init-wrapper master
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos-slave
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos-slave b/support/packaging/common/mesos-slave
new file mode 100644
index 0000000..326d90d
--- /dev/null
+++ b/support/packaging/common/mesos-slave
@@ -0,0 +1 @@
+MASTER=`cat /etc/mesos/zk`
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos-slave.service
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos-slave.service b/support/packaging/common/mesos-slave.service
new file mode 100644
index 0000000..99c2728
--- /dev/null
+++ b/support/packaging/common/mesos-slave.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Mesos Agent
+After=network.target
+Wants=network.target
+
+[Service]
+ExecStart=/usr/bin/mesos-init-wrapper agent
+KillMode=process
+Restart=always
+RestartSec=20
+LimitNOFILE=16384
+CPUAccounting=true
+MemoryAccounting=true
+
+[Install]
+WantedBy=multi-user.target
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff01d0c4/support/packaging/common/mesos-slave.upstart
----------------------------------------------------------------------
diff --git a/support/packaging/common/mesos-slave.upstart b/support/packaging/common/mesos-slave.upstart
new file mode 100644
index 0000000..c01aef4
--- /dev/null
+++ b/support/packaging/common/mesos-slave.upstart
@@ -0,0 +1,10 @@
+description "mesos agent"
+
+# Start just after the System-V jobs (rc) to ensure networking and zookeeper
+# are started. This is as simple as possible to ensure compatibility with
+# Ubuntu, Debian, CentOS, and RHEL distros. See:
+# http://upstart.ubuntu.com/cookbook/#standard-idioms
+start on stopped rc RUNLEVEL=[2345]
+respawn
+
+exec /usr/bin/mesos-init-wrapper agent