Multi-tenant is possible?



  • Hi! First, I have to congratulates for this CMS, because it's fantastic. Now, I have a question, because I want to setup a multi-tenant websites. I want to have one unique installation of this CMS, and manage all the websites from here. Every website can have the same modules, but the information, of course, it's different. Another goal it's to have the same web structure for every website, but with modifications of the content (only content, structure must be the same (logo, navbar, slider, ...)

    For example, I want to have website1 with a Testimonial module, and website with Testimonial too, but every website have different Testimonial content. Every website, must be controller by different users, so user1 from website1, when logged in, can see only the website1 related modules and configuration.

    Can I do this with Asgard? If this is possible, can you give me some advices or guidelines to get it?

    Thanks!


  • Global Moderator

    @jesusvpct

    Hello,

    In short, yes everything is possible :)
    If you can do multi-tenant in php you can do it in Laravel and therefore you can do it also in Asgard.

    In reality there's quite work to be done to achieve that.
    There are several approaches one could take.

    From top of my head:

    • multiple databases - for each domain its own config folder + Module Loader module (probably trough middlewares)
    • single database - every entity has to know its web site(heavily modifying default modules) - Simple approach

    There are packages you could leverage/observe: Orchestral/Tenanti, Hyn/Multi-Tenant

    If time is no concern then definitely you could do that, but if time is factor i would go with some CMS that has this out-of-the-box. There's quite some CMS'es that can do that.



  • Ok, I see. I think that implementing it by my own it's too complicated.

    About the packages that you posted, I guess that it cannot be integrated by default, so I have to made modifications on Asgard on files to get it, Am I right?

    Thanks for your time and your explanation.


  • Global Moderator

    @jesusvpct

    In theory, you could scaffold new Asgard module and include orchestra one for example and setup config that way that you use tables other than default ones to store tenant relationships.
    You could try the approach of a single database using observers, so you would create tons of them for all the features that require per-site presence.

    But unfortunately i have never done multi-tenant product, so i can't quite advise you on exactly how to implement.



  • Thanks for your time and your response.

    I'll give a try to it.



  • I think that I'll try first a Laravel installation with orchestra/hyn or the simpleapproach link to understand how it works. Then, I'll try to understand how to integrate this on Asgard with a module.

    Thanks for all!



  • Finally, it isn't a multi-tenant what I need, I was confused. In fact, what i was looking is different. I have the same site with differents paths (for example, www.site.com/path1, www.site.com/path2). Every path can be (I think) a module, because the content will be structured different for each one). But now, on every path, I have something like a category/page (www.site.com/path1/page1, www.site.com/path1/page2). Every category/page gets the information from different tables/models. For every category/page is a different admin that can see/modify the information.

    This can be something like the blog module?

    Thanks in advance.


  • Global Moderator

    @jesusvpct

    Yes you can make custom blog module, you can also extend current one.

    What you need(most likely) is to make Path or Scope module that has all relations in it so you can tie category or page to a path/scope (relations like category_path, user_path, page_path etc.). And also controls information about what user belongs to what path.
    Basically, you want to make 1 new artificial where clause on every category, page CRUD.

    You don't need different tables/models for this to work, can do it with the current setup.

    Also you would need to override/extend admin methods for blog so you can load up only resources that belong to specific path (can be sorts of middleware or straight up extend)



  • Thank you!


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.