Multiple applications using a single code base in ruby

前端 未结 1 897
Happy的楠姐
Happy的楠姐 2020-12-20 08:03

I\'m trying to get a reasonable understanding of how one can build an app on top of ruby/rack (or even more ideally, an existing framework) that manages something equivalent

相关标签:
1条回答
  • 2020-12-20 08:40

    I think you've probably overcomplicated the situation somewhat. You can easily point different subdomains to different Rails applications using your web server configuration. For example in Nginx, you'd simply create different virtual hosts.

    If you want all the modules contained in one application, then you can have a single virtual host with a wildcard subdomain, and use the routing in your Rails app to route via subdomain to different parts of your app. This would lend itself very well to an Engine architecture.

    With regards databases, in the first example there's no problem at all as the different apps can handle their own database connections. With the engine example, typically engines tables would be in the same database but namespaced.

    Edit - my answer is specifically talking about Rails, whereas your question was more generic.

    0 讨论(0)
提交回复
热议问题