%global htmldir %{_localstatedir}/www/html
%global brokerdir %{_localstatedir}/www/stickshift/broker
%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
%global with_systemd 1
%else
%global with_systemd 0
%endif
Summary: OpenShift Origin broker components
Name: openshift-origin-broker
Version: 0.6.7
Release: 9%{?dist}
License: ASL 2.0
URL: http://openshift.redhat.com
Source0: http://mirror.openshift.com/pub/openshift-origin/source/%{name}/%{name}-%{version}.tar.gz
# Example blank favicon - upstream currently does not ship one
Source1: %{name}.favicon
# systemd script and config - provided by upstream, will be in future versions
Source2: %{name}.service
Source3: %{name}.env
Requires: httpd
Requires: mod_ssl
Requires: mod_passenger
Requires: mongodb-server
Requires: rubygem(rails)
Requires: rubygem(rack)
Requires: rubygem(open4)
Requires: rubygem(xml-simple)
Requires: rubygem(bson_ext)
Requires: rubygem(rest-client)
Requires: rubygem(parseconfig)
Requires: rubygem(json)
Requires: rubygem(multimap)
Requires: rubygem(openshift-origin-controller)
Requires: rubygem(passenger)
Requires: rubygem(passenger-native)
Requires: selinux-policy-targeted
Requires: policycoreutils-python
%if %{with_systemd}
Requires: systemd-units
%endif
BuildArch: noarch
%description
This contains the broker 'controlling' components of OpenShift.
This includes the public APIs for the client tools.
%prep
%setup -q
%build
%install
%if %{with_systemd}
mkdir -p %{buildroot}%{_unitdir}
%else
mkdir -p %{buildroot}%{_initddir}
%endif
mkdir -p %{buildroot}%{htmldir}
mkdir -p %{buildroot}%{brokerdir}/httpd/root
mkdir -p %{buildroot}%{brokerdir}/httpd/run
mkdir -p %{buildroot}%{brokerdir}/httpd/logs
mkdir -p %{buildroot}%{brokerdir}/httpd/conf
mkdir -p %{buildroot}%{brokerdir}/log
mkdir -p %{buildroot}%{brokerdir}/run
mkdir -p %{buildroot}%{brokerdir}/tmp/cache
mkdir -p %{buildroot}%{brokerdir}/tmp/pids
mkdir -p %{buildroot}%{brokerdir}/tmp/sessions
mkdir -p %{buildroot}%{brokerdir}/tmp/sockets
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/stickshift
mkdir -p %{buildroot}%{_var}/lib/stickshift
mkdir -p %{buildroot}/usr/share/selinux/packages/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
cp -rp . %{buildroot}%{brokerdir}
%if %{with_systemd}
cp -p %{SOURCE2} %{buildroot}%{_unitdir}
cp -p %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
%else
mv %{buildroot}%{brokerdir}/init.d/stickshift-broker %{buildroot}%{_initddir}/%{name}
%endif
ln -s %{brokerdir}/public %{buildroot}%{htmldir}/broker
ln -s %{brokerdir}/public %{buildroot}%{brokerdir}/httpd/root/broker
ln -sf /usr/lib64/httpd/modules %{buildroot}%{brokerdir}/httpd/modules
ln -sf /etc/httpd/conf/magic %{buildroot}%{brokerdir}/httpd/conf/magic
mv %{buildroot}%{brokerdir}/httpd/000000_stickshift_proxy.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/
cp %{buildroot}%{brokerdir}/doc/selinux/stickshift-broker.te %{buildroot}/usr/share/selinux/packages/%{name}/
# Clean up stuff
rm -f %{buildroot}%{brokerdir}/.gitignore
rm -f %{buildroot}%{brokerdir}/LICENSE
rm -f %{buildroot}%{brokerdir}/COPYRIGHT
rm -f %{buildroot}%{brokerdir}/openshift-origin-broker.spec
rm -rf %{buildroot}%{brokerdir}/init.d
cp -p %{SOURCE1} %{buildroot}%{brokerdir}/public/favicon.ico
chmod 644 %{buildroot}%{brokerdir}/Gemfile
chmod 644 %{buildroot}%{brokerdir}/config/environments/production.rb
chmod 644 %{buildroot}%{brokerdir}/config/environments/development.rb
chmod 644 %{buildroot}%{_sysconfdir}/httpd/conf.d/000000_stickshift_proxy.conf
%post
%if %{with_systemd}
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%systemd_post %{name}.service
%else
if [ $1 -eq 1 ] ; then
# Initial installation --
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%endif
%endif
#selinux updated
pushd /usr/share/selinux/packages/%{name}
make -f /usr/share/selinux/devel/Makefile
popd
semanage -i - <<_EOF
boolean -m --on httpd_can_network_connect
boolean -m --on httpd_can_network_relay
boolean -m --on httpd_read_user_content
boolean -m --on httpd_enable_homedirs
fcontext -a -t httpd_var_run_t '%{brokerdir}/httpd/run(/.*)?'
fcontext -a -t httpd_tmp_t '%{brokerdir}/tmp(/.*)?'
fcontext -a -t httpd_log_t '%{brokerdir}/httpd/logs(/.*)?'
fcontext -a -t httpd_log_t '%{brokerdir}/log(/.*)?'
_EOF
semodule -i /usr/share/selinux/packages/%{name}/stickshift-broker.pp
/sbin/restorecon -R -v %{brokerdir}/httpd
/sbin/restorecon -R -v %{brokerdir}/log
%preun
%if %{with_systemd}
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%systemd_preun %{name}.service
%else
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade --
/bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
/bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
fi
%endif
%else
if [ "$1" -eq 0 ] ; then
service %{name} stop > /dev/null 2>&1
chkconfig %{name} off || :
fi
%endif
%postun
if [ "$1" -eq 0 ] ; then
# Package uninstall, not upgrade
/usr/sbin/semodule -r stickshift-broker
fi
%if %{with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%systemd_postun_with_restart %{name}.service
%else
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall --
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi
%endif
%endif
%files
%doc LICENSE COPYRIGHT
%if %{with_systemd}
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%else
%{_initddir}/%{name}
%endif
/usr/share/selinux/packages/%{name}/
%attr(0644,-,-) %ghost /usr/share/selinux/packages/%{name}/stickshift-broker.pp
%{_var}/lib/stickshift
%config(noreplace) %{_sysconfdir}/httpd/conf.d/000000_stickshift_proxy.conf
%dir %{brokerdir}
%{brokerdir}/Gemfile
%{brokerdir}/Gemfile.lock
%{brokerdir}/README
%{brokerdir}/README.md
%{brokerdir}/Rakefile
%{brokerdir}/app
%{brokerdir}/config.ru
%dir %{brokerdir}/config
%{brokerdir}/config/application.rb
%{brokerdir}/config/boot.rb
%{brokerdir}/config/environment.rb
%{brokerdir}/config/routes.rb
%dir %{brokerdir}/config/environments
%config(noreplace) %{brokerdir}/config/environments/production.rb
%config(noreplace) %{brokerdir}/config/environments/development.rb
%{brokerdir}/config/environments/test.rb
%{brokerdir}/config/initializers
%{brokerdir}/db
%{brokerdir}/doc
%{brokerdir}/httpd
%attr(0644,-,-) %ghost %{brokerdir}/httpd/logs/error_log
%attr(0644,-,-) %ghost %{brokerdir}/httpd/logs/access_log
%{brokerdir}/lib
%{brokerdir}/public
%{brokerdir}/script
%{brokerdir}/test
%{htmldir}/broker
%defattr(-,apache,apache,-)
%{brokerdir}/log
%attr(0644,-,-) %ghost %{brokerdir}/log/production.log
%attr(0644,-,-) %ghost %{brokerdir}/log/development.log
%{brokerdir}/tmp
%{brokerdir}/run
%changelog
* Fri Aug 17 2012 Troy Dawson 0.6.7-9
- Changed ghost files to 644
- Changed attr of /log /tmp /run to apache
* Thu Aug 16 2012 Troy Dawson 0.6.7-8
- Remove apache ownership of the directories and files
- removed instances where we messed with passenger selinux stuff
- cleaned up alot of spec stuff
- added stickshift-broker.pp as a ghost file
- Used official systemd scripts/templates for post,preun,postun
* Wed Aug 15 2012 Troy Dawson 0.6.7-7
- Removed "/sbin/restorecon -R -v /var/run" we have no files there
- Made systeconfig/openshift-origin-broker a config file
* Wed Aug 15 2012 Troy Dawson 0.6.7-6
- Removed Requires: Oddjob
* Mon Aug 13 2012 Troy Dawson 0.6.7-5
- Added support for systemd
- Cleaned up spec file
* Tue Aug 07 2012 Adam Miller - 0.6.7-4
- changed permissions and ownership for config files
- added note about blank favicon
* Wed Aug 01 2012 Troy Dawson 0.6.7-3
- Renamed to openshift-origin-broker
- Changed logs to ghost setting
- Replace ridealong with passenger
* Mon Jul 23 2012 Troy Dawson 0.6.7-2
- Fixup for Fedora
- Replace passenger with ridealong
* Wed May 30 2012 Krishna Raman 0.6.7-1
- Fixing /etc/httpd/conf.d/stickshift link to be conpatible with typeless gears
change Fixing context of action log file (kraman@gmail.com)
- Merge pull request #75 from abhgupta/bz817172 (mmcgrath+openshift@redhat.com)
- Fix for bug 817172 - adding gear profile on gear_groups rest call
(abhgupta@redhat.com)
* Wed May 30 2012 Krishna Raman 0.6.6-1
- Updating gem versions (admiller@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Updating gem versions (dmcphers@redhat.com)
- Merge pull request #66 from abhgupta/agupta-dev (dmcphers@redhat.com)
- Fix for Bugz 825366, 825340. SELinux changes to allow access to
user_action.log file. Logging authentication failures and user creation for
OpenShift Origin (abhgupta@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Merge pull request #46 from rajatchopra/master (kraman@gmail.com)
- Updating gem versions (dmcphers@redhat.com)
- Updating gem versions (dmcphers@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Merge pull request #56 from pravisankar/master (admiller@redhat.com)
- disable mongo unit tests temporarily to avoid build issues
(rpenta@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Fixed mongo data store unit tests (rpenta@redhat.com)
- changing user action log file path (abhgupta@redhat.com)
- changes for logging user actions to a separate log file (abhgupta@redhat.com)
- Updating gem versions (admiller@redhat.com)
- fixup gem versions (dmcphers@redhat.com)
- Updating gem versions (admiller@redhat.com)
- code for min_gear setting (rchopra@redhat.com)
- Updating gem versions (dmcphers@redhat.com)
- Updating gem versions (dmcphers@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Updating gem versions (admiller@redhat.com)
- more timeout tweaking (dmcphers@redhat.com)
- try a bigger timeout (dmcphers@redhat.com)
- try a bigger timeout (dmcphers@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Merge pull request #40 from kraman/dev/kraman/features/livecd
(admiller@redhat.com)
- Re-include all OpenShift components in rcov run. (rmillner@redhat.com)
- Adding livecd build scripts Adding a text only minimal version of livecd
Added ability to access livecd dns from outside VM (kraman@gmail.com)
- allow syslog output for gear usage (dmcphers@redhat.com)
- proper usage of StickShift::Model and beginnings of usage tracking
(dmcphers@redhat.com)
- Add rcov testing to the Stickshift broker, common and controller.
(rmillner@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Merge pull request #28 from abhgupta/abhgupta-dev2 (dmcphers@redhat.com)
- adding test cases for gear_groups rest api and changing tag from cartridge to
cartridges as it is a list (abhgupta@redhat.com)
- We already validate the gear size elswhere based on the user information.
Remove the hard-coded list of node types. As a side effect; we can't check
invalid gear sizes in unit tests. (rmillner@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Small is the only gear size guaranteed to be accepted by the broker.
(rmillner@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Updating gem versions (admiller@redhat.com)
- BugZ 817170. Add ability to get valid gear size options from the
ApplicationContainerProxy (kraman@gmail.com)
- update gem versions (dmcphers@redhat.com)
- Updating gem versions (admiller@redhat.com)
* Wed Apr 25 2012 Krishna Raman 0.6.5-1
- Updating gem versions (admiller@redhat.com)
- fix gem version (dmcphers@redhat.com)
- Modifed SELinux policy to allow connection to DB. (mpatel@redhat.com)
- Merge branch 'master' of github.com:openshift/crankcase (rpenta@redhat.com)
- Fixes + README file for REST api version unit tests (rpenta@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Stickshift broker Unit tests to verify REST api version compatibility
(rpenta@redhat.com)
- Updating gem versions (admiller@redhat.com)
- Fixing stickshift-broker.spec to load rubygem-passenger.pp SELinux policy
(kraman@gmail.com)
- Adding missing initializer to load Mongo datastore (kraman@gmail.com)
- Updating gem versions (admiller@redhat.com)
* Mon Apr 23 2012 Krishna Raman 0.6.4-1
- Updated SELinux policies (kraman@gmail.com)
- Adding pasenger dependencies which provide required selinux policies.
(kraman@gmail.com)
- Updating gem versions (admiller@redhat.com)
- cleaning up spec files (dmcphers@redhat.com)
- Updating gem versions (admiller@redhat.com)
- fix hanging comma (dmcphers@redhat.com)
- move crankcase mongo datastore (dmcphers@redhat.com)
* Sat Apr 21 2012 Krishna Raman 0.6.3-1
- new package built with tito