Git Product home page Git Product logo

thumbroll's Introduction

Thumbroll

super agent

Thumbroll is a teaching assisstant designed to provide real-time two directional feedback between the lecturer and students via a user-friendly iPhone app. With the press of a button, lecturers can send a variety of polls and feedback requests directly to students. Create or join a 'Quick Class' without logging in, or use the partner desktop app to manage classes and lessons, and track student comprehension easily over time.

Requirements

Setup server

Create a file called 'config.json' within /server/db directory by copying 'config.example.json'. This file is used by the server to connect to a postgres DB depending on the run environment. You may need to edit the username and password parameters to run locally (see below).

Thumbroll is setup to be developed and run either locally, or on a local or deployed docker-machine. Running the app via Docker will ensure a consistent environment across computers and is therefore recommended.

Docker

Docker provides a means of packaging applications and their relevant dependencies into blank Linux 'containers' to ensure consistency between development and production environments. Thumbroll requires two containers, one to host the Node server, and one to host the Postgres database.

Starting up the server is a two-step process:

  1. Build an image of the app and any dependencies
  2. Start up containers based on the images

These steps correspond to two files in the root directory:

  • 'Dockerfile' provides instructions for how to build the app image and install dependencies
  • 'docker-compose.yml' provides instructions to setup the environment and run the containers

Use the following instructions to run the Thumbroll server via docker:

Step 1: Install Docker

If you don't have it already, you will need to install the Docker toolbox. This will enable you to setup Docker machines, build Docker images, and compose containers.

Step 2: Select docker-machine

$ docker-machine ls

The machine marked with an asterix is currently active. To select a docker-machine, run

$ eval $(docker-machine env [name of docker-machine]))

Step 3: Compose containers

The docker yml file will instruct the docker-machine on how to build the thumbroll image, run the container, and connect it to a postgres container. Run the following in the command line to compose the containers and run the node and postgres processes in the background

$ docker-compose up -d

To see all running containers on the machine, run the command

$ docker ps

Use the '-a' flag to view all containers, as opposed to just those which are running.

To see the most recent logs from a container process, run

$ docker logs [container ID]

Step 4: Confirm Docker IP address

Assuming there are no issues, the server should be up and running. In order for the mobile front-end to communicate with the server, you will need to set the appropriate IP address in '/client/mobile/utils/environment.js'. To get IP from your docker-machine, run

$ docker-machine ip [name of docker-machine]

Step 5: Remove container and image to rebuild

If you make changes to the server code, you will need to destroy the existing Thumbroll container and image to allow Docker to rebuild. The postgres container and image do not need to be removed.

To see all containers on the docker-machine:

$ docker ps -a

To force stop and delete a container:

$ docker rm -f [container id]

To see all images on the docker-machine:

$ docker images

To remove an image:

$ docker rmi [imageID]

Step 6: Deploy to Digital Ocean (optional)

Digital Ocean provides an easy way to deploy your Docker containers directly from your terminal. Click here for instructions.

Local

Instead of running the server within Docker containers, the server may also be run locally.

Step 1: Install Postgres

$ brew update
$ brew install postgres

Step 2: Create Postgres defaults

$ createdb
$ createrole <<create username>>

Plug this username into the relevant position within '/server/db/config.json' according to example file.

Step 3: Create thumbroll DB

$ createdb thumbroll

Step 4: Startup Postgres

$ postgres -D /usr/local/var/postgres

Step 5: Install dependencies

$ npm install

Step 6: Install Webpack

$ npm install -g webpack

Step 7: Run Webpack from desktop directory

$ cd client/desktop
$ webpack --watch

Step 8: Startup Node server

$ npm start

Step 9: Access DB (optional)

Use the following command to access the thumbroll DB and query it directly:

$ psql thumbroll

Note that semicolons are required at the end of each query statement.

Setup Front-end

Mobile

Step 1: Run 'npm install' from the mobile directory

$ cd client/mobile
$ npm install

Step 2: Run 'rnpm link' from the client directory

$ cd client/mobile (if not already in this directory)
$ rnpm link

Step 3: Set environment

The file '/client/mobile/utils/environment.js' is used to set the environment the front-end will use to communicate with the server. Change the key in the export statement to change the environment. See above to get IP address from a docker-machine.

Run Simulator

In order to run the simulator, navigate to the 'AppDelegate.m' file under the 'thumbroll' folder. You'll see two options for loading JavaScript code:

  1. If you want to run the XCode iPhone simulator from a development server (e.g., localhost), uncomment Option 1 and comment-out Option 2. Then, click the play button in the top-left corner (or Command + R).
  2. If you want to run the simulator on a physical iPhone device from a pre-bundled file on disk running on a remote server (e.g., Digital Ocean droplet), comment-out Option 1 and uncomment Option 2. Then, click the play button in the top-left corner (or Command + R).

Desktop

Step 1: Set environment

The file '/client/desktop/utils/environment.js' is used to set the environment the front-end will use to communicate with the server. Change the key in the export statement to change the environment. See above to get IP address from a docker-machine.

Icons

Hand by Maico Amorim from the Noun Project

Help by Pham Thi Dieu Linh from the Noun Project

thumbroll's People

Contributors

shanemcgraw avatar iandeboisblanc avatar jakepace avatar jacobdhlee avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.