I''ve Googled and checked the archives, but the only answer I can find about firing up on port other than 3000 is to either modify the library default (?!) or use the command-line argument --port=# (eh...) What I''d LIKE to do is run 3 Rails apps (all in development, so they all want port 3000), but run them on ports 3000, 3001, 3002. For ease-of-administration, it''d be convenient if I could start them all with rails scripts/server and not have to remember which one is one which port as I flit between them. (In addition, as I share them with another developer, I don''t want to have to worry about conflicts with HIS development rails apps running, nor whether he''ll remember to use the --port=# option.) So, what I''m hoping to do is put some magic incantation somewhere in my config directory (config/environment.rb?), and have a different default-port for each app. Is that possible? Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/7/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''ve Googled and checked the archives, but the only answer I can find > about firing up on port other than 3000 is to either modify the library > default (?!) or use the command-line argument --port=# (eh...) > > What I''d LIKE to do is run 3 Rails apps (all in development, so they all > want port 3000), but run them on ports 3000, 3001, 3002. For > ease-of-administration, it''d be convenient if I could start them all > with > > rails scripts/server > > and not have to remember which one is one which port as I flit between > them. (In addition, as I share them with another developer, I don''t > want to have to worry about conflicts with HIS development rails apps > running, nor whether he''ll remember to use the --port=# option.) > > So, what I''m hoping to do is put some magic incantation somewhere in my > config directory (config/environment.rb?), and have a different > default-port for each app. > > Is that possible? > > Thanks! > -- > Posted via http://www.ruby-forum.com/. > > > >Look in to mongrel_cluster. Usually we use it for clustering mongrels in production (go figure) but you can use it to run multiple instances mapped to different ports automatically. An example config would be --- port: 3000 servers: 3 environment: development and you run it with mongrel_rails cluster::start http://mongrel.rubyforge.org/docs/mongrel_cluster.html Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/7/07, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10/7/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > I''ve Googled and checked the archives, but the only answer I can find > > about firing up on port other than 3000 is to either modify the library > > default (?!) or use the command-line argument --port=# (eh...) > > > > What I''d LIKE to do is run 3 Rails apps (all in development, so they all > > want port 3000), but run them on ports 3000, 3001, 3002. For > > ease-of-administration, it''d be convenient if I could start them all > > with > > > > rails scripts/server > > > > and not have to remember which one is one which port as I flit between > > them. (In addition, as I share them with another developer, I don''t > > want to have to worry about conflicts with HIS development rails apps > > running, nor whether he''ll remember to use the --port=# option.) > > > > So, what I''m hoping to do is put some magic incantation somewhere in my > > config directory (config/environment.rb?), and have a different > > default-port for each app. > > > > Is that possible? > > > > Thanks! > > -- > > Posted via http://www.ruby-forum.com/. > > > > > > > > > > Look in to mongrel_cluster. Usually we use it for clustering mongrels > in production (go figure) but you can use it to run multiple instances > mapped to different ports automatically. An example config would be > > --- > port: 3000 > servers: 3 > environment: development > > and you run it with > mongrel_rails cluster::start > > http://mongrel.rubyforge.org/docs/mongrel_cluster.html > > Pat >oh, wait, I''m dumb. You said three different apps. I would just write a little wrapper around script/server. Not that hard. Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pat Maddox wrote:> I would just write a little wrapper around script/server. Not that > hard.Did I mention "n00b"? ;) (To be fair, I''m (theoretically) a Sr. developer, but I''m uber-new to Ruby/rails...) FWIW, one thing n00bs find interesting is that script/server is only 2 lines: #!/usr/bin/env ruby require File.dirname(__FILE__) + ''/../config/boot'' require ''commands/server'' And, until one figures out that "require" = "#include" (or "import" ;), the fact that server does anything is a little mystery not covered in any of the n00b-tutorials... :) Well, the hack-solution would be to figure out a way to stuff ARGV before the 1st require, but that''s pretty lame. I could modify config/boot.rb, but it specifically says not to. That leaves me with figuring out where commands/server is (/usr/lib/ruby/some/path/I''m/sure...) and what I want to wrap around that. It''d be NICE if the answer was something like: change the 2nd line to require ''commands/server'' --port=3001 but I bet it''s not that simple. Or maybe ENV[ENV_PORT]="3001" require ''commands/server'' or something similar. Anyway, I''ll have a look at it -- I''m sure it''s good for me to learn how all this inner-gerwerkkins stuff works; I was just being lazy (well, "wanting to get on with the ''real work''..." :) Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/7/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Pat Maddox wrote: > > I would just write a little wrapper around script/server. Not that > > hard. > > Did I mention "n00b"? ;)By "wrapper" I meant a little shell script $ cat bin/run_server ruby script/server -p 3001 Now in your project when you run ./bin/run_server it runs script/server on port 3001. Copy that file into each project you want and change the port to be whatever. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pat Maddox wrote:> On 10/7/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> Pat Maddox wrote: >> > I would just write a little wrapper around script/server. Not that >> > hard. >> >> Did I mention "n00b"? ;) > > By "wrapper" I meant a little shell script > > $ cat bin/run_server > ruby script/server -p 3001 > > Now in your project when you run > > ./bin/run_server > > it runs script/server on port 3001. Copy that file into each project > you want and change the port to be whatever.If I could count on my installation people to run my little shell script, I could just ask them to use -p 3001 :) The whole thing I''m trying to accomplish, here, is to make it fail-safe. Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/12/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Pat Maddox wrote: > > On 10/7/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> > >> Pat Maddox wrote: > >> > I would just write a little wrapper around script/server. Not that > >> > hard. > >> > >> Did I mention "n00b"? ;) > > > > By "wrapper" I meant a little shell script > > > > $ cat bin/run_server > > ruby script/server -p 3001 > > > > Now in your project when you run > > > > ./bin/run_server > > > > it runs script/server on port 3001. Copy that file into each project > > you want and change the port to be whatever. > > If I could count on my installation people to run my little shell > script, I could just ask them to use -p 3001 :) The whole thing I''m > trying to accomplish, here, is to make it fail-safe.So, tell them to run bin/run_server instead of script/server? Not that hard. If they forget to, they''ll know when mongrel tries to start up. If you''re super paranoid though, just move script/server to some other file, maybe script/rails_server, and save the wrapper file to script/server. Then when people run that they actually get your custom wrapper. Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pat Maddox wrote:> On 10/12/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> > By "wrapper" I meant a little shell script>> If I could count on my installation people to run my little shell >> script, I could just ask them to use -p 3001 :) The whole thing I''m >> trying to accomplish, here, is to make it fail-safe.> So, tell them to run bin/run_server instead of script/server? Not > that hard.I appreciate your reply -- I really do! -- but that''s not what I''m asking... :) I''m trying to learn how to CONFIGURE my app such that, when I start it with "ruby scripts/server", it defaults to some port other than 3000. I''m not trying to learn how to create a wrapper script. I''m not trying to learn how to change the behaviour of a group of people I don''t control. I''m trying to learn how to configure my rails app. One rather heavy-handed approach is to use mongrel clusters. Mongrel has a configuration file that lets me specify that my app fire up on whatever port I put in the config file. This works quite well, but is a bit ham-fisted for what I''m trying to do. I''m trying to ask if there''s a way to do this using standard "out of the box" rails (implied: w/WEBrick.) Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/12/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Pat Maddox wrote: > > On 10/12/07, Olie D. <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> > By "wrapper" I meant a little shell script > > >> If I could count on my installation people to run my little shell > >> script, I could just ask them to use -p 3001 :) The whole thing I''m > >> trying to accomplish, here, is to make it fail-safe. > > > So, tell them to run bin/run_server instead of script/server? Not > > that hard. > > I appreciate your reply -- I really do! -- but that''s not what I''m > asking... :) > > I''m trying to learn how to CONFIGURE my app such that, when I start it > with "ruby scripts/server", it defaults to some port other than 3000. > > I''m not trying to learn how to create a wrapper script. I''m not trying > to learn how to change the behaviour of a group of people I don''t > control. I''m trying to learn how to configure my rails app. > > One rather heavy-handed approach is to use mongrel clusters. Mongrel > has a configuration file that lets me specify that my app fire up on > whatever port I put in the config file. This works quite well, but is a > bit ham-fisted for what I''m trying to do. I''m trying to ask if there''s > a way to do this using standard "out of the box" rails (implied: > w/WEBrick.) > > Thanks!Yes, there is, and you already know about it. It''s the -p option. Here''s what you''re failing to understand. The web server is independent from the app itself. So, you''re going to need to configure the web server, not the rails app. This means either passing in an extra option to the server, or creating a config file in mongrel''s case. You can change script/server to be #!/usr/bin/env ruby unless ARGV.include?("-p") ARGV << "-p" ARGV << "3001" end require File.dirname(__FILE__) + ''/../config/boot'' require ''commands/server'' which will start it up on port 3001 unless some other port is specified. If that''s not good enough for you, sorry. Also, I didn''t know that trick until two minutes ago. I just saw that script/server requires commands/server. So I googled "rails commands server" and the first result was http://dev.rubyonrails.org/browser/trunk/railties/lib/commands/server.rb?rev=5103 Then I looked at http://dev.rubyonrails.org/browser/trunk/railties/lib/commands/servers/webrick.rb?rev=5103 to see exactly how it was getting the port...and modified script/server to do that. So this stuff is pretty easy to figure out if you spend a few minutes exploring. Pat --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---