[Glass] [a bit offtopic] Redirect special seaside request to a different VM

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Glass] [a bit offtopic] Redirect special seaside request to a different VM

Mariano Martinez Peck
Hi guys, 

I have some special requests that I want to redirect to another Gem. What I did in seaside is to implement #updateUrl: and add some parameter for those cases I want to send it to another Gem. 

Now, I don't know how to adapt nginx for such a thing. I am using FastCGI. So I need to check if such argument is present in the URL and if true, send it to another upstream. If not, use the normal upstream. 

but I didn't have any working answer.

Does any of you have an idea how could I do that? 

Thanks in advance, 

--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] [a bit offtopic] Redirect special seaside request to a different VM

Dale Henrichs-3


From: "Mariano Martinez Peck" <[hidden email]>
To: [hidden email], "Seaside - general discussion" <[hidden email]>
Sent: Wednesday, December 18, 2013 9:40:06 AM
Subject: [Glass] [a bit offtopic] Redirect special seaside request to a        different VM

Hi guys, 

I have some special requests that I want to redirect to another Gem. What I did in seaside is to implement #updateUrl: and add some parameter for those cases I want to send it to another Gem. 

Now, I don't know how to adapt nginx for such a thing. I am using FastCGI. So I need to check if such argument is present in the URL and if true, send it to another upstream. If not, use the normal upstream. 
Are you having trouble finding the parameter because you are using FastCGI? Or is the trouble purely an nginx question?

but I didn't have any working answer.

Does any of you have an idea how could I do that? 

Thanks in advance, 

--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] [a bit offtopic] Redirect special seaside request to a different VM

Mariano Martinez Peck



On Wed, Dec 18, 2013 at 2:48 PM, Dale K. Henrichs <[hidden email]> wrote:


From: "Mariano Martinez Peck" <[hidden email]>
To: [hidden email], "Seaside - general discussion" <[hidden email]>
Sent: Wednesday, December 18, 2013 9:40:06 AM
Subject: [Glass] [a bit offtopic] Redirect special seaside request to a        different VM


Hi guys, 

I have some special requests that I want to redirect to another Gem. What I did in seaside is to implement #updateUrl: and add some parameter for those cases I want to send it to another Gem. 

Now, I don't know how to adapt nginx for such a thing. I am using FastCGI. So I need to check if such argument is present in the URL and if true, send it to another upstream. If not, use the normal upstream. 
Are you having trouble finding the parameter because you are using FastCGI? Or is the trouble purely an nginx question?

I guess the later.  My usecase is this: I have some module inside the app which have some reports which may take several seconds, even some minutes. I know I could make them async, I know I have serviceVM, etc. But for the moment I want to keep it simple. So all those request from those modules, I want a special gem listening to them. Why? because I don't want to lock the VM for many time and because I want a different gem conf file (assignee more memory, etc). 

So the thing is how can I make the if in nginx and send the request to the appropriate upstream of gems.

 

but I didn't have any working answer.

Does any of you have an idea how could I do that? 

Thanks in advance, 

--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass




--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] [a bit offtopic] Redirect special seaside request to a different VM

Mariano Martinez Peck



On Wed, Dec 18, 2013 at 3:02 PM, Richard Sargent <[hidden email]> wrote:
Can't you just use a different URL path? e.g. http://mydomain.com/fastrequests/whatever versus http://mydomain.com/slowrequests/whatever?



yes, I can.  But that is an implementation detail, so I don't want to show it that much in the URL. At least with an argument at the end it is less visible. Also, if I put it as part of the path, users may think that the app is restful. So he will try to access   http://mydomain.com/slowrequests/whatever in the future, and that of course will not work unless I spend some effort making seaside restful. 
 
I had the impression that every(?) web server should be able to have different handlers for different paths. (My understanding of web servers is pretty limited, so I could easily be mistaken.)

Yes, at least with this it is easy to do with the webserver :)
 



On Wed, Dec 18, 2013 at 9:52 AM, Mariano Martinez Peck <[hidden email]> wrote:



On Wed, Dec 18, 2013 at 2:48 PM, Dale K. Henrichs <[hidden email]> wrote:


From: "Mariano Martinez Peck" <[hidden email]>
To: [hidden email], "Seaside - general discussion" <[hidden email]>
Sent: Wednesday, December 18, 2013 9:40:06 AM
Subject: [Glass] [a bit offtopic] Redirect special seaside request to a        different VM


Hi guys, 

I have some special requests that I want to redirect to another Gem. What I did in seaside is to implement #updateUrl: and add some parameter for those cases I want to send it to another Gem. 

Now, I don't know how to adapt nginx for such a thing. I am using FastCGI. So I need to check if such argument is present in the URL and if true, send it to another upstream. If not, use the normal upstream. 
Are you having trouble finding the parameter because you are using FastCGI? Or is the trouble purely an nginx question?

I guess the later.  My usecase is this: I have some module inside the app which have some reports which may take several seconds, even some minutes. I know I could make them async, I know I have serviceVM, etc. But for the moment I want to keep it simple. So all those request from those modules, I want a special gem listening to them. Why? because I don't want to lock the VM for many time and because I want a different gem conf file (assignee more memory, etc). 

So the thing is how can I make the if in nginx and send the request to the appropriate upstream of gems.

 

but I didn't have any working answer.

Does any of you have an idea how could I do that? 

Thanks in advance, 

--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass




--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass




--
Richard Sargent
Business Development Manager
503-766-4719
[hidden email]
GemTalk Systems
15220 NW Greenbrier Parkway #240
Beaverton, OR 97006



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] [a bit offtopic] Redirect special seaside request to a different VM

Paul DeBruicker
In reply to this post by Mariano Martinez Peck
I answered the folowing on the website:

@hellvinz is right. I can't comment so I'm making another answer.

location / {
   if($myArg = "otherPool") {
       rewrite  ^/(.*)$ /otherUpstream/$1 last;
     }
   try_files $uri pool1;
}

location /otherUpstream {
     proxy_pass http://@pool2;
}
I think you'll have to change $myArg to the name of the query parameter you're testing for and otherPool to whatever you set it to. Plus the rewrite is untested, so I may have that wrong too but you get the idea.


Mariano Martinez Peck wrote
On Wed, Dec 18, 2013 at 2:48 PM, Dale K. Henrichs <
[hidden email]> wrote:

>
> ------------------------------
>
> *From: *"Mariano Martinez Peck" <[hidden email]>
> *To: *[hidden email], "Seaside - general discussion" <
> [hidden email]>
> *Sent: *Wednesday, December 18, 2013 9:40:06 AM
> *Subject: *[Glass] [a bit offtopic] Redirect special seaside request to
> a        different VM
>
>
> Hi guys,
>
> I have some special requests that I want to redirect to another Gem. What
> I did in seaside is to implement #updateUrl: and add some parameter for
> those cases I want to send it to another Gem.
>
> Now, I don't know how to adapt nginx for such a thing. I am using FastCGI.
> So I need to check if such argument is present in the URL and if true, send
> it to another upstream. If not, use the normal upstream.
>
> Are you having trouble finding the parameter because you are using
> FastCGI? Or is the trouble purely an nginx question?
>

I guess the later.  My usecase is this: I have some module inside the app
which have some reports which may take several seconds, even some minutes.
I know I could make them async, I know I have serviceVM, etc. But for the
moment I want to keep it simple. So all those request from those modules, I
want a special gem listening to them. Why? because I don't want to lock the
VM for many time and because I want a different gem conf file (assignee
more memory, etc).

So the thing is how can I make the if in nginx and send the request to the
appropriate upstream of gems.



>
> I have explained my problem here:
> http://serverfault.com/questions/561993/nginx-choose-upstream-depending-on-args
> but I didn't have any working answer.
>
> Does any of you have an idea how could I do that?
>
> Thanks in advance,
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
> _______________________________________________
> Glass mailing list
> [hidden email]
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
>
>


--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: [Glass] [a bit offtopic] Redirect special seaside request to a different VM

Mariano Martinez Peck
Thanks Paul, that works perfectly. 




On Wed, Dec 18, 2013 at 3:40 PM, Paul DeBruicker <[hidden email]> wrote:
I answered the folowing on the website:

@hellvinz is right. I can't comment so I'm making another answer.

location / {
   if($myArg = "otherPool") {
       rewrite  ^/(.*)$ /otherUpstream/$1 last;
     }
   try_files $uri pool1;
}

location /otherUpstream {
     proxy_pass http://@pool2;
}
I think you'll have to change $myArg to the name of the query parameter
you're testing for and otherPool to whatever you set it to. Plus the rewrite
is untested, so I may have that wrong too but you get the idea.



Mariano Martinez Peck wrote
> On Wed, Dec 18, 2013 at 2:48 PM, Dale K. Henrichs <

> dale.henrichs@

>> wrote:
>
>>
>> ------------------------------
>>
>> *From: *"Mariano Martinez Peck" &lt;

> marianopeck@

> &gt;
>> *To: *

> glass@.gemtalksystems

> , "Seaside - general discussion" <
>>

> seaside@.squeakfoundation

>>
>> *Sent: *Wednesday, December 18, 2013 9:40:06 AM
>> *Subject: *[Glass] [a bit offtopic] Redirect special seaside request to
>> a        different VM
>>
>>
>> Hi guys,
>>
>> I have some special requests that I want to redirect to another Gem. What
>> I did in seaside is to implement #updateUrl: and add some parameter for
>> those cases I want to send it to another Gem.
>>
>> Now, I don't know how to adapt nginx for such a thing. I am using
>> FastCGI.
>> So I need to check if such argument is present in the URL and if true,
>> send
>> it to another upstream. If not, use the normal upstream.
>>
>> Are you having trouble finding the parameter because you are using
>> FastCGI? Or is the trouble purely an nginx question?
>>
>
> I guess the later.  My usecase is this: I have some module inside the app
> which have some reports which may take several seconds, even some minutes.
> I know I could make them async, I know I have serviceVM, etc. But for the
> moment I want to keep it simple. So all those request from those modules,
> I
> want a special gem listening to them. Why? because I don't want to lock
> the
> VM for many time and because I want a different gem conf file (assignee
> more memory, etc).
>
> So the thing is how can I make the if in nginx and send the request to the
> appropriate upstream of gems.
>
>
>
>>
>> I have explained my problem here:
>> http://serverfault.com/questions/561993/nginx-choose-upstream-depending-on-args
>> but I didn't have any working answer.
>>
>> Does any of you have an idea how could I do that?
>>
>> Thanks in advance,
>>
>> --
>> Mariano
>> http://marianopeck.wordpress.com
>>
>> _______________________________________________
>> Glass mailing list
>>

> Glass@.gemtalksystems
> _______________________________________________
> Glass mailing list

> Glass@.gemtalksystems

> http://lists.gemtalksystems.com/mailman/listinfo/glass





--
View this message in context: http://forum.world.st/Glass-a-bit-offtopic-Redirect-special-seaside-request-to-a-different-VM-tp4731000p4731018.html
Sent from the GLASS mailing list archive at Nabble.com.
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass



--
Mariano
http://marianopeck.wordpress.com

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass