lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 8/1/05, Javier Guerra <javier@guerrag.com> wrote:
> On Monday 01 August 2005 7:05 am, Mukhsein Johari wrote:
> > Hello all,
> >
> > I sent an earlier email about xavante configuration but it did not
> > seem to get into the mailing list. I'm sending another email here.
> 
> it did got here, but found me at a busy time, and i think andre is still
> somewhere else.

Sorry about that, Javier. Gmail was hiding that fact from me :-/
Normally, mail to this list is displayed under my Lua label, it was
not capturing my earlier post to the list.
I was aware that you guys are busy with the conferences and all. I
honestly didn't mean to be annoying.

> > My question / request is how do I run another (user) instance of
> > xavante running on non-privileged port. There's a configuration option
> > to set the [web] dir but not the [conf] dir in server_start.lua
> 
> there's no 'config dir'; 

Uhm...I'm a bit confused now. In the config (not config.lua file):
-------------------
# System's executables directory (where binary or script executables
are installed)
BIN_DIR= /usr/local/bin

XAVANTE_HOME= /usr/local/kepler
XAVANTE_LUA = $(XAVANTE_HOME)/lua
XAVANTE_CONF = $(XAVANTE_HOME)/conf
XAVANTE_WEB = $(XAVANTE_HOME)/web
------------------

It seems to say that there is indeed a "conf dir", just as there is a
"web dir". This is where the default kepler/xavante stuff is place on
"make install". This is exactly what I want for production - run on
port 80, base web dir on /usr/local/kepler/web. Cool.

However, for development, I'd like to start and stop another process running off

/home/mukhsein/kepler               (the xavante base)
  /home/mukhsein/kepler/conf
  /home/mukhsein/kepler/web      (the webdir)

using it's own "start_server.lua" so that I can avoid editing any of
the original source files (in their original locations). I'd only need
to copy the /usr/local/kepler tree to my home dir and edit the copies
of kepler/conf/config.lua and start_server.lua

So to run my own (user) server:
cd kepler
lua start_server.lua

In fact, this is also to allow other developers on the same host to
maintain and run their own xavante using their own configs without
needing to allow them to edit xavante's 'system' files or having to do
it for them.

> the start() function in server.lua does a
> pcall(require, "xavante.config").  you can put any lua code in
> xavante/config.lua, for example, it can load another config file anywhere
> else you want.

This is what I want to avoid.
 
> and for creating several instances, you can choose between running several
> separate processes, or calling xavante.HTTP{} several times:
> 
> xavante.HTTP{
>     server = {host = "*", port = 4080},
> 
>     defaultHost = {
>         rules = rulesetA
>     },
> }
> 
> xavante.HTTP{
>     server = {host = "*", port = 4082},
> 
>     defaultHost = {
>         rules = rulesetB
>     },
>     ["web2"] = {
>         rules = rulesetC
>     }
> }
> 
> here, we have three 'instances' one in port 4080, and two in port 4082.  in
> the second port, it uses 'virtual servers' to discriminate, based on the
> server name used in the queries.

But this means whenever a new user wants to run his own xavante, I'd
have to edit /usr/local/kepler/conf/config.lua to add their virtual
host and restart xavante.
 
> BTW, i don't like the 'setwebdir' methodology.  all it does is define what
> xavante.webdir() will return, so it can be used in the config file; but it's
> (for me, at least) just as easy to set baseDir in the rulesets.
> 

But the (non-default) rulesets are defined in kepler/conf/config.lua,
right? How do I instruct xavante to use:
/home/mukhsein/kepler/conf/config.lua

instead of: 
/usr/local/kepler/conf/config.lua

in my own 'local' 
/home/mukhsein/kepler/server_start.lua

Erm. Sorry if I'm not making much sense. Is there a better way to do
what I need to do (that avoids editing original source files)? You
might be wondering why this preoccupation with avoiding editing
original source files. Well, this is so that any problems experienced
by the developers can be localized to individual developer's configs
(we might want to experiment with rulesets, for example) without
affecting the production xavante (on port 80,
webdir:/usr/local/kepler/web) or any other developer's running
instance.

-- 
Regards,

Mukhsein