Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to Deploy Rails with:
- Ubuntu 16.04/Apache/Passenger/Rbenv/Ruby 2.4.1/Rails 5.1.1
- Assuming Apache is already installed.
- git clone gitlabrepo /var/www/html/rail/myapp
- cd /var/www/html/rail/myapp
- Assume that you're using Rbenv
- rbenv version
- rbenv local 2.4.1
- rbenv global 2.4.1
- 2.4.1 (set by /home/deploy/.rbenv/version)
- deploy should have sudo rights. Capistrano
- bundle exec bundle install
- yarn install
- bundle exec rails c
- bundle exec rails s RAILS_ENV=production
- rails c
- rails s
- Its going to throw an error.
- bundle exec rails db:migrate RAILS_ENV=production
- gem 'dotenv-rails', .env
- bundle exec rails assets:precompile
- bundle exec rails db:seed RAILS_ENV=production
- Apache
- log/production.log
- cd ~ (deploy)
- gem install passenger
- passenger-config validate-install
- apt install libapache2-mod-passenger
- tied to System Ruby
- Conflict rbenv 2.4.1 that I want to use
- passenger-install-apache2-module
- /etc/apache2/mods-available/passenger-rbenv.conf
- <IfModule mod_passenger.c>
- PassengerRoot /home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/passenger-5.1.5
- PassengerDefaultRuby /home/deploy/.rbenv/versions/2.4.1/bin/ruby
- </IfModule>
- /etc/apache2/mods-available/passenger-rbenv.load
- LoadModule passenger_module /home/deploy/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/buildout/apache2/mod_passenger.so
- a2enmod passenger-rbenv
- service apache2 reload
- That's it!
- Forgot this in the video
- <VirtualHost *:80>
- ServerName mydomain.com
- ServerAdmin root@localhost
- DocumentRoot /var/www/html/rails/myapp/public
- # RailsEnv development
- RailsEnv production
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- <Directory "/var/www/html/rails/myapp/public">
- PassengerRuby /home/deploy/.rbenv/versions/2.4.1/bin/ruby
- Options FollowSymLinks
- Require all granted
- </Directory>
- </VirtualHost>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement