This assumes that you already have a running Ubuntu server with Apache and Passenger installed (see Basic Security Installs for Ubuntu and How to Install Passenger + Apache in Ubuntu).
- Clone the git repo.
git clone git@bitbucket.org:kabalweg/app_name.git cd app_name bundle install
If you get a "bundle not yet installed" error, run the following comment:gem install bundle
- Go to /var/www/ type and this command to create a symbolic link.
sudo ln -s /home/kabalweg/app_name/ ./app_name
- Go to /etc/apache2/sites-available and create a virtualhost file, app_name.conf, or copy and existing one and edit the appropriate values in that file and save.
<VirtualHost *:80> ServerName app_name.net Redirect permanent / http://www.app_name.net/ </VirtualHost> <VirtualHost *:80> ServerName www.app_name.net ServerAdmin kabalweg@gmail.com # Set the environment to production RailsEnv production <IfModule mod_passenger.c> # Set to on when debugging errors PassengerFriendlyErrorPages off #PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini #PassengerDefaultRuby /home/kabalweg/.rvm/gems/ruby-2.2.1@rails4.2/wrappers/ruby PassengerMaxPoolSize 2 PassengerPoolIdleTime 0 PassengerMaxRequests 1000 </IfModule> DocumentRoot /var/www/app_name/public <Directory /var/www/app_name/public> AllowOverride all Options -MultiViews #Require all granted Order deny,allow Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
- Disable the default virtualhost and enable the new virtualhost file and activate it.
sudo a2dissite 000-default.conf sudo a2ensite app_name.conf sudo apachectl -k graceful
- Generate secret key and put the resulting key in the secret.yml file.
rake secret RAILS_ENV=production
Note: It's not a good and safe practice to put production config values in the repo. A good way is to ignore config files (*.yml) using git so it don't get save in the repo, then just manually create this files, with the correct values, in the production server. - Pre-compile assets.
rake assets:precompile RAILS_ENV=production
- Restart application by typing below in your application's root directory.
touch tmp/restart.txt
Create this folder (tmp) if you don't have this.
0 comments:
Post a Comment