Ruby JavaScript Roff HTML CSS CoffeeScript Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app Allow editing applications & resetting secrets (#431) Aug 15, 2018
bin Update gems (Mostly rails for 5.2) (#394) Jun 4, 2018
config Allow editing applications & resetting secrets (#431) Aug 15, 2018
db Allow editing applications & resetting secrets (#431) Aug 15, 2018
docs Allow anon runs from LiveSplit to be claimed Jul 7, 2018
lib Fix 2 possible SRDC job errors (#389) May 18, 2018
public Add <link> to humans.txt Jul 13, 2018
scripts Remove node_modules from repo Jul 20, 2018
spec Fix a test Jul 13, 2018
test Fixes a lot of rubocop warnings (#370) Apr 5, 2018
.babelrc Add webpack support (#346) Feb 9, 2018
.dockerignore Tweak simplecov config and add dockerignore (#340) Dec 9, 2017
.example.env Move credentials to uncommittable file (#402) Jun 11, 2018
.gitignore Remove node_modules from repo Jul 20, 2018
.postcssrc.yml Add webpack support (#346) Feb 9, 2018
.rubocop.yml Theme change & some run page stats (#395) Jun 13, 2018
.ruby-version Update ruby from 2.4.2 to 2.5.1 (#418) Jun 19, 2018
.travis.yml Use langauge bash on travis-ci (#397) Jun 5, 2018
Dockerfile Refactor sourcing of env vars Jul 6, 2018
Dockerfile-production Refactor sourcing of env vars Jul 6, 2018
Gemfile Add many favicon types Jul 13, 2018
Gemfile.lock Update sprockets Aug 10, 2018
Guardfile Tests, factories, debugging Mar 22, 2015
LICENSE Update license year range Mar 31, 2017
Makefile fix env variables not passing on linux when using make commands (#408) Jun 15, 2018
README.md Add a link in README Jul 13, 2018
Rakefile Rebrand kinda! May 3, 2014
appspec.yml Put splitsio on Docker! (#314) Sep 29, 2017
buildspec.yml Various refactors Dec 22, 2017
config.ru Initial commit Nov 13, 2013
docker-compose-production.yml Use ES6 template interpolation Jul 7, 2018
docker-compose.yml Refactor sourcing of env vars Jul 6, 2018
package.json Autocomplete for search Jul 6, 2018
yarn.lock Autocomplete for search Jul 6, 2018

README.md

Splits I/O

View performance data on Skylight View performance data on Skylight View performance data on Skylight

Splits I/O is a website similar to Pastebin or GitHub Gist, but for splits generated from speedruns rather than text or code. It's written in Ruby on Rails.

Splits I/O currently supports splits from ShitSplit, Splitty, Llanfair2, FaceSplit, Portal2LiveTimer, LlanfairGered, Llanfair, Urn, LiveSplit, SplitterZ, TimeSplitTracker, WSplit.

API

For full API documentation, see the API readme.

Local Development

Splits I/O runs on Docker, which makes it easy and consistent to set up and run on any machine despite any unusual dependencies. The one downside is that you must first install Docker!

Requirements

First Run

The first time you run Splits I/O with Docker is the best, because you'll have time to get a coffee! Yum! After the first run, it will be much quicker.

make

Once the output looks settled, you're good to go! Access localhost:3000 in your browser. The first page load after a new build may also take a minute.

Accounts (Optional)

Splits I/O accounts are built on top of Twitch accounts, so if you want sign up / sign in to work, you will need to register a Twitch application at dev.twitch.tv/dashboard. Use this redirect URI when asked:

http://localhost:3000/auth/twitch/callback

Twitch will give you a client ID and a client secret. Put them in .env in the same format as .example.env. Then run

source .env
make build

before starting the server again and you're set!

(If you want to do the source step automatically in the future, use something like autoenv.)

Debugging

Getting Up and Running

If you're having trouble getting Splits I/O running at all using the above instructions, please make a GitHub issue so we can work it out! Even if you think it's a silly issue, the fact that it's happening to you means we haven't ironed out everything (even if the only thing preventing you from setting up is better documentation!).

Working with the Code

If you have the app up and running but are looking for insight into debugging your own changes, you can access a Rails console inside the Docker container with

make console

Running Tests

To run tests from inside the Docker container, use

make test

Linting

We use Rubocop for code cleanliness and styling. To run it against changed files, commit your changes and run

make lint

Updating Gems or Docker

If you change the Dockerfile or Gemfile, you'll need to run

make build

to rebuild the Docker image for your changes to apply.

Cleaning Up

If you want to reset from scratch, you can run

make clean

which will run docker-compose down, resetting your local database and any Docker image builds.

Things You Probably Don't Need to Know

Infrastructure

Splits I/O is built in Ruby on Rails, but has some help from other pieces of infrastructure.

Production

+---------------------------------------------------------------------------------+
| AWS Auto Scaling Group (usually at 1)                                           |
+---------------------------------------------------------------------------------+   +----------------+
| AWS Target Group                                                                |   | AWS RDS        |
| +--------------------------------------+ +------------------------------------+ |   | +------------+ |
| | AWS EC2 Instance                     | | AWS EC2 Instance                   | |-->| | PostgreSQL | |
| | +----------------------------------+ | | +--------------------------------+ | |   | +------------+ |
| | | Docker                           | | | | Docker                         | | |   +----------------+
| | | +------------------+ +-------+   | | | | +------------------+ +-------+ | | |
| | | | Rails (& worker) | | Redis |   | | | | | Rails (& worker) | | Redis | | | |-------------------------\
| | | +------------------+ +-------+   | | | | +------------------+ +-------+ | | |                         |
| | | | livesplit-core   |             | | | | | livesplit-core   |           | | |                         |
| | | +------------------+             | | | | +------------------+           | | |                         |
| | +----------------------------------+ | | +--------------------------------+ | |                         |
| +--------------------------------------+ +------------------------------------+ |       New file trigger  V
+---------------------------------------------------------------------------------+   +------------+ | +--------+
| AWS Application Load Balancer                                                   |<--| AWS Lambda |<--| AWS S3 |
+---------------------------------------------------------------------------------+ | +------------+   +--------+
                                       ^  |                      Lambda tells Rails to parse               ^
                                 HTTPS |  | WebSockets                                                     |
                                       |  V                                                                |
                                     +------+                                                              |
                                     | User |--------------------------------------------------------------/
                                     +------+        Upload run using presigned S3 POST from Rails

Rails will synchronously parse any unparsed run before rendering it, but the asynchronous Lambda job is the preferred way for runs to be parsed because it still catches unvisited runs (e.g. in the case of a multi-file upload via drag-and-drop).

In development PostgreSQL and S3 are also Docker containers (see docker-compose.yml). Lambda is not yet implemented in development mode.

Favicons

Favicons are generated by Favicon Generator and its Rails gem. To generate favicons from the source image (public/logo.svg), run

docker-compose run web rails generate favicon

Config for this generation is at config/favicon.json.

Library Information

LiveSplit Core

Splits I/O uses livesplit-core for parsing. The parser is located in lib/parser/*. To upgrade it, run

make update_lsc

and commit the changes.

Highcharts

To generate run history charts Splits I/O uses Highcharts, which requires a written license. Licensing is based on the honor system, so you do not need to enter a key anywhere. Highcharts is free to use for testing purposes.