Skip to content

Instantly share code, notes, and snippets.

@SEJeff
Created August 6, 2015 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SEJeff/6eefd3db322a9a780dd4 to your computer and use it in GitHub Desktop.
Save SEJeff/6eefd3db322a9a780dd4 to your computer and use it in GitHub Desktop.
File for building Aurora on EL7 based distributions
%define install_directory %{_datadir}/aurora
Name: aurora
Version: 0.9.0
Release: 1%{?dist}.rc0
Summary: A framework for scheduling long-running services against Apache Mesos
License: ASL 2.0
URL: http://%{name}.apache.org/
Source0: apache-%{name}-%{version}.tar.gz
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: java-1.8.0-openjdk
BuildRequires: java-1.8.0-openjdk-devel
BuildRequires: mesos
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: tar
BuildRequires: unzip
BuildRequires: which
BuildRequires: zip
BuildRequires: wget
BuildRequires: curl
%description
Apache Aurora is a service scheduler that runs on top of Mesos, enabling you
to schedule long-running services that take advantage of Mesos\' scalability,
fault-tolerance, and resource isolation.
%package client
Summary: Client tools for interacting with the scheduler.
Group: Development/Tools
%description client
Provides aurora_client binary.
%package admin-client
Summary: Administrative client tools for interacting with the scheduler.
Group: Development/Tools
%description admin-client
Provides aurora_admin binary.
%package scheduler
Summary: The master scheduler portion of Aurora.
Group: Applications/System
Requires: java-1.8.0-openjdk
Requires: java-1.8.0-openjdk-devel
Requires: mesos
Requires: python
Requires: python-mesos
%description scheduler
Apache Aurora is a service scheduler that runs on top of Mesos, enabling you
to schedule long-running services that take advantage of Mesos\' scalability,
fault-tolerance, and resource isolation.
%package thermos
Summary: A simple Pythonic process management framework for Mesos chroots
Group: Applications/System
Requires: mesos
Requires: python
Requires: mesos-python
%description thermos
Thermos a simple process management framework used for orchestrating
dependent processes within a single Mesos chroot.
%prep
%setup -q -n apache-%{name}
%build
# Grotesque hax0r for ensuring the python clients build properly
EGG_DIR=$(pwd)/.pants.d/python/eggs
mkdir -p $EGG_DIR
for egg in mesos-0.22.0-py2.7.egg mesos.interface-0.22.0-py2.7.egg mesos.native-0.22.0-py2.7-linux-x86_64.egg; do
# TODO: Find place to wget these from
done
# This is needed otherwise gradlew blows up
rm -f .auroraversion
ls -sf src/main/resources/apache/aurora/client/cli/.auroraversion
echo "%{version}" > .auroraversion
# The main aurora distribution.
./gradlew distZip
# The client
./pants binary src/main/python/apache/aurora/client/cli:aurora
# The admin client
./pants binary src/main/python/apache/aurora/admin:aurora_admin
# Thermos crud
./pants binary src/main/python/apache/thermos/bin:thermos_runner
./pants binary src/main/python/apache/thermos/observer/bin:thermos_observer
# This needs the mesos.native egg of the correct version installed
./pants binary src/main/python/apache/aurora/executor/bin:thermos_executor
## Package thermos runner within the observer.
python <<EOF
import contextlib
import zipfile
with contextlib.closing(zipfile.ZipFile('dist/thermos_executor.pex', 'a')) as zf:
zf.writestr('apache/aurora/executor/resources/__init__.py', '')
zf.write('dist/thermos_runner.pex', 'apache/aurora/executor/resources/thermos_runner.pex')
EOF
%install
rm -rf %{buildroot}
install -d -m 755 %{buildroot}%{_bindir}
install -d -m 755 %{buildroot}%{install_directory}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
unzip dist/distributions/%{name}-scheduler-%{version}.zip -d .
# Set the right APP_HOME so the aurora shell script does the right thing
sed -i '/^APP_HOME=/s@".*"@"%{install_directory}"@' %{name}-scheduler-%{version}/bin/%{name}-scheduler
mv %{name}-scheduler-%{version}/bin/* %{buildroot}%{_bindir}/
mv %{name}-scheduler-%{version}/lib %{buildroot}%{install_directory}/
mv %{name}-scheduler-%{version}/etc/shiro.example.ini %{buildroot}%{_sysconfdir}/
rm %{buildroot}%{_bindir}/%{name}-scheduler.bat
install -m 755 dist/aurora_admin.pex %{buildroot}%{_bindir}/aurora_admin
install -m 755 dist/aurora_client.pex %{buildroot}%{_bindir}/aurora_client
install -d -m 755 %{buildroot}%{_bindir}
install -m 755 dist/gc_executor.pex %{buildroot}%{_bindir}/gc_executor
install -m 755 dist/thermos_executor.pex %{buildroot}%{_bindir}/thermos_executor
install -m 755 dist/thermos_runner.pex %{buildroot}%{_bindir}/thermos_runner
install -m 755 dist/thermos_observer.pex %{buildroot}%{_bindir}/thermos_observer
%clean
rm -rf %{buildroot}
%files client
%defattr(-,root,root,-)
%{_bindir}/aurora_client
%files admin-client
%defattr(-,root,root,-)
%{_bindir}/aurora_admin
%files scheduler
%defattr(-,root,root,-)
%{_sysconfdir}/%{name}
%{install_directory}/lib/*
%{_bindir}/%{name}-scheduler
%files thermos
%defattr(-,root,root,-)
%{_bindir}/thermos_runner
%{_bindir}/thermos_observer
%{_bindir}/thermos_executor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment