Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  Multitenant / SAAS config help

Guest
Posted: Wed Sep 05, 2007 12:30 pm Reply with quote
Guest
Hi guys I have need some advice on the best way forward with my
erlyweb app.

I would like to make my erlyweb app (called rel3) multitenant. That is
I would like to run it under Yaws using different sub urls. Obviously
I could add server configs (including appmod) into the Yaws.conf
file, but I need to do it on the fly without restarting yaws or
disturbing sessions within Yaws/rel3 instances. In other words I would
like to programatically bring up instances of rel3 (appmod) as I need
then. Each one should effectively be a yaws <server/> instance with
it's own Auth and docroot etc.. but sharing the same appmod codebase.

Anyone got any advice on how I would go about doing this? Or should I
do it another way?

PS I am not using a database at all as it's flat file based storage
etc..


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Sep 05, 2007 1:24 pm Reply with quote
Guest
Ok I think I have found a slightly simple way to do this in the
meantime. If I can get around the docroot and auth issues (which I
think I can) Then rather than having individual <server/> instances I
can use a single appmod.

in the <server/> definition in the yaws.conf rather than having
appmods = <"/rel3", erlyweb> use appmods = <rel3, erlyweb>. I can then
use paths like the following:

http://www.myserver.com/namespace/rel3/space/show/Index

I can then pick up the 'namespace' variant to act as my multitenant
identifier using A#arg.appmod_prepath = "/namespace/".

Obviously I need to be careful not to use 'rel3' (or whatever symbol I
choice) anywhere else in the path, but I can protect against that.

I amcreating a dynamic auth hadler anyhow so I can solve that, now my
issue is just any static stuff serverd on the namespace basis.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Thu Sep 06, 2007 7:21 am Reply with quote
Guest
Yes, I think the best strategy is, in rel3_app_controller:hook/1, to
read the 'namespace' parameter the arg's appmoddata field, and then
use it to modify the arg's 'docroot' field, etc., before passing the
arg down to ErlyWeb for further processing. You can also store in the
arg's 'opaque' field any other data that may be used by your
controllers to identify the application instance.

I hope I understood the problem and that this is of any help.

Yariv

On 9/5/07, Al <al@folknology.com> wrote:
>
> Ok I think I have found a slightly simple way to do this in the
> meantime. If I can get around the docroot and auth issues (which I
> think I can) Then rather than having individual <server/> instances I
> can use a single appmod.
>
> in the <server/> definition in the yaws.conf rather than having
> appmods = <"/rel3", erlyweb> use appmods = <rel3, erlyweb>. I can then
> use paths like the following:
>
> http://www.myserver.com/namespace/rel3/space/show/Index
>
> I can then pick up the 'namespace' variant to act as my multitenant
> identifier using A#arg.appmod_prepath = "/namespace/".
>
> Obviously I need to be careful not to use 'rel3' (or whatever symbol I
> choice) anywhere else in the path, but I can protect against that.
>
> I amcreating a dynamic auth hadler anyhow so I can solve that, now my
> issue is just any static stuff serverd on the namespace basis.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Thu Sep 06, 2007 9:03 am Reply with quote
Guest
Hi Yariv

On Sep 6, 8:20 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> Yes, I think the best strategy is, in rel3_app_controller:hook/1, to
> read the 'namespace' parameter the arg's appmoddata field, and then
> use it to modify the arg's 'docroot' field, etc., before passing the
> arg down to ErlyWeb for further processing. You can also store in the
> arg's 'opaque' field any other data that may be used by your
> controllers to identify the application instance.
>
> I hope I understood the problem and that this is of any help.
>
> Yariv
>

Yup you've got it. At the moment I am refactoring the code which had a
static namespace and paths enumerated in 'Define' statements. Once I
have factored those out (which control storage access) I will be
taking a look at the docroot issue. The docroot issue is a little more
complex however because the docroot along with a url path was being
used to automatically handle downloads of files in Yaws rather than
earlyweb which meant I didn't have to worry about content types and
streaming files etc.. I am also restructuring the data storage server
side to allow me to use Yaws and use a fixed docroot, having
namespaces underneath as subdirectories which may allow me to get away
with it, I will be putting the theory into practice over the next few
days. I 'll let you know how it works out.

PS if the namespace trick works I also get the advantage of using Yaws
webdav support which could be very useful, anyone used that yet?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum