this guide will demonstrate how create environment of production and deploy application ruby on rails in Digital Ocean using Ubuntu 16.4
ssh youruser@yourip
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get install -y build-essential autoconf automake bison libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev libncurses5-dev ncurses-dev libffi-dev libgdbm-dev openssl libc6-dev libsqlite3-dev libtool libxml2-dev libxslt-dev libxslt1-dev sqlite3 curl vim git
git config --global user.name '<seu nome>'
git config --global user.email'<seu email>'
git config -l
/etc/evironment
LC_ALL="en_US.UTF-8"
RAILS_ENV="production"
/etc/profile.d/variables.sh
export LC_ALL="en_US.UTF-8"
export RAILS_ENV="production"
after insert values in files execute
sudo reboot
execute commands:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash
run "source /etc/profile.d/rvm.sh"
rvm list known
rvm install 'VERSION RUBY'
rvm list
rvm use 'VERSION RUBY' --default
sudo reboot gem install bundler
sudo apt-get -y update
sudo apt-get install nginx
sudo ufw app list
sudo ufw allow 'Ngnix HTTP'
sudo ufw status
sudo ufw enable
sudo ufw allow ssh
sudo service ufw restart
systemctl status nginx
sudo apt-get install -y mysql-client mysql-server libmysqlclient-dev
sudo systemctl status mysql
sudo adduser deploy --ingroup www-data
su deploy
cd
mkdir .ssh
chmod 700 .ssh
echo [cole a chave pública do seu vagrant] >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
sudo apt-get install nodejs
nodejs --version
sudo mkdir /var/www
sudo chown www-data. /var/www
sudo chmod g+w /var/www
mysql -u root -p
show dabases;
create database nameyourdatabase;
add in gemfile
group :development do
gem 'capistrano', '~> 3.7'
gem 'capistrano-bundler', '~> 1.2'
gem 'capistrano-rails', '~> 1.2'
end
group :production do
gem 'mysql2'
end
execute
bundle install
bundle exec cap -v
bundle exec cap install
bundle exec cap -T
add in Capfile
require 'capistrano/bundler'
require 'capistrano/rails'
insert in the deploy.rb click here
execute
bundle exec cap production deploy
bundle exec cap production deploy:check