Skip to content

Startup on a new Ubuntu or OS X box

Rory Scott edited this page Aug 11, 2020 · 6 revisions

On a fresh Ubuntu or OS X box (either locally on on AWS)....

Step 1: Update the box and install essentials (git, dev tools, bundler)

In Ubuntu:

 sudo apt-get update 

 sudo apt-get install build-essential

 sudo apt-get install git

 sudo apt-get install -y libssl-dev libreadline-dev zlib1g-dev 

 sudo apt-get install ruby-dev     

In OS X

 #(if you don't have [Homebrew](http://brew.sh/), install it first)

 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

 brew install git

Step 2: Install rbenv and ruby-build (allows rbenv install...)

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

Step 2a: If you already have rbenv and ruby-build, run these commands to update ruby-build to the latest version (so that it can access ruby 2.2.2)

cd ~/.rbenv/plugins/ruby-build
git pull
cd

Step 3: Install Ruby 2.2.2

N.B. whilst doing this on a docker ubuntu:bionic box, I needed to do this to make > rbenv executable. - @rorads

# On OS X you may need to cd ~/.rbenv/bin to run this

rbenv install 2.2.2  #this may take a few minutes

Step 4: Install Devtracker-API from GitHub

git clone https://github.com/DFID/devtracker-from-api.git

cd devtracker-from-api

#set the site to use ruby 2.2.2
rbenv local 2.2.2

#install the gems from the Gemfile
gem install bundler
bundle install

Step 4.1 (If running on a cloud instance)

Ensure that port 443 is exposed on the cloud machine

Run the following bash command to forward the local DevTracker port:

sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 4567

Step 5: Start DevTracker-API

Edit your devtracker.rb to use locals

ruby devtracker.rb

Alternative ways of starting DevTracker-API

#on port 80 and as a background process 
ruby devtracker.rb -o 0.0.0.0 -p 80 &

#using rerun to have automatic restart when you are developing
gem install rerun
rerun 'ruby devtracker.rb'
Clone this wiki locally