Public | Automated Build

Last pushed: 2 years ago
Short Description
Hypermasher is a Node.js application which shows users a stream of the latest Hyperlapse videos.
Full Description

Hypermasher

<p align="center">
<img src="hypermasher-preview.gif" alt="Hypermasher preview" title="Hypermasher" style="max-width:100%;">
</p>

Hypermasher is a Node.js application which shows users a stream of the latest Hyperlapse videos set to chill music.

It was created by Andrew T. Baker as part of his funemployment. It is open source under the Apache 2.0 license.

Getting started

Hypermasher is a fairly lean app and takes minutes to set up. It uses redis to store metadata about the videos it serves, but has no other components outside of Node.js.

To run Hypermasher, you need to get API keys from Instagram. Once you have those, you can run Hypermasher natively through npm or through Docker using docker-compose.

Instagram API keys

To get your Instagram API keys, visit their developer site: http://instagram.com/developer. Follow the prompts for "Register your Application".

You'll know you're done when you see values for CLIENT_ID and CLIENT_SECRET.

Running locally with Docker

Docker is an easy way to run Hypermasher locally, but if you have Node.js and redis-server installed on your machine, you might prefer running Hypermasher through npm as described in the next section.

In addition to Docker, you will need docker-compose. Installation instructions here: https://docs.docker.com/compose/install/

To run Hypermasher locally using Docker:

  1. Make sure your Docker daemon is running and connected to your client. You can test this by making sure docker ps returns a valid result
  2. cd into the Hypermasher root directory
  3. Set the INSTAGRAM_CLIENT_ID and INSTAGRAM_CLIENT_SECRET environment variables in a new file called .env in this directory
  4. Run docker-compose up -d (-d to run our containers in detached mode)
  5. Connect to Hypermasher in your browser at port 8000

You're now running Hypermasher locally, but we haven't fetched any videos from Instagram yet. To do that, we need to run one additional command:

$ docker-compose run node bin/getVideos

You should see a result like 33 videos primed. Now refresh your browser - you should see the first video loaded and ready to play. Hit any play button on the screen to start Hypermasher.

Running locally with npm

If you have Node.js and redis-server installed locally, then you can run Hypermasher without Docker.

To run Hypermasher locally through npm:

  1. Start the redis server with redis-server
  2. cd into the Hypermasher root directory
  3. Install the Node.js dependencies with npm install
  4. Start Hypermasher with npm start
  5. Go to http://localhost:3000 to see Hypermasher in your browser

You're now running Hypermasher locally, but we haven't fetched any videos from Instagram yet. To do that, we need to run one additional command:

  1. Set the INSTAGRAM_CLIENT_ID and INSTAGRAM_CLIENT_SECRET environment variables in your terminal session. I like using autoenv to make this easy.
  2. Run the command bin/getVideos

You should see a result like 33 videos primed. Now refresh your browser - you should see the first video loaded and ready to play. Hit any play button on the screen to start Hypermasher.

Running in production

When running in production (export NODE_ENV=production), Hypermasher caches the rendered template for the /hyperlapse route to speed up response time.

After a deployment, you can clear that template cache by running the executable found at bin/clearViews.

Testing

Hypermasher includes a couple end-to-end tests powered by Protractor. Hypermasher isn't an Angular app, but I wanted to learn Protractor a little better so I used it anyway.

Running the tests

You will need to install Protrator and a webdriver. For most people, all you need is:

$ npm install -g protractor
$ webdriver-manager update

Before you can run the tests, you need to start the Hypermasher server and the Selenium server:

$ fig up -d
$ webdriver-manager start

Then, run the tests with:

$ protractor tests/conf.js
Docker Pull Command
Owner
atbaker
Source Repository