Hello, I forked the sweet Substruct and applied Advanced Recipe 83: I associate a different shop (separate database) to each ''installation'' according to the subdomain the application is accessed from. Do you think it makes sense? Basically AR queries main database once to fetch ''installation'' object and connects to installation.database if the subdomain is configured or loads the demo database/shop instead. It seems a good idea (to me) to keep every (admin) account clearly separated and it''s by far easier not to completely re-write Substruct logic to manage more than one admin. Passenger on dreamhost. -- Emanuele Tozzato +1 (619) 549 3230 4955 Narragansett Ave Apt #9 San Diego Ca 92107-3157 http://mekdigital.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> the demo database/shop instead. It seems a good idea (to me) to keep > every > (admin) account clearly separated and it''s by far easier not to > completely > re-write Substruct logic to manage more than one admin. Passenger on > dreamhost.Sounds good to me if you can manage it :) -=R -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
So where''s the fork? -------------------- seth - subimage llc ----- http://sublog.subimage.com ----- Cashboard - Estimates, invoices, and time tracking software - for free! http://www.getcashboard.com ----- Substruct - Open source RoR e-commerce software. http://code.google.com/p/substruct/ On Wed, Sep 17, 2008 at 11:17 AM, Emanuele Tozzato <etozzato-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, > I forked the sweet Substruct and applied Advanced Recipe 83: I associate a > different shop (separate database) to each ''installation'' according to the > subdomain the application is accessed from. Do you think it makes sense? > Basically AR queries main database once to fetch ''installation'' object and > connects to installation.database if the subdomain is configured or loads > the demo database/shop instead. It seems a good idea (to me) to keep every > (admin) account clearly separated and it''s by far easier not to completely > re-write Substruct logic to manage more than one admin. Passenger on > dreamhost. > > -- > Emanuele Tozzato > +1 (619) 549 3230 > 4955 Narragansett Ave Apt #9 > San Diego Ca 92107-3157 > http://mekdigital.com > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ayyanar Aswathaman
2008-Sep-18 05:38 UTC
Re: About: multi database performance on Substruct
Why you need to go for the isolated database for each tenant (shop)? What are all the advantages and disadvantages of this? How you will achieve this technically in ROR application? How the active records will know what connection to use? Just curious to know since we are also analyzing deep in what are all the pros and cons in using the isolated database for each tenant. We have some thought on this design. Just curious to know what others are thinking on this. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Wed, Sep 17, 2008 at 10:38 PM, Ayyanar Aswathaman < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Why you need to go for the isolated database for each tenant (shop)?I''m trying to add multi admin/shop support to the application and, seen the original database structure, it seems easier just to use one database for each shop.> > What are all the advantages and disadvantages of this?This is what I''m trying to find out. So far, so good but I didn''t see any other application dealing with multiple database and when you''re the only one you''re usually on the wrong path!> how you will achieve this technically in ROR application? How the active > records will know what connection to use?This is quite easy: using subdomains for shops I just ask AcriveRecord to connect to the ''current'' database, basically every database is a copy of the original one, I wrote some new rake code (and found out later that I''m not allowed to script-create database, but this is another story!) There is only one model, ''Installation'' that always connects to the main database and it''s used to switch between shops. I''m trying to find out if shop switch can create a mess, but everything is okay by far.. @installation = Installation.for(request.host, request.subdomains) ... ActiveRecord::Base.establish_connection(:adapter => "mysql", :host => "localhost", :username => "root", :password => "", :database => @installation.database) ... see http://mek.venicebuy.eu/ and http://usul.venicebuy.eu/ are running online> Just curious to know since we are also analyzing deep in what are all > the pros and cons in using the isolated database for each tenant. We > have some thought on this design. Just curious to know what others are > thinking on this.I wish I could see this application with heavy load and we could understand! :)> -- > Posted via http://www.ruby-forum.com/. > > > >-- Emanuele Tozzato +1 (619) 549 3230 4955 Narragansett Ave Apt #9 San Diego Ca 92107-3157 http://mekdigital.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ayyanar Aswathaman
2008-Sep-23 06:32 UTC
Re: About: multi database performance on Substruct
Thanks Emanuele. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ayyanar Aswathaman
2008-Sep-23 06:38 UTC
Re: About: multi database performance on Substruct
How you do the authentication and authorization in your multi-tenant application? Are you using any authentication and authorization plug-ins? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m using the normal Substruct authorization methods: each subdomain not only load the appropriate database (and every admin has his own password for his db), but alsocreate a different session and things stay clean and work (so far)! On Mon, Sep 22, 2008 at 11:38 PM, Ayyanar Aswathaman < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > How you do the authentication and authorization in your multi-tenant > application? Are you using any authentication and authorization > plug-ins? > -- > Posted via http://www.ruby-forum.com/. > > > >-- Emanuele Tozzato +1 (619) 549 3230 4955 Narragansett Ave Apt #9 San Diego Ca 92107-3157 http://mekdigital.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I''m trying to add multi admin/shop support to the application and, seen > the > original database structure, it seems easier just to use one database > for > each shop.Also checkout http://tomayko.com/writings/rails-multiple-connections and Dr. nic''s magic multi connections :) -=R -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---