Skip to content

Instantly share code, notes, and snippets.

@pcanterini
Last active December 21, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcanterini/6384085 to your computer and use it in GitHub Desktop.
Save pcanterini/6384085 to your computer and use it in GitHub Desktop.
rails stack on ubuntu 12.04 LTS
- create deploy user and add to sudoers
- log in as deployer
- install stack with: sudo wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh
- install apache2:
sudo apt-get update
sudo apt-get install apache2
- fix for rvm then install passenger
rvm remove 2.0.0
rvm autolibs install openssl
rvm install ruby-2.0.0-p247 --with-openssl-dir=$HOME/.rvm/usr
- add export rvmsudo_secure_path=0 to profile
rvmsudo gem install passenger
rvmsudo passenger-install-apache2-module
# Node.js (for passenger)
add-apt-repository ppa:chris-lea/node.js
apt-get -y update
apt-get -y install nodejs
# mongodb for mongoid
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen
# web server config
-----------------------------
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /home/deployer/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14/buildout/apache2/mod_passenger.so
PassengerRoot /home/deployer/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14
PassengerDefaultRuby /home/deployer/.rvm/wrappers/ruby-2.0.0-p247/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
--------------------------------------------
Deploying a Ruby on Rails application: an example
Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment