wilomgfx
10/23/2017 - 6:28 PM

Rails c9 setup

basic rails install on c9 with psql

README

This README document whatever steps are necessary to get the application up and running.

What is this repository for?

  • Quick summary
  • Version

How do I get set up?

Set-up the workspace

  1. Create a workspace in cloud9 with the ruby option (or rails version, skip to next step)
  2. Install rails with this command in the terminal : "gem install rails -v 5.0.1"
  3. Empty and clone the project in the workspace folder.

install postgresql

  1. sudo apt-get update
  2. sudo apt-get install postgresql postgresql-contrib libpq-dev
  3. sudo service postgresql start
  4. sudo -u postgres createuser -s log210admin
  5. sudo -u postgres psql
  6. \password abc123!
  7. The password is : abc123!

Set-up the projet from git

  1. git config --global user.name "Your Name"
  2. git config --global user.email your.email@example.com
  3. add the ssh key in github !
  4. cat ~/.ssh/id_rsa.pub (for getting the key)
  5. add the key in github

Initial Setup

  1. bundle install
  2. rails db:create
  3. rails db:migrate
  4. rails server (to keep the server running, optional)

PG::Error: ERROR: new encoding (UTF8) is incompatible

  1. sudo -u postgres psql postgres
  2. UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
  3. DROP DATABASE template1;
  4. CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
  5. UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
  6. \c template1
  7. VACUUM FREEZE;

Postgres Start

  1. sudo service post

server start trick

echo 'alias server="rails server -b $IP -p $PORT"' >> ~/.bashrc