Alan Pevec
2008-Aug-05 21:50 UTC
[Ovirt-devel] [PATCH] set RAILS_ENV for all services in common /etc/sysconfig/ovirt-rails
Signed-off-by: Alan Pevec <apevec at redhat.com> --- wui/conf/ovirt-host-browser | 4 ++++ wui/conf/ovirt-host-collect | 4 ++++ wui/conf/ovirt-host-status | 4 ++++ wui/conf/ovirt-mongrel-rails | 8 +++++--- wui/conf/ovirt-mongrel-rails.sysconf | 4 ---- wui/conf/ovirt-rails.sysconf | 3 +++ wui/conf/ovirt-taskomatic | 4 ++++ wui/ovirt-wui.spec | 2 ++ 8 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 wui/conf/ovirt-rails.sysconf diff --git a/wui/conf/ovirt-host-browser b/wui/conf/ovirt-host-browser index 5e7fdae..892b155 100755 --- a/wui/conf/ovirt-host-browser +++ b/wui/conf/ovirt-host-browser @@ -8,6 +8,10 @@ # ovirt VM manager. # +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails + +export RAILS_ENV="${RAILS_ENV:-production}" + DAEMON=/usr/share/ovirt-wui/host-browser/host-browser.rb . /etc/init.d/functions diff --git a/wui/conf/ovirt-host-collect b/wui/conf/ovirt-host-collect index 2d8ffcd..63e667a 100755 --- a/wui/conf/ovirt-host-collect +++ b/wui/conf/ovirt-host-collect @@ -8,6 +8,10 @@ # ovirt VM manager. # +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails + +export RAILS_ENV="${RAILS_ENV:-production}" + DAEMON=/usr/share/ovirt-wui/host-collect/host-collect.rb . /etc/init.d/functions diff --git a/wui/conf/ovirt-host-status b/wui/conf/ovirt-host-status index 7804163..1757295 100755 --- a/wui/conf/ovirt-host-status +++ b/wui/conf/ovirt-host-status @@ -8,6 +8,10 @@ # ovirt VM manager. # +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails + +export RAILS_ENV="${RAILS_ENV:-production}" + DAEMON=/usr/share/ovirt-wui/host-status/host-status.rb . /etc/init.d/functions diff --git a/wui/conf/ovirt-mongrel-rails b/wui/conf/ovirt-mongrel-rails index 7cfaf2d..498e2bf 100755 --- a/wui/conf/ovirt-mongrel-rails +++ b/wui/conf/ovirt-mongrel-rails @@ -8,13 +8,15 @@ # ovirt VM manager. # +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails + [ -r /etc/sysconfig/ovirt-mongrel-rails ] && . /etc/sysconfig/ovirt-mongrel-rails +RAILS_ENV="${RAILS_ENV:-production}" OVIRT_DIR="${OVIRT_DIR:-/usr/share/ovirt-wui}" MONGREL_LOG="${MONGREL_LOG:-/var/log/ovirt-wui/mongrel.log}" MONGREL_PID="${MONGREL_PID:-/var/run/ovirt-wui/mongrel.pid}" MONGREL_LOCKFILE="${MONGREL_LOCKFILE:-/var/lock/subsys/ovirt-wui}" -RAILS_ENVIRONMENT="${RAILS_ENVIRONMENT:-production}" USER="${USER:-ovirt}" GROUP="${GROUP:-ovirt}" PREFIX="${PREFIX:-/ovirt}" @@ -29,9 +31,9 @@ RETVAL=0 start() { echo -n "Starting ovirt-mongrel-rails: " - RAILS_ENV=$RAILS_ENVIRONMENT $REINDEX_PROG + RAILS_ENV=$RAILS_EN $REINDEX_PROG $MONGREL_PROG start -c $OVIRT_DIR -l $MONGREL_LOG -P $MONGREL_PID \ - -a $ADDR -e $RAILS_ENVIRONMENT --user $USER --group $GROUP \ + -a $ADDR -e $RAILS_ENV --user $USER --group $GROUP \ -d --prefix=$PREFIX RETVAL=$? if [ $RETVAL -eq 0 ] && touch $MONGREL_LOCKFILE ; then diff --git a/wui/conf/ovirt-mongrel-rails.sysconf b/wui/conf/ovirt-mongrel-rails.sysconf index 80ac0e6..ce43383 100644 --- a/wui/conf/ovirt-mongrel-rails.sysconf +++ b/wui/conf/ovirt-mongrel-rails.sysconf @@ -10,10 +10,6 @@ # location of the file containing running process ID #MONGREL_PID=/var/run/ovirt-wui/mongrel.pid -# sets ruby on Rails environment / mode of operation -# http://wiki.rubyonrails.org/rails/pages/Environments -#RAILS_ENVIRONMENT=production - # user and group under which Rails application runs #USER=ovirt #GROUP=ovirt diff --git a/wui/conf/ovirt-rails.sysconf b/wui/conf/ovirt-rails.sysconf new file mode 100644 index 0000000..bc9e237 --- /dev/null +++ b/wui/conf/ovirt-rails.sysconf @@ -0,0 +1,3 @@ +# sets ruby on Rails environment / mode of operation +# http://wiki.rubyonrails.org/rails/pages/Environments +#RAILS_ENV=production diff --git a/wui/conf/ovirt-taskomatic b/wui/conf/ovirt-taskomatic index 2f9b255..2e548b4 100755 --- a/wui/conf/ovirt-taskomatic +++ b/wui/conf/ovirt-taskomatic @@ -8,6 +8,10 @@ # ovirt VM manager. # +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails + +export RAILS_ENV="${RAILS_ENV:-production}" + DAEMON=/usr/share/ovirt-wui/task-omatic/taskomatic.rb . /etc/init.d/functions diff --git a/wui/ovirt-wui.spec b/wui/ovirt-wui.spec index 9dda52a..7746430 100644 --- a/wui/ovirt-wui.spec +++ b/wui/ovirt-wui.spec @@ -79,6 +79,7 @@ touch %{buildroot}%{_localstatedir}/log/%{name}/host-status.log %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-collect %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails %{buildroot}%{_initrddir} %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/ovirt-mongrel-rails +%{__install} -Dp -m0755 %{pbuild}/conf/ovirt-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/ovirt-rails %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-taskomatic %{buildroot}%{_initrddir} # copy over all of the src directory... @@ -171,6 +172,7 @@ fi %{_initrddir}/ovirt-mongrel-rails %{_initrddir}/ovirt-taskomatic %config(noreplace) %{_sysconfdir}/sysconfig/ovirt-mongrel-rails +%config(noreplace) %{_sysconfdir}/sysconfig/ovirt-rails %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %doc %attr(-, ovirt, ovirt) %{_localstatedir}/lib/%{name} -- 1.5.4.1
Scott Seago
2008-Aug-06 13:56 UTC
[Ovirt-devel] [PATCH] set RAILS_ENV for all services in common /etc/sysconfig/ovirt-rails
Alan Pevec wrote:> diff --git a/wui/conf/ovirt-mongrel-rails b/wui/conf/ovirt-mongrel-rails > index 7cfaf2d..498e2bf 100755 > --- a/wui/conf/ovirt-mongrel-rails > +++ b/wui/conf/ovirt-mongrel-rails > @@ -29,9 +31,9 @@ RETVAL=0 > start() { > echo -n "Starting ovirt-mongrel-rails: " > > - RAILS_ENV=$RAILS_ENVIRONMENT $REINDEX_PROG > + RAILS_ENV=$RAILS_EN $REINDEX_PROG >Typo here? $RAILS_EN should be $RAILS_ENV> $MONGREL_PROG start -c $OVIRT_DIR -l $MONGREL_LOG -P $MONGREL_PID \ > - -a $ADDR -e $RAILS_ENVIRONMENT --user $USER --group $GROUP \ > + -a $ADDR -e $RAILS_ENV --user $USER --group $GROUP \ > -d --prefix=$PREFIX > RETVAL=$? > if [ $RETVAL -eq 0 ] && touch $MONGREL_LOCKFILE ; then >Scott
Steve Linabery
2008-Aug-06 16:50 UTC
[Ovirt-devel] [PATCH] set RAILS_ENV for all services in common /etc/sysconfig/ovirt-rails
On Tue, Aug 05, 2008 at 11:50:52PM +0200, Alan Pevec wrote:> Signed-off-by: Alan Pevec <apevec at redhat.com> > --- > wui/conf/ovirt-host-browser | 4 ++++ > wui/conf/ovirt-host-collect | 4 ++++ > wui/conf/ovirt-host-status | 4 ++++ > wui/conf/ovirt-mongrel-rails | 8 +++++--- > wui/conf/ovirt-mongrel-rails.sysconf | 4 ---- > wui/conf/ovirt-rails.sysconf | 3 +++ > wui/conf/ovirt-taskomatic | 4 ++++ > wui/ovirt-wui.spec | 2 ++ > 8 files changed, 26 insertions(+), 7 deletions(-) > create mode 100644 wui/conf/ovirt-rails.sysconf > > diff --git a/wui/conf/ovirt-host-browser b/wui/conf/ovirt-host-browser > index 5e7fdae..892b155 100755 > --- a/wui/conf/ovirt-host-browser > +++ b/wui/conf/ovirt-host-browser > @@ -8,6 +8,10 @@ > # ovirt VM manager. > # > > +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails > + > +export RAILS_ENV="${RAILS_ENV:-production}" > + > DAEMON=/usr/share/ovirt-wui/host-browser/host-browser.rb > > . /etc/init.d/functions > diff --git a/wui/conf/ovirt-host-collect b/wui/conf/ovirt-host-collect > index 2d8ffcd..63e667a 100755 > --- a/wui/conf/ovirt-host-collect > +++ b/wui/conf/ovirt-host-collect > @@ -8,6 +8,10 @@ > # ovirt VM manager. > # > > +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails > + > +export RAILS_ENV="${RAILS_ENV:-production}" > + > DAEMON=/usr/share/ovirt-wui/host-collect/host-collect.rb > > . /etc/init.d/functions > diff --git a/wui/conf/ovirt-host-status b/wui/conf/ovirt-host-status > index 7804163..1757295 100755 > --- a/wui/conf/ovirt-host-status > +++ b/wui/conf/ovirt-host-status > @@ -8,6 +8,10 @@ > # ovirt VM manager. > # > > +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails > + > +export RAILS_ENV="${RAILS_ENV:-production}" > + > DAEMON=/usr/share/ovirt-wui/host-status/host-status.rb > > . /etc/init.d/functions > diff --git a/wui/conf/ovirt-mongrel-rails b/wui/conf/ovirt-mongrel-rails > index 7cfaf2d..498e2bf 100755 > --- a/wui/conf/ovirt-mongrel-rails > +++ b/wui/conf/ovirt-mongrel-rails > @@ -8,13 +8,15 @@ > # ovirt VM manager. > # > > +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails > + > [ -r /etc/sysconfig/ovirt-mongrel-rails ] && . /etc/sysconfig/ovirt-mongrel-rails > > +RAILS_ENV="${RAILS_ENV:-production}" > OVIRT_DIR="${OVIRT_DIR:-/usr/share/ovirt-wui}" > MONGREL_LOG="${MONGREL_LOG:-/var/log/ovirt-wui/mongrel.log}" > MONGREL_PID="${MONGREL_PID:-/var/run/ovirt-wui/mongrel.pid}" > MONGREL_LOCKFILE="${MONGREL_LOCKFILE:-/var/lock/subsys/ovirt-wui}" > -RAILS_ENVIRONMENT="${RAILS_ENVIRONMENT:-production}" > USER="${USER:-ovirt}" > GROUP="${GROUP:-ovirt}" > PREFIX="${PREFIX:-/ovirt}" > @@ -29,9 +31,9 @@ RETVAL=0 > start() { > echo -n "Starting ovirt-mongrel-rails: " > > - RAILS_ENV=$RAILS_ENVIRONMENT $REINDEX_PROG > + RAILS_ENV=$RAILS_EN $REINDEX_PROG > $MONGREL_PROG start -c $OVIRT_DIR -l $MONGREL_LOG -P $MONGREL_PID \ > - -a $ADDR -e $RAILS_ENVIRONMENT --user $USER --group $GROUP \ > + -a $ADDR -e $RAILS_ENV --user $USER --group $GROUP \ > -d --prefix=$PREFIX > RETVAL=$? > if [ $RETVAL -eq 0 ] && touch $MONGREL_LOCKFILE ; then > diff --git a/wui/conf/ovirt-mongrel-rails.sysconf b/wui/conf/ovirt-mongrel-rails.sysconf > index 80ac0e6..ce43383 100644 > --- a/wui/conf/ovirt-mongrel-rails.sysconf > +++ b/wui/conf/ovirt-mongrel-rails.sysconf > @@ -10,10 +10,6 @@ > # location of the file containing running process ID > #MONGREL_PID=/var/run/ovirt-wui/mongrel.pid > > -# sets ruby on Rails environment / mode of operation > -# http://wiki.rubyonrails.org/rails/pages/Environments > -#RAILS_ENVIRONMENT=production > - > # user and group under which Rails application runs > #USER=ovirt > #GROUP=ovirt > diff --git a/wui/conf/ovirt-rails.sysconf b/wui/conf/ovirt-rails.sysconf > new file mode 100644 > index 0000000..bc9e237 > --- /dev/null > +++ b/wui/conf/ovirt-rails.sysconf > @@ -0,0 +1,3 @@ > +# sets ruby on Rails environment / mode of operation > +# http://wiki.rubyonrails.org/rails/pages/Environments > +#RAILS_ENV=production > diff --git a/wui/conf/ovirt-taskomatic b/wui/conf/ovirt-taskomatic > index 2f9b255..2e548b4 100755 > --- a/wui/conf/ovirt-taskomatic > +++ b/wui/conf/ovirt-taskomatic > @@ -8,6 +8,10 @@ > # ovirt VM manager. > # > > +[ -r /etc/sysconfig/ovirt-rails ] && . /etc/sysconfig/ovirt-rails > + > +export RAILS_ENV="${RAILS_ENV:-production}" > + > DAEMON=/usr/share/ovirt-wui/task-omatic/taskomatic.rb > > . /etc/init.d/functions > diff --git a/wui/ovirt-wui.spec b/wui/ovirt-wui.spec > index 9dda52a..7746430 100644 > --- a/wui/ovirt-wui.spec > +++ b/wui/ovirt-wui.spec > @@ -79,6 +79,7 @@ touch %{buildroot}%{_localstatedir}/log/%{name}/host-status.log > %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-host-collect %{buildroot}%{_initrddir} > %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails %{buildroot}%{_initrddir} > %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-mongrel-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/ovirt-mongrel-rails > +%{__install} -Dp -m0755 %{pbuild}/conf/ovirt-rails.sysconf %{buildroot}%{_sysconfdir}/sysconfig/ovirt-rails > %{__install} -Dp -m0755 %{pbuild}/conf/ovirt-taskomatic %{buildroot}%{_initrddir} > > # copy over all of the src directory... > @@ -171,6 +172,7 @@ fi > %{_initrddir}/ovirt-mongrel-rails > %{_initrddir}/ovirt-taskomatic > %config(noreplace) %{_sysconfdir}/sysconfig/ovirt-mongrel-rails > +%config(noreplace) %{_sysconfdir}/sysconfig/ovirt-rails > %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf > %doc > %attr(-, ovirt, ovirt) %{_localstatedir}/lib/%{name} > -- > 1.5.4.1 > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel"${RAILS_ENV:-production}"--I haven't seen that syntax before: ${FOO:-bar} What does it do? My main comment: is there any reason to put the appliance *partly* in test mode, *partly* in production mode? If not, could we move this to a config file which all these init scripts can source? Thanks, Steve