Skip to content
Alec edited this page Nov 4, 2017 · 19 revisions

Welcome to the 276-Project wiki!

New user setup:

Install Ubuntu >= 16.04.

Setup .bashrc:

Open the file ~/.bashrc in your favorite editor (i.e. in terminal: sudo vim ~/.bashrc

At the bottom, append this:

parse_git_branch() {

    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'

}

function prompt {
  local GREEN="\[\033[0;32m\]"
  local PURPLE="\[\033[0;35m\]"
  local CYAN="\[\033[0;36m\]"
  local RESETCOLOR="\[\e[00m\]"

  export PS1="\n$CYAN\u $PURPLE@$GREEN\w$PURPLE\$(parse_git_branch)$GREEN\$ $RESETCOLOR"
  export PS2=" | → $RESETCOLOR"
}

prompt

Install Ruby!

sudo apt-get update
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 nodejs
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.4.2
rbenv global 2.4.2

Check to see if you have the right ruby version

ruby -v

Install Bundler

gem install bundler

Set up git

git config --global color.ui true
git config --global user.name "GITHUB USERNAME"
git config --global user.email "THE_EMAIL_USED"
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Press ok a few times to generate the key

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.

Check if it worked:

ssh -T git@github.com
# Hi GITHUB USERNAME! You've successfully authenticated, but GitHub does not provide shell access.

Install RAILS :)

First need to install nodejs from the official repo

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

And now drumroll... RAILS: gem install rails

Fix up ol` rbenv:

rbenv rehash

Make sure it worked:

rails -v
# Rails 5.1.4

Setup psql (NOTE, do not copy the postgres=# part)

sudo apt-get install postgresql
sudo -u postgres psql
postgres=# ALTER USER postgres WITH PASSWORD 'newpassword';
postgres=# \q

Install capybara dependencies

sudo apt-get install qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x

install pronto dependency

sudo apt-get install cmake

Install RubyMine using a student license.

Download from: https://www.jetbrains.com/ruby/download/#section=linux

sudo mkdir -p /opt/RubyMine

sudo tar -zxvf RubyMine-<whatever version>.tar.gz --strip-components 1 -C /opt/RubyMine

sudo chown -R root:root /opt/RubyMine

sudo /opt/RubyMine/bin/rubymine.sh

Go into RubyMine and set it up to your liking (monokai fonts etc.)

Hopefully you have git installed and have cloned our project and opened it in RubyMine.

Head to tools --> create desktop entry (so you that you can set a shortcut for it)

bundle

bundle

Make a secret key!

  • touch config/secret_key.txt
  • echo $(rake secret) > config/secret_key.txt

Fill in the database.yml:

touch config/database.yml

THEN fill out that file:

development:
  adapter: postgresql
  encoding: utf-8
  username: postgres
  password: newpassword
  database: 276_development
  pool: 5
  host: localhost
  port: 5432
  schema_search_path: "public"

test: &test
  adapter: postgresql
  username: postgres
  password: newpassword
  encoding: utf-8
  database: 276_test
  pool: 5
  host: localhost
  port: 5432
  schema_search_path: "public"
#  Opt-in for use with vagrant
#  user: 'postgres'
#  password: 'password'
cucumber:
  <<: *test

Now:

Create the database: rake db:create

Migrate it: rake db:migrate

bundle

bundle

Install Yarn

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

cd client
yarn install

Install webpack

sudo npm install -g webpack
sudo npm install webpack
sudo npm install -g react
sudo npm install -g react-dom
sudo npm install -g react-router
sudo npm install -g babel
sudo npm install -g babel-polyfill
sudo npm install -g babel-preset-es2015 babel-preset-stage-2

Get origin up and running

git remote add origin GIT_LINK_HERE 

HOW TO ADD HEROKU DOE

Add heroku (ctrl+shift+t for new tab):

sudo apt-get install software-properties-common # debian only
sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install heroku

Log in to heroku and checkout the settings for each (savor-prod, savor-staging) and find the git links.

Then type git remote add heroku-prod GIT_LINK_HERE (heroku-prod or heroku-staging depending) (add both)

NOW: you can look at logs and things. I.e.: heroku logs --app savor-staging will get you logs for our staging branch.

NICE

take a look at "http://localhost:3000"

Sources: https://gorails.com/setup/ubuntu/16.04