Skip to content
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

Can't start serve on a different port #49

Open
joevandyk opened this issue Sep 5, 2011 · 9 comments
Open

Can't start serve on a different port #49

joevandyk opened this issue Sep 5, 2011 · 9 comments

Comments

@joevandyk
Copy link

$ serve 2100
[2011-09-05 13:43:36] INFO  WEBrick 1.3.1
[2011-09-05 13:43:36] INFO  ruby 1.9.2 (2011-07-09) [x86_64-darwin11.1.0]
[2011-09-05 13:43:36] INFO  WEBrick::HTTPServer#start: pid=40613 port=4000

It's running on port 4000, I'd expect it to use port 2100.

@joevandyk
Copy link
Author

Bah, figured it out.

I had to remove this line from the generated config.ru:

#\ -p 4000

@joevandyk
Copy link
Author

Is there a reason why that line is there?

@jlong
Copy link
Owner

jlong commented Sep 6, 2011

In this case Serve is just delegating to the rackup command. You need to edit your config.ru. The very first line tells it which port to start.

John Long
http://wiseheartdesign.com

On Sep 5, 2011, at 4:47 PM, [email protected] wrote:

$ serve 2100
[2011-09-05 13:43:36] INFO WEBrick 1.3.1
[2011-09-05 13:43:36] INFO ruby 1.9.2 (2011-07-09) [x86_64-darwin11.1.0]
[2011-09-05 13:43:36] INFO WEBrick::HTTPServer#start: pid=40613 port=4000
^C[2011-09-05 13:43:38] INFO going to shutdown ...
[2011-09-05 13:43:38] INFO WEBrick::HTTPServer#start done.

Reply to this email directly or view it on GitHub:
#49

@joevandyk
Copy link
Author

Right, but why is is this line here?

https://github.com/jlong/serve/blob/master/lib/serve/bootstrap/config.ru#L1

Everyone who wants to run serve on a different port will need to know to remove that line if they want to follow the documentation in the README.

@jlong
Copy link
Owner

jlong commented Sep 6, 2011

Well, the assumption here is that if you have a project with a config.ru in it that you know which port you want it to run on, so if you want to change it, you'd change it in the config.ru. But perhaps the -p option should override as you suggest. In fact, I'm leaning that way now that you've talked me through it.

This month is kind of busy for me so I don't have a lot of time to work on Serve, but I'd merge a pull request if you send one my way. It's probably just a matter of making sure the port is handed over to the rackup command in the Application object.

Otherwise, it'll be a bit before I get to it.

--John

On Sep 6, 2011, at 12:29 AM, joevandyk wrote:

Right, but why is is this line here?

https://github.com/jlong/serve/blob/master/lib/serve/bootstrap/config.ru#L1

Everyone who wants to run serve on a different port will need to know to remove that line if they want to follow the documentation in the README.

Reply to this email directly or view it on GitHub:
#49 (comment)

@pbyrne
Copy link

pbyrne commented Sep 13, 2011

This looks like it might be in the rackup command itself. You're passing the user-supplied port in Serve::Application#run_rack_app, and trying rackup -p 2100 -o 0.0.0.0 -E development './config.ru' in the command line exhibits the behavior of using the port from config.ru rather than from the -p argument.

$ rackup -p 2100 -o 0.0.0.0 -E development './config.ru'
[2011-09-12 19:39:13] INFO  WEBrick 1.3.1
[2011-09-12 19:39:13] INFO  ruby 1.9.2 (2011-07-09) [x86_64-darwin10.8.0]
[2011-09-12 19:39:13] INFO  WEBrick::HTTPServer#start: pid=9125 port=4000

@hedgehog
Copy link

Even when I change #\ 4100 and run bundle exec serve I see:

$> ps aux|grep -i rackup
hedge    19696  6.4  0.2 128644 47228 pts/30   Sl   19:59   0:08 ruby /src/proj/vendor/ruby/1.9.1/bin/rackup -p 3000 │Using /home/hedge/.rvm/gems/ruby-1.9.2-p290 with gem-o 0.0.0.0 -E development ./config.ru

@ntalbott
Copy link
Contributor

ntalbott commented Apr 6, 2012

So what's the verdict? Should we remove the port from the config.ru? Honestly it seems really strange to me to have it hardcoded in there.

@jlong
Copy link
Owner

jlong commented Apr 6, 2012

Yes. I still want the rails_app? checks in there though. That stuff should be updated for Rails 3 though. The idea is that serve can be used to start any rack or rails app, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants