How to deploy a test application on Dreamhost Rails 3.0.4?

This weekend I tried to configure the Rails 3.0.4 application on a shared Dreamhost server. I followed this wiki article to have my own set of rubygems settings on the server. In addition, I also installed rvm and ruby ​​1.9.2 using the following command:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. rvm use 1.9.2 --default 

Running ruby -v returns ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] , so I believe rvm installed the ruby ​​version correctly.

I created my application that started the mysql database and then generated an article controller:

 rails new test_app -d mysql cd test_app rails g scaffold articles title:string body:text 

Now, when I visit the domain, I see the usual "Welcome aboard Youre, back on Ruby on Rails!" screen, but if I click on the "About your application environment" link, I get what looks like my passenger’s error:

The Ruby (Rack) application cannot be started. The application exited at launch time (i.e. during evaluation of config / environment.rb). The error message may have been written to the web server log file. Check the web server log file (i.e. the Rails application log file) to find out why the application exited. If this does not help, use the tip below to debug the problem.

Finally, if I find SSH on the server and just do rails s , I can see how the application works correctly on port 3000.

I have never added an application to production before, so I'm very confused. Does the passenger really not use the RVM version of the ruby? Is this possible on a shared DreamHost server? What do I need to do to fix this problem?

Any help is appreciated, thanks.

+4
source share
2 answers

I was able to successfully get the Rails 3.2.2 application deployed to Dreamhost. Here are some notes that I wrote for myself.


On a local development machine

First, Dreamhost Passenger is based on Ruby 1.8.7, not Ruby 1.9.2. Because of this, Dreamhost will not like some of your Ruby code, because it has some new key value syntax. So look for this code:

 key: "value" 

and change to Ruby 1.8.7 style (which Ruby 1.9.2 can also understand):

 :key => "value" 

I found that you can find this code by doing something like this ... it can be done more efficiently in the * nix window, but this is how I did it on Windows with the * nix commands installed:

 egrep -r -i "^.*\w: .*$" . | grep rb 

After correcting the syntax, you will want to collect your gems so that Dreamhost does not complain about your version in the rack.

 $> bundle package 

On the server (aka Dreamhost)

(Get your files on dreamhost. Personally, I commit and paste the changes to the remote git repository, then git pulls them into a private folder on Dreamhost. I copy them to the Passenger folder)

Then I run these commands from the Rails application folder ( /home/username/www.myapp.com/ ):

 $> bundle install --path vendor/bundle --local $> rake db:migrate RAILS_ENV="production" $> bundle exec rake assets:precompile $> touch tmp/restart.txt 

Voila, it seems to work. If it still does not work, check the / production.log log.

+4
source

I ran into the same problem. I believe, because the passenger does not load the ruby ​​interpreter that you specify in rvm, like it or the gems that you specify. You will probably see downloadable gems related to / usr / ... I came across this http://blog.ninjahideout.com/posts/the-path-to-better-rvm-and-passenger-integration , but I was not able to get around that Dreamhost uses ruby ​​1.8.7 in it. and you and I would like to use 1.9.2

+3
source

Source: https://habr.com/ru/post/1340708/


All Articles