Last active
September 22, 2015 21:12
-
-
Save tadeuzagallo/addee7bf7fd62a4ae818 to your computer and use it in GitHub Desktop.
Install Ruby with RVM on cpanel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ssh | |
ssh [email protected] | |
# install rvm | |
\curl -sSL https://get.rvm.io | bash -s stable | |
# load rvm | |
source ~/.profile | |
source ~/.rvm/source/rvm | |
# install rvm dependencies | |
rvm autolibs disable | |
rvm pkg install libyaml | |
rvm install 2.1.0 # ver a última versão com `rvm list` | |
rvm use 2.1.0 —-default | |
gem update bundler | |
# install fcgi | |
wget http://www.fastcgi.com/dist/fcgi.tar.gz | |
tar -zxvf fcgi.tar.gz | |
cd `ls | grep fcgi` | |
./configure --prefix=$HOME/usr/local/fcgi --exec-prefix=$HOME/usr/local/fcgi | |
make && make install | |
gem install fcgi -r -- --with-fcgi-lib=$HOME/usr/local/fcgi/lib --with-fcgi-include=$HOME/usr/local/fcgi/include | |
########################### | |
# | |
# !!! IMPORTANTE !!! | |
# | |
# No arquivo `Gemfile` | |
# | |
# A gem do banco de dados tem que ser `mysql2` | |
# Tem que ter a gem `therubyracer` (geralmente comentada, na linha 14) | |
# Rodar: `bundle install --without development test` dentro da pasta do projeto | |
# Rodar: `RAILS_ENV=production bundle exec rake db:migrate` | |
# Rodar: `bundle exec rake assets:precompile` | |
# | |
# | |
# NA PASTA `public` do projeto rails | |
# OBS: a pasta public tem que ficar fora do `public_html`, para os arquivos da aplicação não ficarem visíveis através do browser | |
# depois de todos os arquivos adicionados, criar um link simbólico para a pasta `public` da aplicação | |
# e.g.: ln -s ~/rails_app/public ~/public_html | |
# Adicionar o .htaccess | |
# | |
# | |
# <IfModule mod_fastcgi.c> | |
# AddHandler fastcgi-script .fcgi | |
# </IfModule> | |
# <IfModule mod_fcgid.c> | |
# AddHandler fcgid-script .fcgi | |
# </IfModule> | |
# | |
# Options +FollowSymLinks +ExecCGI | |
# | |
# RewriteEngine On | |
# | |
# RewriteCond %{REQUEST_FILENAME} !-f | |
# RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L] | |
# | |
# ErrorDocument 500 "Rails application failed to start properly" | |
# | |
# | |
# E o dispatch.fcgi (adicionar permissão para execução com `chmod +x dispatch.fgi`) | |
# | |
#!/home/<NOME_DO_USUARIO>/.rvm/rubies/<RUBY_VERSION>/bin/ruby | |
# | |
## ver o NOME_DO_USUARIO com `whoami` | |
## ver o RUBY_VERSION com `rvm list` | |
## ver o NOME_DA_APLICACAO_RAILS no arquivo `config/application.rb` | |
# | |
# ENV['RAILS_ENV'] ||= 'production' | |
# ENV['HOME'] ||= `echo ~`.strip | |
# ENV['GEM_HOME'] = File.expand_path('~/.rvm/gems/<RUBY_VERSION>') | |
# ENV['GEM_PATH'] = File.expand_path('~/.rvm/gems/<RUBY_VERSION>') + ":" + | |
# File.expand_path('~/.rvm/gems/<RUBY_VERSION>@global') | |
# | |
# require 'fcgi' | |
# require File.join(ENV['HOME'], 'rails_app/config/environment.rb') | |
# | |
# class Rack::PathInfoRewriter | |
# def initialize(app) | |
# @app = app | |
# end | |
# | |
# def call(env) | |
# env.delete('SCRIPT_NAME') | |
# parts = env['REQUEST_URI'].split('?') | |
# env['PATH_INFO'] = parts[0] | |
# env['QUERY_STRING'] = parts[1].to_s | |
# @app.call(env) | |
# end | |
# end | |
# Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(<NOME_DA_APICACAO_RAILS>::Application) | |
# | |
# | |
########################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
error: git was compiled without libcurl support.