Suggestions For Running Rails 2 App - ruby-on-rails

I have an old Rails 2.0.1/Ruby 1.8.7 app that I need to run in a production environment on Ubuntu 14.04 until it gets finished porting to Rails 4 and I'd like to get some advice on what stack to use. I've been trying to get it going with nginx 1.7.10 and Passenger 5.0.4 but the Rails app doesn't seem to load and I get 404's. Same thing is happening for me, though, when going to Passenger 3.0.19 and nginx 1.6.2 or combinations of the above. I also tried Passenger standalone and get the same problem. The only thing that's worked so far is the Webrick server that comes standard in script/console.
Would love to get your suggestions.
Thanks

well this doesn't answer the question completely as to what problem was the cause, but I was able to copy the gems, nginx version, passenger version, from another server running the Rails 2 application and it worked. Here is a list of the versions of everything:
nginx 1.6.2
passenger 4.0.53
gems:
arel (6.0.0)
builder (3.2.2)
bundler (1.7.7)
bundler-unload (1.0.2)
chunky_png (1.3.3)
crack (0.4.2)
daemon_controller (1.2.0)
drx (0.4.5)
elif (0.1.0)
erubis (2.7.0)
executable-hooks (1.3.2)
fastthread (1.0.7)
gem-wrappers (1.2.7)
hike (1.2.3)
hpricot (0.6.164)
htmldoc (0.2.3)
i18n (0.6.11)
image_science (1.2.4)
journey (1.0.4)
json (1.8.1)
mail (2.6.3)
mime-types (1.17.2)
multi_json (1.10.1)
mysql (2.9.1)
netrc (0.9.0)
passenger (4.0.53)
pdfkit (0.6.2)
polyglot (0.3.5)
rack (1.5.2)
rack-cache (1.2)
rake (0.9.2.2)
rdoc (4.1.2)
rest-client (1.6.7)
ri_cal (0.8.8)
rqrcode (0.4.2)
rqrcode_png (0.1.5)
rubygems-bundler (1.4.4)
rubygems-update (2.4.4)
RubyInline (3.12.3)
rvm (1.11.3.9)
safe_yaml (1.0.4)
sprockets (2.12.3)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.5.3)
tzinfo (1.2.2)
wkhtmltopdf (0.1.2)
ZenTest (4.11.0)
thank you hmallett and everyone else that looked at this

Related

Unable to start any debugging session in Aptana 3

I cannot seem to launch any debugging session from within Aptana Studio 3. I click "Debug Server" but nothing shows up anywhere and nothing happens.
I have found a couple various posts, none of which actually solved my problem. I'm a noob when it comes to ruby on rails development (I'm a seasoned Visual Studio user, however) so I imagine there's something I'm doing that's dumb.
Here is my setup:
1) $ rails -v Rails 4.1.0
2) $ ruby -v
ruby -v
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]
3) DevKit is installed
4) ruby-debug-ide is installed:
$ gem list
* LOCAL GEMS *
actionmailer (4.1.0)
actionpack (4.1.0)
actionview (4.1.0)
activemodel (4.1.0)
activerecord (4.1.0)
activesupport (4.1.0)
arel (5.0.1.20140414130214)
bigdecimal (1.2.0)
builder (3.2.2)
bundler (1.6.2)
coffee-rails (4.0.1)
coffee-script (2.2.0)
coffee-script-source (1.7.0)
debase (0.0.9)
debugger-ruby_core_source (1.3.2)
erubis (2.7.0)
execjs (2.0.2)
hike (1.2.3)
i18n (0.6.9)
io-console (0.4.2)
jbuilder (2.0.7)
jquery-rails (3.1.0)
json (1.8.1, 1.7.7)
mail (2.5.4)
mime-types (1.25.1)
minitest (5.3.3, 4.3.2)
multi_json (1.9.3)
polyglot (0.3.4)
psych (2.0.0)
rack (1.5.2)
rack-test (0.6.2)
rails (4.1.0)
railties (4.1.0)
rake (10.3.1, 0.9.6)
rbx-require-relative (0.0.9)
rdoc (4.1.1, 4.0.0)
ruby-debug-ide (0.4.22)
sass (3.2.19)
sass-rails (4.0.3)
sdoc (0.4.0)
sprockets (2.12.1, 2.11.0)
sprockets-rails (2.1.3)
sqlite3 (1.3.9 x64-mingw32)
test-unit (2.0.0.0)
thor (0.19.1)
thread_safe (0.3.3)
tilt (1.4.1)
treetop (1.4.15)
turbolinks (2.2.2)
tzinfo (1.1.0)
uglifier (2.5.0)
3) Aptana Studio 3
4) Windows 7, 64-bit.
I made a quick YouTube video of me showing the issue as well as showing some locally installed gems, etc. Perhaps this reveal what I'm doing wrong.
http://www.youtube.com/watch?v=5QcK_cKYxCs&feature=youtu.be
Thanks in advance.
Rails 4.0 project not starting through aptana studio 3
Ooops. It was found already. The problem was my error was different (I was seeing no output); but the resolution was the same.
Basically just create a Script folder in the project directory and copy over the "rails" executable (found within your bin folder) to this directory.

Deploying Rails App on OVH shared hosting

I'm very new to the RoR world (3 days), and I'm facing with the following problem: I have a shared hosting on OVH and I have to deploy my Rails app on it, how can I do it?
I have only access to the folder containing the www directory with FTP protocol. No SSH connection.
There is only one hint to how to deploy it, but it doesn't works:
http://help.ovh.co.uk/RubyOnRails .
When I follow the instructions, the InstantRails does not create any .htaccess in the main root.
Some experienced with the Rails world can help me?
PS: OVH doesn't provides Passenger, Capistrano and so forth.
Thank u!!
From my experience hosting a full-stack rails app on a shared hosting environment is next to impossible, there are many limitations towards the gems you can install and the web server you can use.
If you are able to then you should consider using a PaaS, like Heroku, Engineyard or OpenShift. Or if you are comfortable in linux environment - a VPS.
You could but you cannot install gem and this is the list of gem installed
$ gem list
*** LOCAL GEMS ***
actionmailer (4.1.8)
actionpack (4.1.8)
actionview (4.1.8)
activemodel (4.1.8)
activerecord (4.1.8)
activesupport (4.1.8)
arel (5.0.1.20140414130214)
atomic (1.1.16)
bigdecimal (1.2.4)
builder (3.2.2)
bundler (1.7.4)
celluloid (0.15.2)
cmdparse (2.0.6)
coffee-rails (4.0.1)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
daemons (1.1.9)
erubis (2.7.0)
execjs (2.2.1)
ffi (1.9.6)
hike (1.2.1)
i18n (0.6.9)
io-console (0.4.2)
jbuilder (2.1.3)
jquery-rails (3.1.2)
json (1.8.1)
listen (2.4.0)
log4r (1.1.10)
mail (2.6.1)
metaclass (0.0.4)
mime-types (1.25)
minitest (5.4.2, 4.7.5)
mocha (1.1.0)
multi_json (1.10.1)
ncursesw (1.4.8)
net-http-persistent (2.9)
oj (2.10.3)
polyglot (0.3.4)
psych (2.0.5)
rack (1.5.2)
rack-test (0.6.2)
rails (4.1.8)
railties (4.1.8)
rake (10.3.2, 10.1.0)
rb-inotify (0.9.5)
rdoc (4.1.0)
RedCloth (4.2.9)
ruby-shadow (2.3.4)
sass (3.4.6)
sass-rails (4.0.3)
sdoc (0.4.1)
spring (1.1.3)
sprockets (2.12.3)
sprockets-rails (2.1.3)
sqlite3 (1.3.9)
test-unit (2.1.5.0)
thor (0.19.1)
thread_safe (0.3.3)
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.15)
turbolinks (2.2.2)
tzinfo (1.1.0)
uglifier (2.5.3)
yajl-ruby (1.2.0)

bundle updated then sprockets throw filenotfound error rails 3.2.3 ruby1.9.3p194

I have been running Rails 3.2.3 everything ran fine. Last night I did a bundle update to update every thing in my Gemfile and here's the update log.
Updating git://github.com/stefants/negative-captcha.git
Fetching gem metadata from http://rubygems.org/......
Fetching gem metadata from http://rubygems.org/..
Using rake (0.9.2.2)
Using i18n (0.6.0)
Installing multi_json (1.3.4)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Installing sprockets (2.1.3)
Using actionpack (3.2.3)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Installing tzinfo (0.3.33)
Using activerecord (3.2.3)
Using activeresource (3.2.3)
Installing addressable (2.2.8)
Using bundler (1.1.3)
Using rack-ssl (1.3.2)
Installing json (1.7.1) with native extensions
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.3)
Using rails (3.2.3)
Using awesome_nested_fields (0.6.0)
Using xml-simple (1.1.1)
Using aws-s3 (0.6.2)
Using bcrypt-ruby (3.0.1)
Installing bson (1.6.2)
Installing bson_ext (1.6.2) with native extensions
Installing business_time (0.6.1)
Using cancan (1.6.7)
Installing carrierwave (0.6.2)
Installing mongo (1.6.2)
Installing mongoid (2.4.9)
Installing carrierwave-mongoid (0.2.0)
Using chronic (0.6.7)
Installing cocoon (1.0.20)
Installing coderay (1.0.6)
Installing coffee-script-source (1.3.1)
Installing execjs (1.3.2)
Using coffee-script (2.2.0)
Using coffee-rails (3.2.2)
Using coffeebeans (1.0.1)
Using datejs-rails (1.1.0)
Installing delayed_job (3.0.2)
Using delayed_job_mongoid (1.0.8)
Using orm_adapter (0.0.7)
Using warden (1.1.1)
Using devise (2.0.4)
Using ejs (1.0.0)
Using eventmachine (0.12.10)
Using em-websocket (0.3.6)
Installing excon (0.13.4)
Using faker (1.0.1)
Using multipart-post (1.1.5)
Using faraday (0.7.6)
Using ffi (1.0.11)
Using formatador (0.2.1)
Using net-ssh (2.3.0)
Using net-scp (1.0.4)
Using nokogiri (1.5.2)
Using ruby-hmac (0.4.0)
Using fog (1.3.1)
Using git (1.2.5)
Using term-ansicolor (1.0.7)
Installing grizzled-rails-logger (0.1.3)
Using rb-appscript (0.6.1)
Using growl_notify (0.0.3)
Installing guard (1.0.2)
Using guard-livereload (0.4.2)
Using hirb (0.6.2)
Using humane-rails (2.8.0.0.1.2)
Using jeweler (1.8.3)
Installing jquery-rails (2.0.2)
Installing jquery-ui-rails (0.4.0)
Using kaminari (0.13.0)
Using knockout-rails (1.0.1)
Using method_source (0.7.1)
Using momentjs-rails (1.5.0)
Using mongoid-data_table (1.3.3)
Using mongoid-eager-loading (0.3.1)
Using negative-captcha (0.1.0) from git://github.com/stefants/negative-captcha.git (at master)
Using nifty-generators (0.4.6)
Installing oauth (0.4.6)
Using oauth2 (0.5.2)
Using typhoeus (0.3.3)
Using panda (1.5.0)
Using slop (2.4.4)
Installing pry (0.9.9.4)
Using pry-rails (0.1.6)
Installing rails-backbone (0.7.2)
Using rb-fchange (0.0.5)
Installing rb-fsevent (0.9.1)
Using rb-inotify (0.8.8)
Using rest-client (1.6.7)
Installing sass (3.1.17)
Using sass-rails (3.2.5)
Installing simple_form (2.0.2)
Installing simple_oauth (0.1.7)
Using stripe (1.6.3)
Installing stylus-source (0.26.0)
Installing stylus (0.5.1)
Using uglifier (1.2.4)
Using underscore-rails (1.3.1)
Using webshims-rails (0.1)
Using wirble (0.1.3)
Using youtube_it (2.1.4)
Using zero-clipboard-rails (1.0.1)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
Then I restarted the server and now Sprockets::FileNotFound errors are thrown for some #import "file.css" line in my sass files.
I did some research on the Sprockets gem, I found that the current version is 2.4.2. But my bundle update updated the sprockets to 2.1.3. Is this what is out there for your Rails apps, too, that the sprockets used by Rails is a few versions behind Github's? -- And how should I approach this Sprockets::FileNotFound problem?
APPEND: I just also saw that the sprockets in the gemfile.lock to be of version 2.1.2. yet bundle show sprockets says 2.1.3.
Thank you
try to remove Gemfile.lock (backup first) and run bundle install once again

Cross-thread violation on rb_gc()

