Repository: aurora-packaging Updated Branches: refs/heads/master 915b7f9f7 -> 092eb294b
Working version of jessie builds. Reviewed at https://reviews.apache.org/r/42387/ Project: http://git-wip-us.apache.org/repos/asf/aurora-packaging/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora-packaging/commit/092eb294 Tree: http://git-wip-us.apache.org/repos/asf/aurora-packaging/tree/092eb294 Diff: http://git-wip-us.apache.org/repos/asf/aurora-packaging/diff/092eb294 Branch: refs/heads/master Commit: 092eb294b8e74ad7fd51195991f7005db60a80a9 Parents: 915b7f9 Author: Dmitriy Shirchenko <[email protected]> Authored: Thu Jan 21 14:29:13 2016 -0800 Committer: Bill Farner <[email protected]> Committed: Thu Jan 21 14:29:13 2016 -0800 ---------------------------------------------------------------------- builder/deb/debian-jessie/Dockerfile | 48 +++++++++++++++++++++++ builder/deb/debian-jessie/build.sh | 40 +++++++++++++++++++ builder/deb/debian-jessie/pants.ini | 5 +++ specs/debian/aurora-executor.thermos.init | 16 +++++--- specs/debian/aurora-executor.thermos.service | 31 +++++++++++++++ specs/debian/aurora-scheduler.init | 12 ++++-- specs/debian/aurora-scheduler.service | 31 +++++++++++++++ specs/debian/aurora-scheduler.upstart | 1 - specs/rpm/SOURCES/aurora.sysconfig | 3 -- test/deb/debian-jessie/README.md | 32 +++++++++++++++ test/deb/debian-jessie/Vagrantfile | 12 ++++++ test/deb/debian-jessie/provision.sh | 11 ++++++ 12 files changed, 229 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/builder/deb/debian-jessie/Dockerfile ---------------------------------------------------------------------- diff --git a/builder/deb/debian-jessie/Dockerfile b/builder/deb/debian-jessie/Dockerfile new file mode 100644 index 0000000..63e89de --- /dev/null +++ b/builder/deb/debian-jessie/Dockerfile @@ -0,0 +1,48 @@ +# Licensed 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. +# +FROM debian:jessie-backports + +WORKDIR /aurora +ENV HOME /aurora +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get -y install \ + bison \ + debhelper \ + devscripts \ + dpkg-dev \ + curl \ + git \ + libapr1-dev \ + libcurl4-openssl-dev \ + libkrb5-dev \ + libsvn-dev \ + python-all-dev \ + software-properties-common \ + thrift-compiler + +RUN apt-get -y -t jessie-backports install openjdk-8-jdk \ + && update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java + +# TODO (shirchen): explore possiblity of downloading gradle directly from gradle. Issue is that +# there's already a build-time dep of a package name 'gradle'. +# Install gradle. +RUN git clone --depth 1 https://github.com/benley/gradle-packaging \ + && cd gradle-packaging \ + && apt-get install -y ruby ruby-dev unzip wget \ + && gem install fpm && ./gradle-mkdeb.sh 2.10 \ + && dpkg -i gradle-2.10_2.10-2_all.deb \ + && cd .. && rm -rf gradle-packaging + +ADD build.sh /build.sh +ADD pants.ini /pants.ini http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/builder/deb/debian-jessie/build.sh ---------------------------------------------------------------------- diff --git a/builder/deb/debian-jessie/build.sh b/builder/deb/debian-jessie/build.sh new file mode 100755 index 0000000..f122a51 --- /dev/null +++ b/builder/deb/debian-jessie/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Licensed 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. +# + +#TODO (wfarner): Figure out how to symlink build files into Docker container. + +set -ex + +mkdir /scratch +cd /scratch + +tar --strip-components 1 -C . -xf /src.tar.gz + +cp -R /specs/debian . + +export DEBFULLNAME='Apache Aurora' +export DEBEMAIL='[email protected]' + +dch \ + --newversion $AURORA_VERSION \ + --package apache-aurora \ + --urgency medium \ + "Apache Aurora package builder <[email protected]> $(date -R)" +dch --release '' + +dpkg-buildpackage -uc -b -tc + +mkdir /dist +mv ../*.deb /dist http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/builder/deb/debian-jessie/pants.ini ---------------------------------------------------------------------- diff --git a/builder/deb/debian-jessie/pants.ini b/builder/deb/debian-jessie/pants.ini new file mode 100644 index 0000000..2ff2d5e --- /dev/null +++ b/builder/deb/debian-jessie/pants.ini @@ -0,0 +1,5 @@ +[DEFAULT] +print_exception_stacktrace: True + +[python-repos] +repos: ['third_party/', 'https://svn.apache.org/repos/asf/incubator/aurora/3rdparty/ubuntu/trusty64/python/'] http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/specs/debian/aurora-executor.thermos.init ---------------------------------------------------------------------- diff --git a/specs/debian/aurora-executor.thermos.init b/specs/debian/aurora-executor.thermos.init index e5c9401..9bc8675 100755 --- a/specs/debian/aurora-executor.thermos.init +++ b/specs/debian/aurora-executor.thermos.init @@ -19,7 +19,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Aurora Thermos observer" NAME=thermos DAEMON=/usr/sbin/thermos_observer -PIDFILE=/var/run/thermos_observer.pid +PIDFILE=/var/run/aurora-observer.pid SCRIPTNAME=/etc/init.d/"$NAME" test -f $DAEMON || exit 0 @@ -36,18 +36,22 @@ fi [ -r /etc/default/thermos ] && . /etc/default/thermos ARGS="--port=${OBSERVER_PORT:-1338} - --log_to_disk=NONE - --log_to_stderr=google:INFO" + --mesos-root=${MESOS_ROOT:-/var/lib/mesos} + --app_daemonize + --app_pidfile=$PIDFILE + --log_simple + --log_to_disk=google:INFO + --log_dir=/var/log/aurora" case "$1" in start) - log_daemon_msg "Starting $DESC" "$NAME" - mkdir -p /var/run/thermos + log_daemon_msg "Starting $DESC $NAME with $ARGS" + mkdir -p /var/log/aurora start_daemon -p $PIDFILE $DAEMON $ARGS log_end_msg $? ;; stop) - log_daemon_msg "Stopping $DESC" "$NAME" + log_daemon_msg "Stopping $DESC $NAME" killproc -p $PIDFILE $DAEMON RETVAL=$? [ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/specs/debian/aurora-executor.thermos.service ---------------------------------------------------------------------- diff --git a/specs/debian/aurora-executor.thermos.service b/specs/debian/aurora-executor.thermos.service new file mode 100644 index 0000000..da35116 --- /dev/null +++ b/specs/debian/aurora-executor.thermos.service @@ -0,0 +1,31 @@ +# Licensed 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. + +[Unit] +Description=Thermos Observer +After=network.target +Wants=network.target + +[Service] +Type=forking +IgnoreSIGPIPE=no +GuessMainPID=no +ExecStart=/etc/init.d/thermos start +ExecStop=/etc/init.d/thermos stop +User=root +Group=root +Restart=always +RestartSec=20 +LimitNOFILE=16384 + +[Install] +WantedBy=multi-user.target http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/specs/debian/aurora-scheduler.init ---------------------------------------------------------------------- diff --git a/specs/debian/aurora-scheduler.init b/specs/debian/aurora-scheduler.init index 59b200f..b280c75 100755 --- a/specs/debian/aurora-scheduler.init +++ b/specs/debian/aurora-scheduler.init @@ -62,15 +62,21 @@ ARGS="-cluster_name=$CLUSTER_NAME -thermos_executor_resources=$THERMOS_EXECUTOR_RESOURCES -thermos_executor_flags=$THERMOS_EXECUTOR_FLAGS -allowed_container_types=$ALLOWED_CONTAINER_TYPES - -vlog=$LOG_LEVEL $EXTRA_SCHEDULER_ARGS" export JAVA_OPTS GLOG_v LIBPROCESS_PORT LIBPROCESS_IP case "$1" in start) - log_daemon_msg "Starting $DESC" "$NAME" - start_daemon -p $PIDFILE $DAEMON $ARGS + log_daemon_msg "Starting $DESC $NAME with $ARGS" + start-stop-daemon --start \ + --quiet \ + --oknodo \ + --pidfile $PIDFILE \ + --background \ + --make-pidfile \ + --no-close \ + --exec $DAEMON -- $ARGS log_end_msg $? ;; stop) http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/specs/debian/aurora-scheduler.service ---------------------------------------------------------------------- diff --git a/specs/debian/aurora-scheduler.service b/specs/debian/aurora-scheduler.service new file mode 100644 index 0000000..ae33d26 --- /dev/null +++ b/specs/debian/aurora-scheduler.service @@ -0,0 +1,31 @@ +# Licensed 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. + +[Unit] +Description=Aurora Scheduler +After=network.target +Wants=network.target + +[Service] +Type=forking +IgnoreSIGPIPE=no +GuessMainPID=no +ExecStart=/etc/init.d/aurora-scheduler start +ExecStop=/etc/init.d/aurora-scheduler stop +User=aurora +Group=aurora +Restart=always +RestartSec=20 +LimitNOFILE=16384 + +[Install] +WantedBy=multi-user.target http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/specs/debian/aurora-scheduler.upstart ---------------------------------------------------------------------- diff --git a/specs/debian/aurora-scheduler.upstart b/specs/debian/aurora-scheduler.upstart index 1ceb704..3c32068 100644 --- a/specs/debian/aurora-scheduler.upstart +++ b/specs/debian/aurora-scheduler.upstart @@ -34,6 +34,5 @@ script -thermos_executor_resources="$THERMOS_EXECUTOR_RESOURCES" \ -thermos_executor_flags="$THERMOS_EXECUTOR_FLAGS" \ -allowed_container_types="$ALLOWED_CONTAINER_TYPES" \ - -vlog="$LOG_LEVEL" \ $EXTRA_SCHEDULER_ARGS end script http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/specs/rpm/SOURCES/aurora.sysconfig ---------------------------------------------------------------------- diff --git a/specs/rpm/SOURCES/aurora.sysconfig b/specs/rpm/SOURCES/aurora.sysconfig index f421d19..166df4d 100644 --- a/specs/rpm/SOURCES/aurora.sysconfig +++ b/specs/rpm/SOURCES/aurora.sysconfig @@ -47,9 +47,6 @@ AURORA_FLAGS=( # ServerSet, which keeps track of all live Aurora schedulers. -serverset_path='/aurora/scheduler' - # The log level of the built-in logger. - -vlog='INFO' - # Allows the scheduling of containers of the provided type. -allowed_container_types='DOCKER,MESOS' http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/test/deb/debian-jessie/README.md ---------------------------------------------------------------------- diff --git a/test/deb/debian-jessie/README.md b/test/deb/debian-jessie/README.md new file mode 100644 index 0000000..9be58bd --- /dev/null +++ b/test/deb/debian-jessie/README.md @@ -0,0 +1,32 @@ +# Within vagrant install vagrant scp +vagrant plugin install vagrant-scp +# Then scp over the newly built packages +vagrant scp \ + ~/aurora-packaging/artifacts/aurora-debian-jessie/dist/aurora-scheduler_0.12.1.uber.3_amd64.deb \ + aurora_jessie:aurora-scheduler_0.12.1.uber.3_amd64.deb + +# Install each deb via dpkg -i + +# Start Mesos + ZK +sudo systemctl start mesos-master +sudo systemctl start mesos-slave +# Stop scheduler to setup log replication. +sudo systemctl stop aurora-scheduler + +# Setup log replication +sudo chown -R aurora:aurora /var/lib/aurora +sudo -u aurora mesos-log initialize --path=/var/lib/aurora/scheduler/db + +# Start Aurora scheduler again +sudo systemctl start aurora-scheduler + +## Create a job + +echo " +task = SequentialTask( + processes = [Process(name = 'hello', cmdline = 'echo hello')], + resources = Resources(cpu = 1.0, ram = 128*MB, disk = 128*MB)) +jobs = [Service( + task = task, cluster = 'example', role = 'www-data', environment = 'prod', name = 'hello')]" > hello_world.aurora + +aurora job create example/www-data/prod/hello hello_world.aurora http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/test/deb/debian-jessie/Vagrantfile ---------------------------------------------------------------------- diff --git a/test/deb/debian-jessie/Vagrantfile b/test/deb/debian-jessie/Vagrantfile new file mode 100644 index 0000000..619b793 --- /dev/null +++ b/test/deb/debian-jessie/Vagrantfile @@ -0,0 +1,12 @@ +Vagrant.require_version ">= 1.5.0" + +Vagrant.configure(2) do |config| + config.vm.box = "debian/jessie64" + + config.vm.provider :virtualbox do |vb| + vb.customize ["modifyvm", :id, "--memory", "4096"] + vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] + end + config.vm.define "aurora_jessie" + config.vm.provision "shell", path: "provision.sh" +end http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/092eb294/test/deb/debian-jessie/provision.sh ---------------------------------------------------------------------- diff --git a/test/deb/debian-jessie/provision.sh b/test/deb/debian-jessie/provision.sh new file mode 100644 index 0000000..6970279 --- /dev/null +++ b/test/deb/debian-jessie/provision.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "deb http://http.debian.net/debian jessie-backports main" | sudo tee -a /etc/apt/sources.list +apt-get update +apt-get install -y openjdk-8-jre libsvn1 zookeeperd + +update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java + +package=mesos_0.26.0-0.2.145.debian81_amd64.deb +wget -c http://downloads.mesosphere.io/master/debian/8/$package +dpkg -i $package
