Sign inSign up

drubin/systems-engineer-challenge

By drubin

Updated over 9 years ago

Systems build docker image

Image
0

241

drubin/systems-engineer-challenge repository overview

Awesome API

This is an API that serves ticks. This project consists of two main pieces:

  • API - A Ruby/Sinatra application with connections to Postgres and Redis
  • Worker - A Sidekiq powered background worker that reads and writes a Redis instance

Prerequisites

  • You should have the Ruby version listed in Gemfile installed.

  • You should have the latest version of Postgres 9.x installed.

  • Redis is required. To install and start:

  • $ brew install redis

  • $ redis-server /usr/local/etc/redis.conf (needs to be running for tests to pass)

  • You will also require the foreman and bundler gems:

    $ gem install bundler
    $ gem install foreman
    

Set-up

Install dependencies:

$ foreman run bundle install

Create a test and a development database:

$ psql

psql$  CREATE DATABASE my_api_development;
psql$  CREATE DATABASE my_api_test;

Copy .env_example to .env and fill out all values - ensure you include the URLs for the development and test databases you just created.

Now run database migrations:

$ foreman run bundle exec db:migrate
$ foreman run bundle exec db:migrate RACK_ENV=test

Start the server

To start the server:

$ foreman start

This command starts the api server and the background worker application.

API

  • GET /ticks: Show number of ticks been processed by the server
  • POST /ticks: Adds a new tick to the queue to be processed asynchronously. It will take 10 seconds for a tick to be processed

Deployment

The 2 components that form this application should be deployed together. This repository SHOULD NOT be deployed if the tests are failing.

Tag summary

Content type

Image

Digest

Size

284.2 MB

Last updated

over 9 years ago

docker pull drubin/systems-engineer-challenge