The codebase I'm working on was recently upgraded from Ruby 1.9.2 to Ruby 1.9.3 and from Rails 3.1 to Rails 3.2.2. Since I'm using RVM I simply did rvm install 1.9.3 which I would have expected to be all that was necessary.
When I run
rails s
I get the error
[BUG] cross-thread violation on rb_gc()
I've found a number of links relating to this problem. There is one on StackOverflow, but it doesn't really give an answer. The most promising answer is on the RVM site:
In every case of this I have seen thus far it has always ended up
being that a ruby gem/library with C extensions was compiled against a
different ruby and/or architecture than the one that is trying to load
it. Try uninstalling & reinstalling gems with C extensions that your
application uses to hunt this buggar down.
That's fairly helpful, but my Ruby-fu is not strong enough to know which gems have C extensions and which ones I should try to re-install. Quite a few of the other links on the topic seem to suggest that the json gem is at fault, so I tried following the suggested solution.
gem uninstall json
gem install --platform=ruby
This didn't really change anything for me—I still get the exact same error when trying to start the Rails environment.
How do I track down this problem?
If it helps, here is the output from gem list:
actionmailer (3.2.2)
actionpack (3.2.2)
activemodel (3.2.2)
activerecord (3.2.2)
activeresource (3.2.2)
activesupport (3.2.2)
addressable (2.2.7)
akami (1.0.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bson (1.6.1)
bson_ext (1.6.1)
builder (3.0.0)
bundler (1.1.3, 1.0.21)
capybara (1.1.2)
carmen (0.2.13)
childprocess (0.3.1)
ci_reporter (1.7.0)
coderay (1.0.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.2.0)
commonjs (0.2.5)
cucumber (1.1.9)
cucumber-rails (1.3.0)
database_cleaner (0.7.2)
devise (2.0.4)
diff-lcs (1.1.3)
ejs (1.0.0)
email_spec (1.2.1)
engineyard (1.4.28)
engineyard-serverside-adapter (1.6.3)
erubis (2.7.0)
escape (0.0.4)
execjs (1.3.0)
factory_girl (3.0.0)
factory_girl_rails (3.0.0)
faker (1.0.1)
fakeweb (1.3.0)
ffi (1.0.11)
gherkin (2.9.3)
gyoku (0.4.4)
haml (3.1.4)
haml-rails (0.3.4)
hash-deep-merge (0.1.1)
highline (1.6.11)
hike (1.2.1)
httpi (0.9.6)
i18n (0.6.0)
jasmine (1.1.2)
jasmine-core (1.1.0)
jasminerice (0.0.8)
journey (1.0.3)
jquery-rails (2.0.1)
json (1.6.6)
json_pure (1.6.6)
kaminari (0.13.0)
kgio (2.7.4)
launchy (2.0.5)
less (2.1.0)
less-rails (2.2.0)
libv8 (3.3.10.4 x86_64-darwin-11)
log4r (1.1.10)
mail (2.4.4)
metaclass (0.0.1)
method_source (0.7.1)
mime-types (1.18)
mocha (0.10.5)
mongo (1.6.1)
mongoid (2.4.7)
mongoid-rspec (1.4.4)
multi_json (1.2.0)
net-ssh (2.2.2)
newrelic_rpm (3.3.3)
nokogiri (1.5.2)
nori (1.1.0)
open4 (1.3.0)
orm_adapter (0.0.7)
polyglot (0.3.3)
pr_geohash (1.0.0)
pry (0.9.8.4)
pry-highlight (0.0.1)
pry_debug (0.0.1)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.2)
rails-footnotes (3.7.6)
railties (3.2.2)
raindrops (0.8.0)
rake (0.9.2.2)
rdoc (3.12)
recursive-open-struct (0.2.1)
rest-client (1.6.7)
rpm_contrib (2.1.8)
rsolr (1.0.7)
rspec (2.9.0)
rspec-core (2.9.0)
rspec-expectations (2.9.0)
rspec-mocks (2.9.0)
rspec-rails (2.9.0)
rubyzip (0.9.6.1)
sass (3.1.15)
sass-rails (3.2.5)
savon (0.9.9)
selenium-webdriver (2.20.0)
settings-tree (0.2.1)
simplecov (0.6.1)
simplecov-html (0.5.3)
simplecov-rcov (0.2.3)
slop (2.4.4)
spine-rails (0.1.0)
spork (1.0.0rc2)
sprockets (2.1.2)
sunspot (1.3.1)
sunspot_mongoid (0.4.1)
sunspot_rails (1.3.1)
sunspot_solr (1.3.1)
term-ansicolor (1.0.7)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
twitter-bootstrap-rails (2.0.6)
tzinfo (0.3.32)
uglifier (1.2.4)
unicorn (4.2.1)
warden (1.1.1)
wasabi (2.1.0)
xpath (0.1.4)
Here are various approaches you can try.
cleanup
To clean up old versions of your gems:
gem cleanup --dryrun
json
To temporarily see if the json gem is the issue, switch from json (native) to json (pure ruby) and change your Gemfile:
gem install json_pure
native gems
Your gem list has a few that pop out for me as native:
bcrypt
bson
erubis
ffi (enables lots of native connections)
gherkin
kgio
less
nokogiri
raindrops
therubyracer (many unpredictable issues IMHO)
unicorn
ffi
Your gem ffi is especially interesting -- do you happen to know what you're doing with it?
The ffi enables Ruby code to call native code, for example if some part of your Ruby app needs to connect to native libraries.
When you're diagnosing your issue, I'd look at this gem first.
makefiles
To find any of your gems that have Makefile files, which is a good indicator that they have native code:
find / | grep "/ruby/gems/" | grep Makefile
To find all your gems so you can delete them:
find / | grep "/ruby/gems/"
nuke RVM
To nuke RVM or its pieces, you can use rvm uninstall, rvm implode, or this script which nukes RVM and finds any lingering pieces:
https://raw.github.com/SixArm/sixarm_unix_shell_scripts/master/rvm-uninstall-danger
try rbenv + bundler
I changed from using rvm to using rbenv + bundler and it's working great for me.
The rbenv tool is a direct competitor to rvm for managing Ruby versions:
https://github.com/sstephenson/rbenv
Bundler is a great way to manage gemsets and gem dependencies:
http://gembundler.com/
brew
If you're on a Mac and using MacPorts, to change to Homebrew:
Link
Uninstall all verions of json gems by running:
gem uninstall json
Then run:
gem install json --platform=ruby
Run bundle again:bundle install
You should try nuking all of your gems and reinstall them for your app using the bundle command.
Quoting the RVM documentation for this error:
Try uninstalling & reinstalling gems with C extensions that your application uses to hunt this buggar down.
The command to remove gems with RVM is simply:
rvm uninstall
A clean reinstall of RVM latest is the best option.
rvm implode
rm -rf ~/.rvm
curl -L get.rvm.io | bash -s stable
Before going the clean ruby/rvm install route you should check if you have removed ruby 1.8.7 (which is installed by default on most distributions). I believe this was interfering with some of my gems compiled with 1.9.2 (I think it was one of the native ones). I removed 1.8.7 completely using apt-get then I made a new rvm profile (by changing the profile name in .rvmrc) and then ran bundle install to refresh all the gems completely.

Ruby on rails passenger apache problem

I did, gem install passenger, passenger-install-apache2-module
http://localhost/
I'm getting this error.
http://pastebin.com/YfrEsv3X
Update
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.8)
actionpack (3.0.8)
activemodel (3.0.8)
activerecord (3.0.8)
activeresource (3.0.8)
activesupport (3.0.8)
arel (2.1.1, 2.0.10)
bcrypt-ruby (2.1.4)
builder (3.0.0, 2.1.2)
bundle (0.0.1)
bundler (1.0.15)
daemon_controller (0.2.6)
devise (1.3.4)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
i18n (0.6.0, 0.5.0)
mail (2.3.0, 2.2.19)
mime-types (1.16)
mysql (2.8.1)
mysql2 (0.3.2)
orm_adapter (0.0.5)
passenger (3.0.7)
pg (0.11.0)
polyglot (0.3.1)
postgres-pr (0.6.3)
rack (1.3.0, 1.2.3)
rack-mount (0.8.1, 0.6.14)
rack-test (0.6.0, 0.5.7)
rails (3.0.8)
railties (3.0.8)
rake (0.9.2, 0.8.7)
rubygems-update (1.8.5)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27)
warden (1.0.4)
You need to install the bundler gem as well.
Update
Now that the OP has posted his gemset...
You must have two gemsets, usually this is because you're using two different rubys. The gem command is just a script, with a shebang line pointing to a Ruby. The gem list you're showing will be the gemset for that Ruby. You can see this with this command: head -1 $(which gem)
Your passenger configuration must be pointing to a different Ruby with a different gemset. You can see this in your passenger.conf lines for Apache.
I suspect after installing the bundler gem - you may experience other problems if your Gemfile doesn't include all the gems your project requires.
So next time - look at the error message.
no such file to load -- bundler
from the above example - you can notice that 'bundler' is causing the problem.
That will give you a clue as what other gems you'd need to install and possibly missed out in your Gemfile - in which case issue the command:
gem install <missing-gem>

Resources