Google Groups Home
Help | Sign in
How to use Thin with Swiftiply
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
matt mitchell  
View profile
 More options Mar 27, 11:11 am
From: matt mitchell <goodie...@gmail.com>
Date: Thu, 27 Mar 2008 08:11:41 -0700 (PDT)
Local: Thurs, Mar 27 2008 11:11 am
Subject: How to use Thin with Swiftiply
Hi,

I can't seem to find any information on how to actually get Thin
working with Swiftiply? I see there is the -y argument for Thin. I
tried it out and seems to start up something.... But Apache (load
balancer) is not able to connect to the ports I specified in my
thin.yml config file. Is there something I'm missing?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
macournoyer  
View profile
 More options Mar 27, 2:31 pm
From: macournoyer <macourno...@gmail.com>
Date: Thu, 27 Mar 2008 11:31:31 -0700 (PDT)
Local: Thurs, Mar 27 2008 2:31 pm
Subject: Re: How to use Thin with Swiftiply
hey matt,

First you need to install & setup a swiftiply config file:
 gem install swiftiply

and check thin specs for a sample config file:
http://github.com/macournoyer/thin/tree/master/spec/server/swiftiply.yml

then start swiftiply:
 swiftiply -c /path/to/your/swiftiply/config.yml

then start your thins:
 thin start -s3 -p5555 -y

If you wanna put this behind Apache, proxy to the swiftiply cluster
port (3333 in this case)

Hope this helps!
Marc

On Mar 27, 11:11 am, matt mitchell <goodie...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gpop  
View profile
 More options Apr 2, 6:04 pm
From: gpop <gpop2...@gmail.com>
Date: Wed, 2 Apr 2008 15:04:33 -0700 (PDT)
Local: Wed, Apr 2 2008 6:04 pm
Subject: Re: How to use Thin with Swiftiply
Bah, no such luck. I've tried it before and the result is always the
same, my thin servers log "!! Invalid request" over and over.
Swiftiply seems to gobble up the first header. For example, given the
configs:

$ cat swiftiply.yml
cluster_address: 0.0.0.0
cluster_port: 4000
daemonize: true
epoll: true
map:
  - incoming:
    - testapp
    outgoing: 127.0.0.1:8014
    default: true
    redeployable: true
$ cat thin.yml
---
user: XXX
max_conns: "100"
chdir: /home/XXX/XXX
timeout: "20"
port: 8014
environment: development
group: XXX
address: 127.0.0.1
pid: log/thin.pid
servers: 1
prefix: /test
#rackup: ./thin_proctitle.ru

and starting them with

swiftiply -c swiftiply.yml
thin -y -C thin.yml start

I then make a request to Swiftiply:

$ telnet 0 4000
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
GET /test/testing HTTP/1.1
Host: testapp

Which causes the thin log to scroll "!! Invalid request" repeatedly.
I've hacked up that part of the code to simply puts the e (exception)
and data (the request that came in from swiftiply) variables to the
log, and it the log then reads:

!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp\r\n"
!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp\r\n"
!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp\r\n"
!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp\r\n"
!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp\r\n"
!! Invalid request

repeatedly. It looks like Swiftiply never passes the GET request to
the thin server. You ever see something like this before? Also, please
note that the prefix: and rackup: stuff is from some testing I'm doing
and doesn't affect the behaviour of Swiftiply (it doesn't work
regardless).

I've read there's currently a bug in EventMachine that causes
Swiftiply to crash unexpectedly. The bug is supposedly fixed in
eventmachine 0.11.0 , but that gem isn't out yet. Regardless, I can't
wait until Swiftiply is more mature so I can put it into production.

--George

On Mar 27, 1:31 pm, macournoyer <macourno...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
macournoyer  
View profile
 More options Apr 2, 8:33 pm
From: macournoyer <macourno...@gmail.com>
Date: Wed, 2 Apr 2008 17:33:06 -0700 (PDT)
Local: Wed, Apr 2 2008 8:33 pm
Subject: Re: How to use Thin with Swiftiply
does it work from a browser, also what version of switiply are you
using?

On Apr 2, 6:04 pm, gpop <gpop2...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gpop  
View profile
 More options Apr 3, 11:19 am
