Run Servers Locally on OS X - acani/Chats GitHub Wiki

Servers

  1. Install Homebrew

  2. Install Ruby

     brew install ruby
     gem update --system
     gem update
     gem clean
    
  3. Install Foreman

     gem install foreman
    

Database Server

  1. Install PostgreSQL

     brew install postgresql
    
  2. Start PostgreSQL

    In a separate Terminal window, run:

     postgres -D /usr/local/var/postgres
    

    Note: Pressing Command-. stops PostgreSQL.

    Minimize the window.

  3. (Re)initialize the local acani_chats_development & acani_chats_test databases

    Note: This causes changes made to any of the .sql files to take effect.

    Warning: This deletes all data stored in both local databases.

    Start PostgreSQL. Or, if PostgreSQL is already running, close all client connections to both databases, or just stop and restart PostgreSQL.

    To (re)creates the local databases and their extensions, tables, and functions, run:

     cd Servers/Database
     make                 # resets both databases
     make development     # resets just the development database
     make test            # resets just the test database
    

    Note: running psql acani_chats_development connects you to the local development database.

REST Server

  1. Set up the server

     cd Servers/REST
     cp .env.example .env
     bundle install
    
  2. Run the tests

     make test
    
  3. Start the server

     foreman start
    

Chat Server

  1. Install Node.js

     brew install node
    
  2. Set up the chat server

     cd Servers/Chats
     npm install
    
  3. Run the chat server

     foreman start
    

Clients

To configure clients to talk to the local REST server, uncomment any lines in the client code containing the word localhost and restart.

iPhone

Drag & drop the self-signed SSL certificate file located at Servers/REST/config/ssl/server.crt onto the running iPhone Simulator window.