Rubymine Thin with SSL Settings

I can use thin with

bundle exec thin start --ssl --ssl-verify --ssl-key-file /private/etc/apache2/ssl/server.key --ssl-cert-file /private/etc/apache2/ssl/server.crt 

It works in console / terminal, excellent

But when I try to add these parameters to rubymine under "Run / Debug Configurations" → "Edit Script Arguments", I get:

 /Users/jan/.rbenv/versions/1.9.3-p392/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/jan/RubymineProjects/myapp/script/rails server thin -b 0.0.0.0 -p 3000 -e development --ssl-verify --ssl-key-file /private/etc/apache2/ssl/server.key --ssl-cert-file /private/etc/apache2/ssl/server.crt /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:33:in `parse!': invalid option: --ssl-verify (OptionParser::InvalidOption) from /Users/jan/.gem/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:283:in `parse_options' from /Users/jan/.gem/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:180:in `options' from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:54:in `set_environment' from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:42:in `initialize' from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `new' from /Users/jan/.gem/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>' from /Users/jan/RubymineProjects/myapp/script/rails:6:in `require' from /Users/jan/RubymineProjects/myapp/script/rails:6:in `<top (required)>' from -e:1:in `load' from -e:1:in `<main>' 

Process terminated with termination code 1 Can anyone help us / me?

many thanks!

+7
source share
4 answers

I got help here:

http://devnet.jetbrains.com/message/5490676

It seems that Rubymine cannot parse such arguments, but the workaround is to execute the Ruby script from Run / Debug configurations

+3
source

Use the following method

 require 'rack' SERVER_KEY = File.expand_path('../../ssl-cert/host.key', __FILE__) SERVER_PEM = File.expand_path('../../ssl-cert/host.crt', __FILE__) # Thin SSL workaround module Rack module Handler class Thin def self.run(app, options={}) app = Rack::Chunked.new(Rack::ContentLength.new(app)) server = ::Thin::Server.new(options[:Host] || '0.0.0.0', options[:Port] || 3000, app) server.ssl = true server.ssl_options = { :private_key_file => SERVER_KEY, :cert_chain_file => SERVER_PEM } yield server if block_given? server.start end end end end # Workaround end APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands' 
+4
source

You cannot use the --ssl-verify

+1
source

Apparently, this can really be removed by adding a Procfile and a gemstone wizard, as in this set of instructions:

Using Rails, Thin, and SSL in RubyMine: The Solution!

Basically, you add wizards to your Gemfile:

 gem 'foreman' 

Then create a Procfile (link seals it) in your root containing this:

 web: thin start --ssl 

or, to bind to 0.0.0.0, as RubyMine usually does:

 web: thin start -a 0.0.0.0 -p 3001 --ssl 

I did not need to specify the location of my ssl files, but if you want, it will be:

 web: thin start -a 0.0.0.0 -p 3001 --ssl --ssl-key-file /private/etc/apache2/ssl/server.key --ssl-cert-file /private/etc/apache2/ssl/server.crt 

I would not recommend using --ssl-verify because this did not work for me.

Finally, in RubyMine, create a new Ruby configuration with the following attributes:

  • Ruby script . This should be the path to the wizard's executable, for example: ~/.rvm/gems/ ruby-2.3.0@gemset /gems/foreman-0.82.0/bin/foreman
  • Script arguments : start
  • Working directory . The root directory of your project, for example. ~/Sites/appname

On the Bundler tab, check the box to use bundle exec at startup.

Finally, on the logs tab, add a new log file pointing to ~/Sites/appname/logs/development.log

0
source

All Articles