From: gpop <gpop2...@gmail.com>
Date: Thu, 3 Apr 2008 08:19:42 -0700 (PDT)
Local: Thurs, Apr 3 2008 11:19 am
Subject: Re: How to use Thin with Swiftiply
I'm using swiftiply 0.6.1.1 and thin 0.7.1 . And you're correct - I
was surprised to find that it in fact does work in a browser. I played
around with it some more and found that it responds via cURL requests
as well, but it still doesn't like an interactive telnet request. If I
telnet to the swiftiply port and copy/paste:

GET /test/user/login HTTP/1.1
Host: testapp:4000
Accept: */*

Then it responds properly - however if I type the same thing, it
doesn't, and thin trips out with:

!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp:4000\r\nAccept: */*\r\n\r\n\r\n\r\n"
!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp:4000\r\nAccept: */*\r\n\r\n\r\n\r\n"
!! Invalid request
e is #<Thin::InvalidRequest: Invalid HTTP format, parsing fails.>
data is "Host: testapp:4000\r\nAccept: */*\r\n\r\n\r\n\r\n"

I guess I'm used to testing services by telnet-ing to them, however
that doesn't seem to work with Swiftiply. I'm assuming there's some
sort of timeout that occurs while I'm ever so slowly (compared to a
copy/paste) typing my request in. Regardless, I stand corrected and
can confirm that at least through a browser, my Swiftiply and Thin
play together nicely.

I still don't think I'm going to go with Swiftiply in production until
it's more mature, though it looks promising!

--George

On Apr 2, 7:33 pm, macournoyer <macourno...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Reza Primardiansyah  
View profile
 More options Apr 4, 12:24 am
From: "Reza Primardiansyah" <reza.primardians...@gmail.com>
Date: Fri, 4 Apr 2008 11:24:12 +0700
Local: Fri, Apr 4 2008 12:24 am
Subject: Re: How to use Thin with Swiftiply

Can it because of the CRLF separator ? Do you type it from windows ? I
suspect Thin expects \n but you gave it \r\n


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gpop  
View profile
 More options Apr 4, 9:18 am
From: gpop <gpop2...@gmail.com>
Date: Fri, 4 Apr 2008 06:18:04 -0700 (PDT)
Local: Fri, Apr 4 2008 9:18 am
Subject: Re: How to use Thin with Swiftiply
Nope, it must be converted internally - did this on an Ubuntu Gutsy
box. I honestly wouldn't bother using Windows for any of this stuff.

--George

On Apr 3, 11:24 pm, "Reza Primardiansyah"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Corey Jewett  
View profile
 More options Apr 4, 3:15 pm
From: Corey Jewett <corey.jew...@gmail.com>
Date: Fri, 4 Apr 2008 12:15:04 -0700
Local: Fri, Apr 4 2008 3:15 pm
Subject: Re: How to use Thin with Swiftiply

On Apr 4, 2008, at 06:18 , gpop wrote:

> Nope, it must be converted internally - did this on an Ubuntu Gutsy
> box. I honestly wouldn't bother using Windows for any of this stuff.

I to thought it might be a CRLF issue with telnet. I hacked out a  
quick ruby direct socket server and confirmed that telnet (at least on  
OS X) actually sends CRLF, not just LF as I had _always_ assumed.

Does Thin expect LF? Browsers all, to my knowledge, send CRLF. HTTP  
specs require CRLF to separate headers[1]. Apparently at least some  
telnet clients send CRLF. I poked briefly at the Swiftiply source and  
it seems to use CRLF.

Corey
1. RFC 2616, Section 5


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
macournoyer  
View profile
 More options Apr 4, 4:36 pm
From: macournoyer <macourno...@gmail.com>
Date: Fri, 4 Apr 2008 13:36:23 -0700 (PDT)
Local: Fri, Apr 4 2008 4:36 pm
Subject: Re: How to use Thin with Swiftiply
I don't know why it doesn't work in telnet, but CRLF is the correct
line ending.

On Apr 4, 3:15 pm, Corey Jewett <corey.jew...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carl  
View profile
 More options May 7, 3:45 pm
From: Carl <cmerc...@gmail.com>
Date: Wed, 7 May 2008 12:45:46 -0700 (PDT)
Local: Wed, May 7 2008 3:45 pm
Subject: Re: How to use Thin with Swiftiply
I'm also getting the Invalid Request problem.  a gazillion of them in
thin.x.log.  Eventually, thin doesn't accept any request (the
processes are still up).

Is there a fix for that?

On Apr 2, 6:04 pm, gpop <gpop2...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You