Merb Init Script

Rogelio J. Samour rogelio.samour at gmail.com
Tue Jan 23 16:47:59 EST 2007


OK. Here's the deal:

merb -m /path/to/merb/app does not work like I expect. Meaning, it starts
merb with the defaults and not with whatever is  in
MERB_ROOT/dist/conf/merb.yml ... I looked at the lib/merb/merb_server.rb
code and the options hash is never loaded again (with the merb.yml) after
the initial setup method. This setup method tries to load merb.yml based on
the PWD which is not the merb_app root.

Check out the patch which adds a -z or --merb-config
/path/to/merbapp/dist/conf/merb.yml
[From the patch]:
+        # Added by: Rogelio J. Samour 2007-01-23
+        # We need to reload the options that exist in the App's merb.yml
+        # This is needed when one calls merb NOT from the merb_app ROOT
+        # like so: merb --merb-config /path/to/dist/conf/merb.yml -m
/path/to/merb/app
+        # or if we add :merb_root: /path/to/merb/app in the merb.yml we can
now only call it
+        # like so: merb --merb-config /path/to/dist/conf/merb.yml

This allows me to potentially have several merb apps running on a server...
then I can create symlinks to /etc/merb/<symlinks to merb.yml files> and
loop through those... starting and stopping those...

I also attached an init.d script that does this for just one merb app for
now... but can be easily hacked into multiple. :)

Let me know what you guys think. Good or bad. You won't hurt my feelings.

thanks & laters,

-rogelio-




On 1/19/07, Rogelio J. Samour <rogelio.samour at gmail.com> wrote:
>
> Ha! OK. I guess I could just write one init.d script that starts and
> stops the _one_ merb app I have in that box. I was just thinking in
> future terms.
>
> thanks though!
>
> -rjs-
>
> On Fri, 2007-01-19 at 11:47 -0800, Ezra Zygmuntowicz wrote:
> >       Do you have more then one merb app? I usually don't like to put
> more
> > then one app per init.d script. But if you do need to put them all in
> > one init.d script. I think the best way woudl be top place a shell
> > script somewhere that can start all yoru merbs appropriately. ANd
> > then just have the init.d script call that shell script.
> >
> >       Or even better yet, use monit instead of init.d scripts ;)
> >
> > -Ezra
> >
> >
> > On Jan 19, 2007, at 11:42 AM, Rogelio J. Samour wrote:
> >
> > > Correct but if I wanted to do a /etc/merb/merb_app1.yml
> > > and /etc/merb/merb_app2.yml each of which are symbolic links to each
> > > app's /path/to/dist/conf/merb.yml
> > >
> > > Then I could do a /etc/init.d/merb restart and restart all of merb
> > > apps.
> > >
> > > I guess my question would be: is this a good idea and a possible one?
> > >
> > > -rjs-
> > >
> > > On Fri, 2007-01-19 at 11:35 -0800, Ezra Zygmuntowicz wrote:
> > >> On Jan 19, 2007, at 8:04 AM, Rogelio J. Samour wrote:
> > >>
> > >>> I'm trying to emulate the mongrel_cluster_ctl but it takes a -c
> > >>> conf_file option... meaning I can run it from anywhere as long as I
> > >>> tell it where the conf file is. Merb doesn't have that capability
> > >>> does
> > >>> it? (it has an additional/supplemental config like mup.conf etc)
> > >>>
> > >>> Do I have to be under the merb_app root /path/to/merb/app/ to be
> > >>> able
> > >>> to run merb?
> > >>>
> > >>> Let me know.
> > >>>
> > >>> Thanks,
> > >>>
> > >>> rogelio
> > >>
> > >>
> > >>    No you don't have to be in the merb apps root. You can pass merb
> > >> root as a command line flag:
> > >>
> > >> $ merb -m /path/to/merbapp
> > >>
> > >>
> > >> Cheers-
> > >> -- Ezra Zygmuntowicz
> > >> -- Lead Rails Evangelist
> > >> -- ez at engineyard.com
> > >> -- Engine Yard, Serious Rails Hosting
> > >> -- (866) 518-YARD (9273)
> > >>
> > >>
> > >
> >
> > -- Ezra Zygmuntowicz
> > -- Lead Rails Evangelist
> > -- ez at engineyard.com
> > -- Engine Yard, Serious Rails Hosting
> > -- (866) 518-YARD (9273)
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070123/424ee1b3/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_merb_conf.patch
Type: text/x-patch
Size: 1999 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/merb-devel/attachments/20070123/424ee1b3/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: merb_init
Type: application/octet-stream
Size: 1003 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/merb-devel/attachments/20070123/424ee1b3/attachment-0001.obj 


More information about the Merb-devel mailing list