Thursday, December 12, 2013

cpanel and ruby on rails

#first, use rvm to install both ruby stable version + rails, run as root:

curl -sSL | bash -s stable --rails

yum install curl-devel

gem install passenger

rvm list
rvm --default 

export APXS2=/usr/local/apache/bin/apxs

next, copy the configuration in the final readme when compilation is done, eg:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.27/buildout/apache2/
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.27

PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.0.0-p353/ruby

and paste to :

then restart apache:

next, to install rails app onto 1 of the account:
mkdir -p /usr/local/apache/conf/userdata/std/2/[username]/[domain]
vi /usr/local/apache/conf/userdata/std/2/[username]/[domain]/rails.conf

# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /home/[username]/[path-to-rails]/public
<Directory /home/[username]/[path-to-rails]/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews

#rebuild apache config:

then restart apache:

next, to be able to run bundle install as a shell user:
mkdir ~/bin
ln -s /usr/local/cpanel/3rdparty/bin/git ~/bin/git
then run bundle install at root of rails application.
this will install gems into vendor/bundle

running git to parse ssl from github seems to return certicate error,
to solve this, pre run this as shell user:
git config --global http.sslverify false

then only run bundle install

if you are using json api,
you will need nodejs installed.
install this as root

on centos:
yum install npm
for other os:

 for reference:

No comments: