#Pique ###Intelligent Social Media aggregation
Pique is an automated engine for gathering, sorting, and displaying trending web content. It is designed to streamline content consumption, allowing users to access top and trending content from multiple social media platforms quickly.
Pique is built on the Play Framework, and leverages Redis and Protocol Buffers for incredibly fast data access.
Clone the master branch (or, if you're feeling particularly adventurous, clone a feature branch) at The Pique Repository using git.
Visit the Play Installation page and follow the instructions detailed there.
Activator is a very useful build tool, based on the sbt package manager. Download Activator, unzip, and add it
to your PATH
.
If you haven't already, clone the Pique source code, and set up your environment variables, as described in the Environment Variables section of this document.
Within the pique
directory in your terminal, you can run a local instance of Pique by issuing
activator run
Pique will then start up on localhost:9000
. You may need to wait a few moments for the Sorter to run for the first
time before content is available on the webpage.
You can run unit tests by issuing
activator test
You can create a production build of Pique for use on an Amazon Web Services Elastic Beanstalk application by running
activator dist
The .zip
package will then be available in the pique/target/universal/
directory. See Deploying a Pique Application
for more information.
If your IDE supports the Play framework or sbt, you should be able to import the Pique project accordingly. You should then be able to run the unit test suite, provided you have imported the required environment variables
Environment variables are used for configuring data storage, external API access for data sources, and other things we need to configure, but don't necessarily want to display on our public repository. If you need them (for grading of this project, for example) and we haven't supplied them, please ask!
The following environment variables are required by the Pique application itself:
runtime_env
- setting this toproduction
will result in Pique using Redis as a data store. Any other field (or none) will result in Pique using its own 'in memory' data store.
The following environment variables are required by Pique's content collector classes
twitter4j_consumerKey
- Twitter API consumer keytwitter4j_consumerSecret
- Twitter API consumer secrettwitter4j_accessToken
- Twitter API access tokentwitter4j_accessTokenSecret
- Twitter API access secret
reddit_user
- Reddit usernamereddit_pass
- Reddit passwordreddit_client_id
- Reddit client IDreddit_secret
- Reddit client secret
imgur_client_id
- Imgur application client IDimgur_client_secret
- Imgur application client secret
When using Redis, the following variables are required:
redis_url
- URL of Redis instanceredis_port
- Port atredis_url
on which Redis is listening
The sorting node requires the following environment variables to be set:
sorting_threshold
- number of posts required to be stored in source channels before the sorting node runsposts_per_page
- number of posts to be stored in each display page
When running Pique in a production environment (Elastic Beanstalk), the following variables are required:
http_port
- http port on which the load balancer listensapp_secret
- Secret string (can be any string, but needs to be kept private as the application is not secure if public)
When testing Redis, the following variables are required:
data_source
- set toredis
to enable Redis tests to run
Once you have the Activator tool set up, you should be able to run the tests using activator test
. This does
require the environment variables mentioned above.
Once you have the Activator tool set up, you should be able to create a deployable package using activator dist
in
your command line. This will create a zip package in the pique/target/universal/
directory that you can upload to an
AWS ElasticBeanstalk application. This requires environment variables, as detailed in the Environment Variables
section.
Pique directory structure mainly follows the Anatomy of a Play! Application.
The application itself is located in app
, which contains controllers
, models
, filters
, and services
, where most
of the backend components are implemented, as well as Scala-templated HTML for display on the browser.
javascripts
, stylesheets
, and images
passed to the browser are located in public
. Other directories of interest
are test
, where unit tests live, conf
, where configuration files are stored (including routes.conf
in which the
HTTP endpoints are routed to specific controllers), and logs
.
Pique takes most of its design from the Model-View-Controller design pattern, but also makes use of singletons, templates, builders, observers, data access objects, and possibly some others we may have forgotten about.