Need some advice on deploying my first rails app in mediatemple (dv)

I am trying to deploy my first rails app to mediatemple (dv) and I have no luck.

I'm trying to use phusion passenger, so I went to http://www.modrails.com/videos/passenger.mov and looked at the tutorial to install this. I did everything with no problem and when I point to my ip I see the apache page and not the rails app.

I noticed that on mediatemple I had to create a vhosts.conf file and run a command to reconfigure my project to look at this vhosts.conf file. Link - http://kb.mediatemple.net/questions/1621/Why+is+my+vhost+file+not+being+used+by+Apache%3F#dv_40 In the last step I did /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain xxx.xx.xx.xx

instead of reconfiguring everything ...

This is what my vhosts.conf file looks like:

LoadModule passenger_module
/usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p125/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p125/ruby

<VirtualHost *:80>
      ServerName xxx.xx.xx.xx
      DocumentRoot /var/www/vhosts/myProject/httpdocs    # <-- be sure to point
to 'public'!
      <Directory /var/www/vhosts/myProject/httpdocs>
         AllowOverride all              # <-- relax Apache security settings
         Options -MultiViews            # <-- MultiViews must be turned off
      </Directory>
   </VirtualHost>

      

Has anyone had any luck deploying a rails app on mt (dv) that might spill some advice on the rails noob?

+3


source to share


1 answer


I just did this on my dv server, so you can go quickly. I am assuming you are running Ruby 1.9.3 and Rails 3.2 and are running all the commands below as root.

You also have the latest rake and passenger installed on your server. If not, try:

gem update --system
gem install rake
gem install passenger

      

The next step is to log into your MediaTemple admin panel. Click the "Admin" button (not "Plesk one") for the domain you are interested in and select "Root Access and Developer Tools". Install the developer tools (this will take about 10 minutes).

After that ssh to your server and do the following:

passenger-install-apache2-module

      

There is a pretty good managed setup out there, so I won't go into details here. You may need to install some additional dependencies here via yum, so check the output of this script carefully.

After that open the httpd.conf file and edit it. This holds true for /etc/httpd/conf/httpd.conf

. You will need to add the following lines to the end (note that the paths may change as I am using rvm to manage my ruby ​​settings and gemset).

# Passenger Module for Apache (For Rails apps)
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p125@rails32/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p125@rails32/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p125@rails32/ruby
PassengerDefaultUser root

      

At this point, you should be ready to create a new rails application to remove everything from your folder httpdocs

and run the following command while logged in as a domain user (not root!)



rails new /path/to/httpdocs

      

Modify the file vhost.conf

(or create a new one) in /var/www/vhosts/www.domain.com/conf

(you will need to do this as root).

ServerName domainname.com
ServerAlias domainname.com
DocumentRoot /var/www/vhosts/domainname.com/httpdocs/public
<Directory "/var/www/vhosts/domainname.com/httpdocs/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
RailsEnv development
RailsBaseURI /

      

And finally the question

/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain xxx.xx.xx.xx

      

And restart apache

/usr/sbin/apachectl -k restart

      

It should be!

This link really helped me with everything: http://www.twohard.com/blog/setting-rails-passenger-mediatemple-dv35-servers

+8


source







All Articles