-
Add ssh key to server
cat ~/.ssh/id_rsa.pub | ssh bill@xxx.xxx.xxx.xxx -p 4321 'cat - >> ~/.ssh/authorized_keys'
-
Change permission of ssh folder
sudo chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh/
-
Update repositories
sudo apt-get update
-
Setup locals
sudo apt-get install language-pack-en
sudo locale-gen en_US en_US.UTF-8 en_CA.UTF-8
sudo dpkg-reconfigure locales
-
Install basic dependency packages
sudo apt-get install apache2 curl git build-essential zlibc zlib1g-dev zlib1g libcurl4-openssl-dev libssl-dev ruby-dev apache2-dev libapr1-dev libaprutil1-dev libreadline6 libreadline6-dev
sudo apt-get install build-essential libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
sudo apt-get install mysql-server
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
Incase you get any warning while staring mongodb shell https://docs.mongodb.org/manual/tutorial/transparent-huge-pages/
-
Install rbenv(ruby environment manager) on server https://github.com/sstephenson/rbenv#basic-github-checkout
-
Install ruby installation plugin on server https://github.com/sstephenson/ruby-build#installing-as-an-rbenv-plugin-recommended
-
Install ruby version
- List rubies
rbenv install -l
- Install specific version
rbenv install 2.2.3
- Make ruby verison global
rbenv global 2.2.3
- Install bundler(ruby dependancy manager)
gem install bundler
- List rubies
Follow all steps given in below link
https://www.phusionpassenger.com/library/install/apache/install/oss/trusty/
Setup capistrano inside rails project to automate deployment
-
Add following to gemfile
group :development, :test do gem 'capistrano', '~> 3.4.0' gem 'capistrano-rbenv', '~> 2.0', require: false gem 'capistrano-rails', '~> 1.1', require: false gem 'capistrano-bundler', '~> 1.1', require: false end
-
Run setup command inside rails project
cap install
-
Modify cap file
require 'capistrano/setup' require 'capistrano/deploy' require 'capistrano/bundler' require 'capistrano/rails/assets' # Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
-
Update deploy file https://gist.github.com/ketan-ghumatkar/fdeb101ab44ece1d2084
-
Deploy to instance
cap production deploy