[mezzanine-users] Re: Multi Tenancy / Multi IPs
Hi All - This issue is all sorted out. Multi Tenancy with a unique IP per site works out of the box with AWS. You just need to follow the AWS docs on configuring Multiple Elastic IPs for a single EC2 instance. I simply forgot to change the A record of a domain to point to one of the new IPs Cheers, Matt On Tuesday, December 29, 2015 at 12:38:05 PM UTC-8, Matt Mansour wrote: > > Howdy All - > > I have a multi tenancy project up and running. However, I need to assign > each domain a unique IP. Setting this up on AWS was pretty easy. AWS allows > you to use multiple Elastic IPs on a single EC2 server instance. > > The tricky part has been getting the mezzanine nginx.conf and > gunicorn.conf files configured properly. Has any one crossed this bridge > before? > > Cheers, > Matt > -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[mezzanine-users] Re: Multi Tenancy / Multi IPs
Hi All - This issue is all sorted out. Multi Tenancy with a unique IP per site basically works out of the box. You just have to follow the AWS docs on configuring Multiple Elastic IPs (EIP) per EC2 instance. I simply forgot to change the A record of a domain to point to one of the new IPs. Cheers, Matt On Monday, January 4, 2016 at 2:34:05 PM UTC-8, Matt Mansour wrote: > > Hi Anthony - > > Thank you for the post. > > The set up I have is one project with multiple websites all housed in the > same CMS - Basically following the mezzanine docs for multi-tenancy > http://mezzanine.jupo.org/docs/multi-tenancy.html > > For other projects I have used configurations that somewhat resemble > yours. It works great. However, on this current project we don't want > editors to have to log in to multiple website admins. In our case we're > trying to keep content for all our websites in the same CMS. > > However, your post has given me some ideas to try. If I can get something > working I'll report back on how I did it. And more feedback is always > welcome and helpful. > > Thanks again! > Matt > > On Sunday, January 3, 2016 at 11:53:33 AM UTC-8, Anthony Gagliardo wrote: >> >> There are a few ways to set this up. I've tried a couple of them out >> personally and from my past experience I would say that the next step >> depends upon how you have multitenancy set up. >> >> Typically I will use multiple django/mezzanine projects installed on the >> same server, in completely separate dirs. Each project has a domain name >> (and an elastic ip associated with it), which is where nginx comes into the >> mix. Inside my nginx config I have several upstream servers defined. I use >> one virtualhost for each of the projects plus whatever utility servers that >> I might need. >> >> example upstream setup: >> upstream GUnicornSite1 { >> server 127.0.0.1:8001; >> } >> upstream GUnicornSite2 { >> server 127.0.0.1:8002; >> } >> upstream GUnicornSite3 { >> server 127.0.0.1:8003; >> } >> >> Now that nginx knows about the webservers, its time to actually start >> those webservers. Its important to note that in your gunicorn >> configuration, you need to make sure that each server is listening on >> whichever port number you specified in your nginx.conf definition. Aside >> from any static media nonsense that may or may not arise, I don't think >> there is much more to specify as far as the gUnicorn config. I made the >> move to uwsgi because I needed websocket support. >> >> The uwsgi part of my nginx.conf looks significantly different than what a >> gunicorn setup needs, but here is a simple example of how I listen on a >> certain port. >> Server{ >> listen 9001; >> location / { >>proxy_pass http://GUnicornServer1/; >> >> Server{ >> listen 9002; >> location / { >>proxy_pass http://GUnicornServer2/; >> >> >> >> You can also specify that you want to listen for a certain domain/ip >> address, the syntax is a little tricky so i would suggest finding a good >> tutorial that meets your needs. So in the above case, if a request is sent >> to port 9002, it will be forwarded to whichever website is running on the >> 9002 server. Again, instead of using port 9002 you could just as easily >> route the request based on the ip. I use this setup with uwsgi's emperor >> mode because it makes managing the vassal servers simple. >> >> >> >> If you, instead, want to host multiple sites using multi-tenancy over a >> single webserver then I would consider using middleware to route incoming >> urls to the appropriate urls.py. nginx should not need any additional >> configuration, it just needs to route all the requests to the one >> webserver. Routing then happen when the request is processed by the >> middleware. >> >> There's probably an easier way to do this too that I'm not aware of. >> I've done subdomain routing like this in the past, but it felt kind of >> hacky. I feel like nginx is the more capable solution. I might be >> deploying a site later today that involves this sort of setup. If i get >> around to it ill post the actual code chunks. >> >> best, >> avg >> >> >> >> >> -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[mezzanine-users] Re: Multi Tenancy / Multi IPs
Hi Anthony - Thank you for the post. The set up I have is one project with multiple websites all housed in the same CMS - Basically following the mezzanine docs for multi-tenancy http://mezzanine.jupo.org/docs/multi-tenancy.html For other projects I have used configurations that somewhat resemble yours. It works great. However, on this current project we don't want editors to have to log in to multiple website admins. In our case we're trying to keep content for all our websites in the same CMS. However, your post has given me some ideas to try. If I can get something working I'll report back on how I did it. And more feedback is always welcome and helpful. Thanks again! Matt On Sunday, January 3, 2016 at 11:53:33 AM UTC-8, Anthony Gagliardo wrote: > > There are a few ways to set this up. I've tried a couple of them out > personally and from my past experience I would say that the next step > depends upon how you have multitenancy set up. > > Typically I will use multiple django/mezzanine projects installed on the > same server, in completely separate dirs. Each project has a domain name > (and an elastic ip associated with it), which is where nginx comes into the > mix. Inside my nginx config I have several upstream servers defined. I use > one virtualhost for each of the projects plus whatever utility servers that > I might need. > > example upstream setup: > upstream GUnicornSite1 { > server 127.0.0.1:8001; > } > upstream GUnicornSite2 { > server 127.0.0.1:8002; > } > upstream GUnicornSite3 { > server 127.0.0.1:8003; > } > > Now that nginx knows about the webservers, its time to actually start > those webservers. Its important to note that in your gunicorn > configuration, you need to make sure that each server is listening on > whichever port number you specified in your nginx.conf definition. Aside > from any static media nonsense that may or may not arise, I don't think > there is much more to specify as far as the gUnicorn config. I made the > move to uwsgi because I needed websocket support. > > The uwsgi part of my nginx.conf looks significantly different than what a > gunicorn setup needs, but here is a simple example of how I listen on a > certain port. > Server{ > listen 9001; > location / { >proxy_pass http://GUnicornServer1/; > > Server{ > listen 9002; > location / { >proxy_pass http://GUnicornServer2/; > > > > You can also specify that you want to listen for a certain domain/ip > address, the syntax is a little tricky so i would suggest finding a good > tutorial that meets your needs. So in the above case, if a request is sent > to port 9002, it will be forwarded to whichever website is running on the > 9002 server. Again, instead of using port 9002 you could just as easily > route the request based on the ip. I use this setup with uwsgi's emperor > mode because it makes managing the vassal servers simple. > > > > If you, instead, want to host multiple sites using multi-tenancy over a > single webserver then I would consider using middleware to route incoming > urls to the appropriate urls.py. nginx should not need any additional > configuration, it just needs to route all the requests to the one > webserver. Routing then happen when the request is processed by the > middleware. > > There's probably an easier way to do this too that I'm not aware of. I've > done subdomain routing like this in the past, but it felt kind of hacky. I > feel like nginx is the more capable solution. I might be deploying a site > later today that involves this sort of setup. If i get around to it ill > post the actual code chunks. > > best, > avg > > > > > -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[mezzanine-users] Re: Multi Tenancy / Multi IPs
There are a few ways to set this up. I've tried a couple of them out personally and from my past experience I would say that the next step depends upon how you have multitenancy set up. Typically I will use multiple django/mezzanine projects installed on the same server, in completely separate dirs. Each project has a domain name (and an elastic ip associated with it), which is where nginx comes into the mix. Inside my nginx config I have several upstream servers defined. I use one virtualhost for each of the projects plus whatever utility servers that I might need. example upstream setup: upstream GUnicornSite1 { server 127.0.0.1:8001; } upstream GUnicornSite2 { server 127.0.0.1:8002; } upstream GUnicornSite3 { server 127.0.0.1:8003; } Now that nginx knows about the webservers, its time to actually start those webservers. Its important to note that in your gunicorn configuration, you need to make sure that each server is listening on whichever port number you specified in your nginx.conf definition. Aside from any static media nonsense that may or may not arise, I don't think there is much more to specify as far as the gUnicorn config. I made the move to uwsgi because I needed websocket support. The uwsgi part of my nginx.conf looks significantly different than what a gunicorn setup needs, but here is a simple example of how I listen on a certain port. Server{ listen 9001; location / { proxy_pass http://GUnicornServer1/; Server{ listen 9002; location / { proxy_pass http://GUnicornServer2/; You can also specify that you want to listen for a certain domain/ip address, the syntax is a little tricky so i would suggest finding a good tutorial that meets your needs. So in the above case, if a request is sent to port 9002, it will be forwarded to whichever website is running on the 9002 server. Again, instead of using port 9002 you could just as easily route the request based on the ip. I use this setup with uwsgi's emperor mode because it makes managing the vassal servers simple. If you, instead, want to host multiple sites using multi-tenancy over a single webserver then I would consider using middleware to route incoming urls to the appropriate urls.py. nginx should not need any additional configuration, it just needs to route all the requests to the one webserver. Routing then happen when the request is processed by the middleware. There's probably an easier way to do this too that I'm not aware of. I've done subdomain routing like this in the past, but it felt kind of hacky. I feel like nginx is the more capable solution. I might be deploying a site later today that involves this sort of setup. If i get around to it ill post the actual code chunks. best, avg -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.