Add an rc script so that the dashboard can be easily started.

This commit is contained in:
ajacoutot 2013-03-13 10:16:12 +00:00
parent 735feab5d5
commit 09dd607a0b
4 changed files with 38 additions and 16 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.14 2013/03/12 10:59:50 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.15 2013/03/13 10:16:12 ajacoutot Exp $
COMMENT= overview of your Puppet ecosystem
DISTNAME= puppet-dashboard-1.2.22
CATEGORIES= www sysutils
REVISION= 0
REVISION= 1
HOMEPAGE= https://puppetlabs.com/puppet/related-projects/dashboard/
@ -27,7 +27,7 @@ NO_TEST= Yes
PREFIX= /var/www
INSTDIR= ${PREFIX}/puppet-dashboard
SUBST_VARS= INSTDIR MODRUBY_BINREV
SUBST_VARS= INSTDIR MODRUBY_BINREV RUBY
pre-configure:
cd ${WRKSRC} && grep -Elr 'env.*ruby' . | \

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.6 2013/03/12 10:44:50 ajacoutot Exp $
@comment $OpenBSD: PLIST,v 1.7 2013/03/13 10:16:13 ajacoutot Exp $
@newgroup _puppet-dashboard:713
@newuser _puppet-dashboard:713:713:daemon:Puppet Dashboard:/var/empty:/sbin/nologin
@owner _puppet-dashboard
@ -5020,3 +5020,4 @@ puppet-dashboard/vendor/rails/railties/railties.gemspec
@group
@cwd ${LOCALBASE}/share/doc/pkg-readmes
${FULLPKGNAME}
@rcscript ${RCDIR}/puppet_dashboard

View File

@ -1,4 +1,4 @@
$OpenBSD: README,v 1.3 2013/03/12 10:59:50 ajacoutot Exp $
$OpenBSD: README,v 1.4 2013/03/13 10:16:13 ajacoutot Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
@ -34,20 +34,11 @@ following command must be run to create the tables:
Note that this command *must* also be run after a Puppet Dashboard
upgrade.
Running the Dashboard
=====================
These commands will start a Rails server on port 3000 then start the
delayed job workers to asynchronously process resource-intensive tasks.
They can be added to rc.conf.local(5) to start Puppet Dashboard at boot
time.
# cd ${INSTDIR} && sudo -u _puppet-dashboard ./script/server -d -e production 2>/dev/null
# cd ${INSTDIR} && sudo -u _puppet-dashboard env RAILS_ENV=production script/delayed_job -p dashboard -n 4 -m start 2>/dev/null
Puppet Configuration
====================
By default, Puppet Dashboard will start a Rails server on port 3000.
To use the Dashboard for reports, all agent nodes must submit reports to
the master and the master must send reports to the Dashboard.
${SYSCONFDIR}/puppet/puppet.conf needs to be edited accordingly:

View File

@ -0,0 +1,30 @@
#!/bin/sh
#
# $OpenBSD: puppet_dashboard.rc,v 1.1 2013/03/13 10:16:13 ajacoutot Exp $
daemon="./script/server -d"
daemon_flags="-e production"
daemon_user="_puppet-dashboard"
. /etc/rc.d/rc.subr
pexp="(${RUBY} ${daemon}${daemon_flags:+ ${daemon_flags}}|ruby${MODRUBY_BINREV}:.*delayed_job)"
rc_reload=NO
rc_check() {
pgrep -u ${daemon_user} -f "^${pexp}"
}
rc_start() {
${rcexec} "cd ${INSTDIR} && \
${daemon} ${daemon_flags}" || return 1
sleep 1
${rcexec} "cd ${INSTDIR} && \
env RAILS_ENV=production script/delayed_job -p dashboard -n 4 -m start"
}
rc_stop() {
pkill -INT -u ${daemon_user} -f "^${pexp}"
}
rc_cmd $1