2. Install Ruby & Rails using rbenv
Install Ruby 2.3.1 Install Rails 4.2.6
3. Install Apache2
4. Install Passenger
**
References :
Deployment
rbenv setting
**
Download SourceCode into /home/rails
sudo git clone https://github.com/pjhjohn/mrl-pp2015 /home/rails
Create VirtualHost File for apache
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/rails.conf
Set configuration information in rails.conf
sudo vim /etc/apache2/sites-available/rails.conf
<VirtualHost *:80>
# ServerInfo
# ServerName example.com # optional
# ServerAlias www.example.com # optional
ServerAdmin webmaster@localhost
# DocumentRoot : public directory of Rails Project
DocumentRoot /home/rails/public
# Environment : development or production
RailsEnv development
# Directory : Same as DocumentRoot
<Directory "/home/rails/public">
Options FollowSymLinks
Require all granted
</Directory>
# Logger
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Edit /etc/apache2/mods-available/passenger.conf
since we use rbenv
<IfModule mod_passenger.c>
PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
PassengerDefaultRuby /home/$YOUR_HOME_DIRECTORY/.rbenv/shims/ruby
</IfModule>
Disable default site & enable new site & restart apache2 service
sudo a2dissite 000-default
sudo a2ensite rails
sudo service apache2 restart
Manually added URI prefix
/pp2015
toredirect_to
,href
,action
, etc
chmod 644 to 755 for
**
Reference : rbenv setting
**
From here on out any updates to you app can be handled with a few commands:
cd /home/rails
git pull
RAILS_ENV=production bin/rake assets:precompile
sudo service apache2 restart
If you make changes to the database you may have to also run the migrations:
cd /home/rails
git pull
RAILS_ENV=production bin/rake db:migrate
RAILS_ENV=production bin/rake assets:precompile
sudo service apache2 restart