Developer's Guide

DigitalOcean

Currently, DigitalOcean is hosting our Rails server. For details on how we deployed Rails, refer to this guide.

Frequently upgrade

sudo apt-get update && sudo apt-get upgrade
sudo rm /usr/bin/ruby
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby

PostgreSQL

For setting up Postgres, refer to this Stack Overflow answer. This guide is also helpful.

Creating Roles and Databases

# Login to PostgreSQL
sudo -u postgres psql

# Usage: CREATE USER [user name] WITH PASSWORD '[password]';
# Example:
CREATE USER rails_myapp_user WITH PASSWORD 'pwd';

# Usage: CREATE DATABASE [database name] OWNER [user name];
# Example:
CREATE DATABASE rails_myapp OWNER rails_myapp_user;

Database Clusters and Starting PostgreSQL!

initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
If the initdb command is not found, refer to this StackOverflow answer. For PostgreSQL 9.3, the command was found in: /usr/lib/postgresql/9.3/bin/initdb We also had to create the directory that holds the database cluster:
sudo -p mkdir /usr/local/var/postgres
When we ran initdb, we got this error: The files belonging to this database system will be owned by user "kevin". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled. fixing permissions on existing directory /usr/local/var/postgres ... initdb: could not change permissions of directory "/usr/local/var/postgres": Operation not permitted So I then ran: sudo apt-get install postgres-xc postgres-xc-client I tried to pg_ctl again, but got an error: pg_ctl: Coordinator or Datanode option not specified (-Z) This just means we need to make a data node. Run: sudo mkdir -p /usr/local/pgsql/data3 initdb -D /usr/local/pgsql/data3 --nodename data_node_3