Thin HTTP WebServer on Windows - ruby-on-rails

I'm currently trying to get Thin webserver running on Windows, to form a basic cluster behind a NGINX proxy, but this is proving to be rather difficult.
I was wondering if anyone actually succeeded in getting this up and running?
To give some examples of the things I have tried:
C:\Users\arne.de.herdt.TENFORCE2\RubymineProjects\ESCO>thin start
C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in `report_activate_error': Rub
yGem version error: thin(1.2.11 not >= 0) (Gem::LoadError)
from C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in `activate_dep'
from C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate'
from C:/Ruby/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem'
from C:/Ruby/bin/thin:18:in `<main>'
I really don't get this error message. I've included below the environmental output of my system that I'm trying this on (my development system)
RubyGems Environment:
- RUBYGEMS VERSION: 1.7.2
- RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby/lib/ruby/gems/1.9.1
- C:/Users/arne.de.herdt.TENFORCE2/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Hoping someone has been experimenting with this.
Also I must say that it's starting to annoy me that the lack for Windows support is such a serious issue with Ruby on Rails. I really enjoy the language and programming in it, but it's a pain getting things to work on Windows machines because of uncompilable dependencies...

Thin ain't supported under Windows.....

Related

No rails in ubuntu whem i "cd" to project dir

I lose my patience to rails on ubuntu. So far I have used the ready environment on c9, but it is slowly closing. I'm learning how to deal with rails and I have a problem with Ubuntu.
I use tutorials (many) to install it. Finally, I did it, and I created a small project. One page + one model + one controller. Commit, exit, turn off a notebook.
Today when I want to back to programming I opened a terminal and go to project dir /Desktop/Projc/test. And after typed rails s I got the message:
Command 'rails' not found, but can be installed with:
sudo apt install ruby-railties
And what is weird, If I open a terminal in home dir rails are ok. I can create a new project etc. But in the existing project rails "are not installed".
I spent a few hours to look for a solution, reads many posts (so: 10918685, 7788946, 16884034) but nothing help.
I'm afraid that I just did a bigger mess.
Can someone try to help me with my case?
My configs:
gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.1
- RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/iso/.rvm/gems/ruby-2.6.1
- USER INSTALLATION DIRECTORY: /home/iso/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /home/iso/.rvm/rubies/ruby-2.6.1/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/iso/.rvm/gems/ruby-2.6.1/bin
- SPEC CACHE DIRECTORY: /home/iso/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/iso/.rvm/rubies/ruby-2.6.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/iso/.rvm/gems/ruby-2.6.1
- /home/iso/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/iso/.rvm/gems/ruby-2.6.1/bin
- /home/iso/.rvm/gems/ruby-2.6.1#global/bin
- /home/iso/.rvm/rubies/ruby-2.6.1/bin
- /home/iso/.rvm/bin
- /home/iso/.rbenv/plugins/ruby-build/bin
- /home/iso/.rbenv/shims
- /home/iso/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
echo $PATH:
/home/iso/.rvm/gems/ruby-2.6.1/bin:/home/iso/.rvm/gems/ruby-2.6.1#global/bin:/home/iso/.rvm/rubies/ruby-2.6.1/bin:/home/iso/.rvm/bin:/home/iso/.rbenv/plugins/ruby-build/bin:/home/iso/.rbenv/shims:/home/iso/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
rails -v: 5.2.3
ruby -v: 2.6.0p0
Can someone see a solution? And in the terminal, I have a checked a "run as start shell".

Debian Passenger error: cannot load such file -- bundler (LoadError)

I am running Apache on my Raspberry Pi (Raspbian) and struggling to get Passenger working properly with my site. When I go to visit my site (which is set up as a VirtualHost), I get the error: "cannot load such file -- bundler". The first line of the backtrace is
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb
To install Passenger, I followed the instructions here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#install_on_debian_ubuntu.
In particular, I ran the command
sudo apt-get install libapache2-mod-passenger
This link says, "The Apache package provides configuration snippets for you, so you don’t need to modify any Apache configuration to get it to load Phusion Passenger". The way the installation went on my machine was that it automatically added and enabled the passenger module through the files "passenger.conf" and "passenger.load":
passenger.conf:
<IfModule mod_passenger.c>
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>
passenger.load:
LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so
Running "gem env" gives me the following output:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.7
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [armv6l-linux-eabihf]
- INSTALLATION DIRECTORY: /home/user/.rvm/gems/ruby-2.0.0-p247
- RUBY EXECUTABLE: /home/user/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /home/user/.rvm/gems/ruby-2.0.0-p247/bin
- RUBYGEMS PLATFORMS:
- ruby
- armv6l-linux
- GEM PATHS:
- /home/user/.rvm/gems/ruby-2.0.0-p247
- /home/user/.rvm/gems/ruby-2.0.0-p247#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
I tried looking all over for a mod_passenger.so file elsewhere in the file system with no luck. I am reluctant to simply reinstall rails or passenger because I am unsure what the implications will be for the modules and configuration. Any advice is appreciated, thanks!
Maybe you didn't configure your app to use Ruby 2.0.0? If you don't do that explicitly, it will use the default Ruby, which is /usr/bin/ruby. This section from the manual tells you how to specify a different Ruby: http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerRuby
Note that multiple Ruby supports requires Phusion Passenger >= 4.0.0.
The problem ended up being that I needed to set the environment variable for the GEM_PATH within a .htaccess file!

Ruby Rails webrick server using old version of ruby

ruby -v give me ruby-1.9.3-p194.
which ruby gives /home/ubuntu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
rails -v gives Rails 3.2.7
which rails gives /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/bin/rails
"sudo bundle exec rails s" gives:
ubuntu#ip-10-117-73-5:~/ruby/users$ sudo bundle exec rails s
=> Booting WEBrick
=> Rails 3.2.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-09-11 20:13:08] INFO WEBrick 1.3.1
[2012-09-11 20:13:08] INFO ruby 1.8.7 (2011-06-30) [i686-linux]
[2012-09-11 20:13:08] INFO WEBrick::HTTPServer#start: pid=4240 port=3000
rvn info gives me:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i686-linux]
- INSTALLATION DIRECTORY: /home/ubuntu/.rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /home/ubuntu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /home/ubuntu/.rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/ubuntu/.rvm/gems/ruby-1.9.3-p194
- /home/ubuntu/.rvm/gems/ruby-1.9.3-p194#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
However when I run rails server I see below.
[2012-09-11 18:19:53] INFO ruby 1.8.7 (2011-06-30) [i686-linux]
I have no clue where this is coming from.
I have done "bundle install" and "bundle update" and a whole slew of things - it still is using the wrong ruby version. What do I need to do?
EDIT:
$PATH variable also only shows me 1.9.3 relevant information, how the heck is Webrick getting 1.8.7! If I remove that folder - it just doesn't start at all
Well seems what i needed was
rvmsudo rails server
I am just now learning when to use sudo and when not to - this was a painful experience.
Problem was that 1.8.7 was installed for sudo - while everything else was right for my user. But since I couldn't run 'rails server' by itself due to my previous incorrect installation, i had to use 'sudo rails server' - which ended up using the older ruby version.

Unit test runs three times

I'm trying to run a single unit test in my Rails app, I'm using the following command to run the test (say my model is users)
rake test TEST=test/unit/user_test.rb
It runs with out a problem, but for some reason it runs three times; can anyone explain me why is that and if I'm doing something wrong above? Following is my gem env, and I'm using Rails 2.3.2.
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.10
- RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/sameera/.rvm/gems/ruby-1.8.7-p357
- RUBY EXECUTABLE: /home/sameera/.rvm/rubies/ruby-1.8.7-p357/bin/ruby
- EXECUTABLE DIRECTORY: /home/sameera/.rvm/gems/ruby-1.8.7-p357/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/sameera/.rvm/gems/ruby-1.8.7-p357
- /home/sameera/.rvm/gems/ruby-1.8.7-p357#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
In a rails app rake test runs 3 subtasks, test:units, test:functionals, test:integration.
Each of those tasks just runs all the tests from the corresponding folder, but your environment variable overrides that search process and so the same file is found each time.
You could either do
rake test:units TEST=...
or
ruby -I test test/unit/user_test.rb

Command Not Found even after changing path variable

Using heroku for deployment while learning Rails with the Ruby On Rails tutorial by Michael Hartl, on Ubuntu 11.04 Natty Narwhal. I installed it using
sudo gem install heroku
and the commands seemed to run fine for that session in the terminal. The next time I went to work, I tried the command "heroku open" and I was told "heroku: command not found". Looking at some of the answers to similar problems here, it seemed the answer was to run
gem enviroment
which returned the following:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/richard/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I then ran
$ export PATH=$PATH:/var/lib/gems/1.8/bin
which seemed to fix the problem. However, the next time I tried to run heroku in the terminal, I was told "command not found" again! Running the "export PATH=$PATH" command seems to fix the problem every time, but I would rather I didn't have to run this command everytime I want to use heroku. Is there any permanent solution to the problem?
If you're using bash as your shell, then add that export line to .bash_profile in your home directory. The equivalent for zsh is .zshrc, and other shells have their own files to automatically load for every shell session.

Resources