dev/null |binary moksha.spec | 55 ++++++++++++++++++++++++++------ moksha/commands/cli.py | 1 moksha/hub/hub.py | 4 ++ pavement.py | 4 +- production/moksha-hub | 30 ++++++++++++----- production/moksha-hub.init | 76 +++++++++++++++++++++++++++++++++------------ setup.py | 1 8 files changed, 128 insertions(+), 43 deletions(-)
New commits: commit 4f24213e40ec84ad4c2cd9e73a8bea15eeb542c3 Author: Luke Macken lmacken@redhat.com Date: Tue Dec 14 17:21:18 2010 -0500
Rename our docs subpackage to doc
diff --git a/pavement.py b/pavement.py index cfad43e..4990ccd 100644 --- a/pavement.py +++ b/pavement.py @@ -190,8 +190,8 @@ def reinstall(): sh('mv dist/* ~/rpmbuild/SOURCES/') sh('cp moksha.spec ~/rpmbuild/SPECS/') sh('rpmbuild -ba ~/rpmbuild/SPECS/moksha.spec') - sh('sudo rpm -e --nodeps moksha{,-docs,-server}', ignore_error=True) - sh('sudo rpm -ivh ~/rpmbuild/RPMS/noarch/moksha{,-docs,-server}-%s-1.*noarch.rpm' % options.version.number) + sh('sudo rpm -e --nodeps moksha{,-doc,-server}', ignore_error=True) + sh('sudo rpm -ivh ~/rpmbuild/RPMS/noarch/moksha{,-doc,-server}-%s-1.*noarch.rpm' % options.version.number)
@task def restart_httpd():
commit e1bfd0a09a0867cb309cc91c79fca024b658ab20 Author: Luke Macken lmacken@redhat.com Date: Tue Dec 14 17:21:09 2010 -0500
Get the moksha-hub init script working
diff --git a/production/moksha-hub.init b/production/moksha-hub.init index 2290c11..dc321a4 100644 --- a/production/moksha-hub.init +++ b/production/moksha-hub.init @@ -1,33 +1,63 @@ #!/bin/bash +# moksha-hub - This init script runs the Moksha Hub # -# /etc/rc.d/init.d/ -# -# -# -# -# +# chkconfig: - 25 85 +# description: Enabled the moksha hub daemon +# processname: moksha-hub +# config: /etc/moksha/production.ini +# pidfile: /var/run/moksha/moksha-hub.pid + +### BEGIN INIT INFO +# Provides: moksha-hub +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: +# Default-Stop: 0 1 6 +# Short-Description: start or stop the moksha-hub +# Description: The moksha hub connects to a message broker and runs the moksha \ +# message producers and consumers +### END INIT INFO
# Source function library. . /etc/init.d/functions
+PROG=moksha-hub +USER=moksha +PIDFILE=/var/run/moksha/$PROG.pid +OPTIONS=--daemon +SUBSYS=/var/lock/subsys/$PROG + start() { - echo -n "Starting the Moksha Hub: " - if [ -f /var/lock/subsys/moksha-hub ]; then - echo Moksha Hub already running - exit 2; - fi - touch /var/lock/subsys/moksha-hub - daemon moksha-hub --daemon - return $? + echo -n "Starting the Moksha Hub: " + if [ -f $PIDFILE.lock ]; then + echo Moksha Hub already running + exit 2; + fi + + if [ ! -d /var/run/moksha ]; then + mkdir /var/run/moksha + chown $USER:$USER /var/run/moksha + fi + + daemon --user $USER $PROG $OPTIONS + RETVAL=$? + echo + + if [ $RETVAL -eq 0 ]; then + success + touch $SUBSYS + else + failure + fi }
stop() { - echo -n "Shutting down : " + echo -n $"Stopping the Moksha Hub: " + killproc -p ${PIDFILE} $PROG echo - killproc moksha-hub + rm -f ${SUBSYS} + RETVAL=$? echo - rm -f /var/lock/subsys/moksha-hub - return }
case "$1" in @@ -38,14 +68,20 @@ case "$1" in stop ;; status) - + if [ -f $PIDFILE ]; then + echo $"Moksha Hub is running." + RETVAL=0 + else + echo $"Moksha Hub is not running." + RETVAL=3 + fi ;; restart) stop start ;; *) - echo "Usage: {start|stop|status|reload|restart[|probe]" + echo "Usage: {start|stop|status|reload|restart}" exit 1 ;; esac
commit 2c678efa6ef933819f8dde7bfd824ba1e995e9e6 Author: Luke Macken lmacken@redhat.com Date: Tue Dec 14 17:20:56 2010 -0500
Get moksha-hub daemonization working
diff --git a/moksha/commands/cli.py b/moksha/commands/cli.py old mode 100755 new mode 100644 index 2988a69..22dcc1f --- a/moksha/commands/cli.py +++ b/moksha/commands/cli.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python """ The Moksha Command-line Interface """
import os diff --git a/moksha/hub/hub.py b/moksha/hub/hub.py index b38eaee..80c4a19 100644 --- a/moksha/hub/hub.py +++ b/moksha/hub/hub.py @@ -41,6 +41,8 @@ from moksha.hub.stomp import StompHub
log = logging.getLogger('moksha.hub')
+_hub = None + class MokshaHub(StompHub, AMQPHub):
topics = None # {topic_name: [callback,]} @@ -256,6 +258,8 @@ def main(): config.update(cfg)
hub = CentralMokshaHub() + global _hub + _hub = hub
def handle_signal(signum, stackframe): from moksha.hub.reactor import reactor diff --git a/production/moksha-hub b/production/moksha-hub index 8ba6650..13f1227 100755 --- a/production/moksha-hub +++ b/production/moksha-hub @@ -2,19 +2,31 @@
__requires__ = 'moksha'
-import os import sys
def main(): from pkg_resources import load_entry_point sys.exit(load_entry_point('moksha', 'console_scripts', 'moksha-hub')())
+def handle_signal(signum, stackframe): + from moksha.hub.reactor import reactor + from moksha.hub import hub + from twisted.internet.error import ReactorNotRunning + import signal + if hub._hub: + hub._hub.stop() + try: + reactor.stop() + except ReactorNotRunning: + pass + if '--daemon' in sys.argv: - pid = os.fork() - if pid == 0: - os.setsid() - pid = os.fork() - if pid == 0: - main() -else: - main() + from daemon import DaemonContext + from daemon.pidlockfile import PIDLockFile + pidlock = PIDLockFile('/var/run/moksha/moksha-hub.pid') + output = file('/var/log/moksha/moksha-hub.log', 'a') + daemon = DaemonContext(pidfile=pidlock, stdout=output, stderr=output) + daemon.terminate = handle_signal + daemon.open() + +main() diff --git a/setup.py b/setup.py index 673d0a4..c928235 100644 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ setup( "Babel", "pyOpenSSL", "BeautifulSoup", + "python-daemon", #"repoze.squeeze", # Not hard requirements #"repoze.profile", # Not hard requirements ],
commit d33bc6b5408225c42764b4cfaa7db8b1885c3f94 Author: Luke Macken lmacken@redhat.com Date: Tue Dec 14 17:20:28 2010 -0500
A variety of specfile cleanups from our package review (#661902)
- Handle ghosting /var/run/moksha - Setup a log directory - Get the moksha-hub init script working properly - Permission issues
diff --git a/moksha.spec b/moksha.spec index 4756495..8320e58 100644 --- a/moksha.spec +++ b/moksha.spec @@ -3,7 +3,7 @@
Name: moksha Version: 0.5.0 -Release: 2%{?dist} +Release: 1%{?dist} Summary: A platform for creating real-time web applications Group: Applications/Internet License: AGPLv3 @@ -52,6 +52,7 @@ Requires: python-repoze-who-testutil Requires: python-BeautifulSoup Requires: python-twisted Requires: python-stomper +Requires: python-daemon
%description Moksha is a platform for creating real-time collaborative web applications. It @@ -60,12 +61,12 @@ rich applications that can acquire, manipulate, and visualize data from external services. It is a unified framework build using the best available open source technologies such as TurboGears2, jQuery, AMQP, and Orbited.
-%package docs +%package doc Summary: Developer documentation for Moksha Group: Documentation Requires: %{name} = %{version}-%{release}
-%description docs +%description doc This package contains developer documentation for Moksha along with other supporting documentation
@@ -86,6 +87,7 @@ This package contains an Apache mod_wsgi configuration for Moksha.
%{__sed} -i -e 's/$VERSION/%{version}/g' docs/conf.py make -C docs html +%{__rm} docs/_build/html/.buildinfo
%install %{__rm} -rf %{buildroot} @@ -96,18 +98,21 @@ make -C docs html %{__mkdir_p} %{buildroot}%{_datadir}/%{name}/production/apache %{__mkdir_p} %{buildroot}%{_datadir}/%{name}/production/nginx %{__mkdir_p} %{buildroot}%{_datadir}/%{name}/production/rabbitmq -%{__mkdir_p} -m 0700 %{buildroot}/%{_localstatedir}/cache/%{name} -%{__mkdir_p} -m 0700 %{buildroot}/%{_localstatedir}/lib/%{name} +%{__mkdir_p} -m 0755 %{buildroot}/%{_localstatedir}/cache/%{name} +%{__mkdir_p} -m 0755 %{buildroot}/%{_localstatedir}/lib/%{name} %{__mkdir_p} -m 0755 %{buildroot}%{_sysconfdir}/httpd/conf.d %{__mkdir_p} -m 0755 %{buildroot}/%{_sysconfdir}/%{name}/ %{__mkdir_p} -m 0755 %{buildroot}/%{_sysconfdir}/%{name}/conf.d %{__mkdir_p} -m 0755 %{buildroot}/%{_sysconfdir}/init.d/ +%{__mkdir_p} -m 0755 %{buildroot}/%{_var}/log/%{name}
-%{__install} production/*.* %{buildroot}%{_datadir}/%{name}/production/ -%{__install} production/apache/* %{buildroot}%{_datadir}/%{name}/production/apache -%{__install} production/apache/moksha.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/ -%{__install} production/nginx/* %{buildroot}%{_datadir}/%{name}/production/nginx -%{__install} production/rabbitmq/* %{buildroot}%{_datadir}/%{name}/production/rabbitmq + +%{__install} -m 0644 production/*.* %{buildroot}%{_datadir}/%{name}/production/ +%{__install} -m 0644 production/apache/* %{buildroot}%{_datadir}/%{name}/production/apache +%{__install} -m 0644 production/apache/moksha.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/ +%{__install} -m 0644 production/nginx/* %{buildroot}%{_datadir}/%{name}/production/nginx +%{__install} -m 0644 production/rabbitmq/*.patch %{buildroot}%{_datadir}/%{name}/production/rabbitmq +%{__install} -m 0755 production/rabbitmq/run %{buildroot}%{_datadir}/%{name}/production/rabbitmq %{__cp} production/sample-production.ini %{buildroot}%{_sysconfdir}/%{name}/sample-production.ini %{__cp} development.ini %{buildroot}%{_sysconfdir}/%{name}/development.ini %{__sed} -i -e 's/$VERSION/%{version}/g' %{buildroot}%{_sysconfdir}/%{name}/sample-production.ini @@ -115,6 +120,10 @@ make -C docs html
%{__install} production/moksha-hub %{buildroot}%{_bindir}/moksha-hub %{__install} production/moksha-hub.init %{buildroot}%{_sysconfdir}/init.d/moksha-hub +%{__rm} %{buildroot}%{_datadir}/%{name}/production/moksha-hub.init + +%{__install} -d -m 0755 %{buildroot}/var/run/%{name} +
%check PYTHONPATH=$(pwd) paver test @@ -126,6 +135,10 @@ PYTHONPATH=$(pwd) paver test %{__rm} -r %{buildroot}%{python_sitelib}/%{name}/apps/demo
+%post +/sbin/chkconfig --add moksha-hub + + %post server semanage fcontext -a -t httpd_cache_t '/var/cache/moksha(/.*)?' restorecon -Rv /var/cache/moksha @@ -133,6 +146,17 @@ restorecon -Rv /var/cache/moksha %clean %{__rm} -rf %{buildroot}
+%pre +%{_sbindir}/groupadd -r %{name} &>/dev/null || : +%{_sbindir}/useradd -r -s /sbin/nologin -d %{_datadir}/%{name} -M \ + -c 'Moksha' -g %{name} %{name} &>/dev/null || : + + +%preun +if [ $1 -eq 0 ]; then + /sbin/service moksha-hub stop >/dev/null 2>&1 + /sbin/chkconfig --del moksha-hub +fi
%files %defattr(-,root,root,-) @@ -143,6 +167,9 @@ restorecon -Rv /var/cache/moksha %{python_sitelib}/%{name}/ %{python_sitelib}/%{name}-%{version}-py%{pyver}.egg-info/ %attr(-,apache,apache) %dir %{_localstatedir}/lib/%{name} +%attr(0755,root,%{name}) %dir %{_var}/log/%{name} +%ghost %attr(755, %{name}, %{name}) /var/run/%{name} +
%files server %defattr(-,root,root,-) @@ -152,11 +179,17 @@ restorecon -Rv /var/cache/moksha %config(noreplace) %{_sysconfdir}/%{name}/orbited.cfg %attr(-,apache,apache) %dir %{_localstatedir}/cache/%{name}/
-%files docs +%files doc %defattr(-,root,root) %doc docs/_build/html
%changelog +* Tue Dec 14 2010 Luke Macken lmacken@redhat.com - 0.5.0-3 +- Handle ghosting /var/run/moksha +- Setup a log directory +- Get the moksha-hub init script working properly +- A variety of specfile cleanups from our package review (#661902) + * Fri Dec 10 2010 Luke Macken lmacken@redhat.com - 0.5.0-2 - Fix our Source URL - Fix files-attr-not-set rpmlint errors
commit 7a37b57cdcd9d55ff4ed6361ac1fe3567929fd9f Author: Luke Macken lmacken@redhat.com Date: Fri Dec 10 17:55:26 2010 -0500
Minor permission and file cleanups
diff --git a/moksha/api/widgets/buttons/static/images/default/.DS_Store b/moksha/api/widgets/buttons/static/images/default/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/moksha/api/widgets/buttons/static/images/default/.DS_Store and /dev/null differ diff --git a/moksha/api/widgets/buttons/static/images/orange/.DS_Store b/moksha/api/widgets/buttons/static/images/orange/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/moksha/api/widgets/buttons/static/images/orange/.DS_Store and /dev/null differ diff --git a/moksha/widgets/blueprint/static/plugins/sprites/sprite.css b/moksha/widgets/blueprint/static/plugins/sprites/sprite.css old mode 100755 new mode 100644 diff --git a/moksha/widgets/blueprint/static/src/grid.css b/moksha/widgets/blueprint/static/src/grid.css old mode 100755 new mode 100644 diff --git a/moksha/widgets/blueprint/static/src/print.css b/moksha/widgets/blueprint/static/src/print.css old mode 100755 new mode 100644 diff --git a/moksha/widgets/blueprint/static/src/reset.css b/moksha/widgets/blueprint/static/src/reset.css old mode 100755 new mode 100644
moksha-commits@lists.fedorahosted.org