-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multistore setup #27
Comments
What may I do to help in here? |
I think we need to think about what multi-store is in the dancer world. Basically if the template is build with a solid theme-able CSS infrastructure. Once we move the pages to the DB you could in theory have a single database and single app do multistore. Schema would need some work because you can't define the same navigation route twice. I would also think about perhaps having a separate plackup per store. Just so you can restart one at a time and not force restart on all. Just ideas is what we need now on how this is going to work. I don't have a clear vision personally. |
What we've done in our schema in IC5 is add a 'storeid' column to tables like transactions, orderline, products, etc. Then we set IC variable STOREID for each catalog. We use the domain name of the site for the storeid value. In Dancer world we don't have a notion of a catalog.cfg or a sub configuration. We could just glean the storeid from the request and set a $storeid variable in our app and then use it through out. I'm thinking one app for multiple stores. (I don't care about restarting since we only start when an instance is created view AWS autoscaling group.) I'm messing around with "hook before_template_render" to set the view based on the site. So we may have something like.... app/views/bottlenose_product_1 Each site cold have a custom view or we could fallback on our predesigned templates. |
Try setting up a nginx and plackup multi-domain test on a basic dancer app. Then with your hook before_template_render get your host and put it into session.
|
Cool! Thanks Sam. I have something like that going but now I’m stuck on having a per site layouts/main.tt but a common index.tt. It seems like layouts is a special directory in views. I can specify a per site views location but then I’d have repeated index.tt files for each site. I need per site layouts but the other templates like index.tt or product_view.tt to be common. Any ideas on how to do that? And I know this has nothing to do with Schema. Sorry for talking about it here. |
Well I believe you can do something like this.
|
Actually it is the third parameter:
|
bottlenose/views/home.tt I’d like site1 to use its layout to display the common template home.tt. I see where I could just put various layouts for different sites inside the bottlenose directory structure but can I do it the way I specified above where I have a “root directory” for each site where we would redefine or override the default settings from bottlenose? http://www.bottlenose-wine.com/ |
But then your multi app right? |
Actually for multisite it would be really useful to have Dancer2 implementation :-/ |
http://www.bottlenose-wine.com/ |
Issue being that our IC6 plugin infrastructure is in Dancer1. I know work has begun on this for Dancer2 but ... |
Adding Plack::Middleware::Static to your app.psgi would allow you to rewrite paths for things beneath /public. Here's a guess (nasty quick untested hack):
For views handled by D2 you need to do magic in before_template hook. |
You could also do static file rewrites in nginx/apache/... |
This is currently being worked on in branch topic/multistore_gh27 |
👍 Excellent news! |
This is progressing. It is now possible to deploy the new schema and populate stores with initial fixtures (countries, currencies, states, roles, ...). Now need to fix the huge pile of code I've broken getting this far. |
Add support for multiple stores to the schema. This is subject to research and discussion.
Regards
Racke
The text was updated successfully, but these errors were encountered: