Dashing uses thin ruby web server as default.
I'm trying to used puma as my ruby web server since I got issue with memory consumption with the default web server.
I have read in some github forums that the rufus-scheduler which is used to schedule jobs might be the cause of memory issue.
I set up gem 'puma' in mg GemFile & bundled it.
But every time I run my application, it uses thin web server again.
dashing start
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:3030, CTRL+C to stop
Please help on how to properly use puma web server on dashing.
Run your server using puma:
puma config.ru
Or run your server with rackup and specify puma as the server:
bundle exec rackup -s puma -p 3030
Explanation:
When you run dashing start, you're using the dashing CLI tool. The reason you can't run dashing with puma using the dashing CLI tool is because the use of thin is hard-coded. See the dashing CLI code.
Related
I'm having trouble learning how to use Sinatra.
Versions are
Mac OSX 10.11.2
Ruby 2.2.2
Sinatra 1.4.6
I wrote the same code as the first code in this site.
# main.rb
require 'sinatra'
get '/' do
'Hello world!'
end
Then I tried a command in the same derectory
% ruby main.rb
== Sinatra (v1.4.6) has taken the stage on 4567 for development with backup from Thin
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on localhost:4567, CTRL+C to stop
Then I accessed http://localhost:4567 with Google Chrome, but the browser didn't recieve any data (ERR_EMPTY_RESPONSE). Also nothing logged in Terminal.
I tried other port (like 3000) by -p option, but it didn't work.
What am I doing wrong?
I updated gem and reinstalled sinatra, then it worked.
gem update --system
gem uninstall sinatra
gem install sinatra
I have a simple web app on heroku running on Passenger and I am trying to make the emails asynchronous. I set it all up with Sidekiq in my dev environment and then I realized I have to start a new dyno on Heroku to run the Sidekiq worker and have to pay $34/m. I am trying to see if I can run Sidekiq on the web dyno with Passenger and save the $34/m cost for now till its worth that investment.
I found a post here that explains how to do this with Unicorn. I am wondering if I can do the same thing with Passenger.
If that doesn't work I will look at using sucker_punch or use unicorn instead but will be good if I can Sidekiq working on the same dyno with Passenger.
I am on rails 3.1, sidekiq 3.1.4 and passenger 4.0.5 - can upgrade here if I have to.
Thanks for your thoughts.
-S
You can. There's no difference between Passenger and Unicorn when it comes to achieving this goal. Instead of specifying web: bundle exec unicorn ... in your Procfile, you just set web: bundle exec passenger in your Procfile. Instead of setting a Unicorn config file, you set equivalent Passenger command line arguments or configuration.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i'm using sinatra to work with ruby , when i am run the file in the terminal the normal port for sinatra is "4567" , but for three days ago the terminal print this
Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2014-09-06 00:15:16] INFO WEBrick::HTTPServer#start: pid=770 port=4567
also the webrick port is "4567"
It's difficult to understand the problem you're seeing. Maybe this will help:
If I create a simple test server containing the sample Sinatra code:
require 'sinatra'
get '/hi' do
"Hello World!"
end
And save that to my Desktop as test.rb, I can run Sinatra using:
ruby test.rb
Sinatra tells me:
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Thin
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on localhost:4567, CTRL+C to stop
If I uninstall Thin:
gem uninstall thin
Remove executables:
thin
in addition to the gem? [Yn] y
Removing thin
Successfully uninstalled thin-1.6.2
And run the code again:
ruby test.rb
[2014-09-05 14:41:23] INFO WEBrick 1.3.1
[2014-09-05 14:41:23] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2014-09-05 14:41:23] INFO WEBrick::HTTPServer#start: pid=26786 port=4567
In either case, the code does what it's supposed to. I can connect using curl and get "Hello World!" back:
curl http://localhost:4567/hi
Hello World!
Sinatra uses Webrick by default, but will pick other servers over it:
gem install puma
Fetching: puma-2.9.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed puma-2.9.1
Parsing documentation for puma-2.9.1
Installing ri documentation for puma-2.9.1
Done installing documentation for puma after 3 seconds
1 gem installed
ruby test.rb
Puma 2.9.1 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:4567
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Puma
gem install thin
Fetching: thin-1.6.2.gem (100%)
Building native extensions. This could take a while...
Successfully installed thin-1.6.2
Parsing documentation for thin-1.6.2
Installing ri documentation for thin-1.6.2
Done installing documentation for thin after 0 seconds
1 gem installed
ruby test.rb
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Thin
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on localhost:4567, CTRL+C to stop
curl http://localhost:4567/hi
Hello World!
Use -s to control which server Sinatra uses:
ruby test.rb -s puma
Puma 2.9.1 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:4567
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Puma
Sinatra Docs:
:run - enable/disable the built-in web server Boolean specifying
whether the built-in web server is started after the app is fully
loaded. By default, this setting is enabled only when the :app_file
matches $0, i.e. when running a Sinatra app file directly with ruby
myapp.rb. To disable the built-in web server:
set :run, false
:server - handler used for built-in web server. String
or Array of Rack server handler names. When the :run setting is
enabled, Sinatra will run through the list and start a server with the
first available handler. The :server setting is set as follows by
default:
set :server, %w[thin mongrel webrick]
Sinatra README:
Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort:
# myapp.rb
require 'sinatra'
get '/' do
'Hello world!'
end
Install the gem:
gem install sinatra
And run with:
ruby myapp.rb
View at: http://localhost:4567
It is recommended to also run gem install thin, which Sinatra will pick up if available.
By default, Sinatra first looks to see if you have the Thin server software installed--if yes, Sinatra uses Thin to respond to requests on port 4567. If you do not have Thin installed, next Sinatra checks if you have the Mongrel server software installed, and Sinatra uses Mongrel if it is installed, and finally Sinatra uses the always available Webrick server software, which comes with ruby.
The message you are seeing is Sinatra telling you which server software it is using to respond to requests on port 4567.
Upon starting zeus & running zeus s, rails server boots with the default WEBrick web server. How can zeus be customized so that it boots passenger standalone by default.
(I have passenger standalone working in development environment, i can boot it with 'bundle exec passenger start' from the command line or with a hack to script bin/rails which defaults rails s to start with passenger.)
The closest thing to achieving this is to use guard, guard-passenger in combination with zeus.
guard-passenger gem is available at https://github.com/guard/guard-passenger
start zeus first and then start guard which will now automatically boot a rails server using passenger standalone configured in the app.
I'd like to start a Sinatra app from Mongrel on Windows, rather than Sinatra starting Mongrel in the background.
Is there a simple way to use Mongrel for Sinatra? It's looking for a rails app by default.
Edit: Suggested solution is to simply run a VMWare or SunBox with real Linux and deal with the corporate issues that way.
Check out http://sinatra-book.gittr.com/.
FastCGI is the chapter you're looking for within the page, because that's what mongrel is
if you have a rake config, like config.ru
then install thin gem
then
thin -p 3000 -r config.ru
I think.
-r