-
Sign-up for DO account
https://www.digitalocean.com/?refcode=9ce07ab8bad
-
Create a Droplet (Ubuntu 14.04)
-
Prepare the VPS (installing Git, RVM and Ruby)
sudo adduser deploy # create a new user
sudo adduser deploy sudo # add user to sudo group
su deploy # login as new user
sudo apt-get update && sudo apt-get upgrade
# Add PPA repo for git
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
# Install Git and Ruby
## Git and dependencies
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev -y
## Ruby using `rvm`
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
# Add the following line to the end of your bashrc
nano ~/.bashrc
>> source ~/.rvm/scripts/rvm
rvm install 2.2.3
rvm use 2.2.3 --default
ruby -v
# Now we tell Rubygems not to install the documentation for each package locally and then install Bundler
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
- Install nodejs
# Install node 4.x
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v # Verify version of node installed
npm -v # Verify that you have npm installed too
- Install and config nginx
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
# Add Passenger APT repository
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
# Install Passenger & Nginx
sudo apt-get install -y nginx-extras passenger
sudo vim /etc/nginx/nginx.conf
# sudo nano /etc/nginx/nginx.conf
##
# Phusion Passenger
##
# Uncomment it if you installed ruby-passenger or ruby-passenger-enterprise
##
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rvm/gems/ruby-2.2.3/wrappers/ruby; # use the command `passenger-config --ruby-command` to get the path to ruby executable
Start the web server
Now if you copy the ip address of your droplet into a browser you should be able to see the nginx welcome page
- Install PG
sudo apt-get install postgresql postgresql-contrib libpq-dev
If you use paperclip or any other gems that uploads files locally to your public folder or similar, you will have to add that folder to your shared folder in order to make the file persistand between releases.
You do this by specifying in your deploy.rb which files/folders that should be shared like so:
set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'log', 'public/system']