Code Monkey home page Code Monkey logo

config-environment-ruby's Introduction

Config environment of production and deploy app rails

this guide will demonstrate how create environment of production and deploy application ruby on rails in Digital Ocean using Ubuntu 16.4

1 - Create a droplet in Digital Ocean

Click Here

2 - Login via ssh or password

ssh youruser@yourip

3 - update and upgrade packages in the system

sudo apt-get -y update 
sudo apt-get -y upgrade 

4 - install packages essencials

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

5 - config user git

git config --global user.name '<seu nome>'
git config --global user.email'<seu email>'
git config -l

6 - config variables environment

/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

7 - install ruby

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

8 - install nginx (web server)

sudo apt-get -y update
sudo apt-get install nginx

9 - adjust firewall

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

10 - install mysql

sudo apt-get install -y mysql-client mysql-server libmysqlclient-dev
sudo systemctl status mysql

11 - create user for deploy

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

12 - install node , directory deploy and create db

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;

13 - configure capistrano

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

config-environment-ruby's People

Contributors

nelisr avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.