Skip to content

rubyapi/repl

 
 

Repository files navigation

RubyAPI Repl Service

This project powers the REPL functionality for http://rubyapi.org. The application is based on the AWS SAM framework where the app is made up of Lambda functions that are invoked via a HTTP endpoint.

The Lambda functions & HTTP API are all specified in the template.yaml file.

Getting Started

Install the AWS SAM CLI tool via your relevant package manager.

Finally, install application dependencies via Bundler:

$ bundle install

Start local server

The development server can be started via SAM:

$ sam local start-api

Note The local dev server does not automatically build the Ruby Engine layer that each function depends on. You will need to build the layer beforehand for the engine/version being invoked ie:

$ sam build MRIRuby27
$ sam local start-api
$ curl http://localhost:3000/exec/mri/27

Testing repl function

The test suit is located in tests and can be executed with:

$ rake test

Architecture

Each Ruby engine & version is a single lambda function that contains a small ruby application & a Lambda layer that contains the given Ruby engine version's program/binary.

The diagram represents the application flow:

+-----------------+               +-----------------+        Execute Ruby
|                 |               |                 |            Binary
|                 |    Execute    |                 +---------+
|                 |  Lambda func  |                 |         |
|  HTTP Endpoint  +---------------> Lambda Function |         |
|                 |               |                 +---------v---------+
|                 |               |                 |                   |
|                 |               |                 | Ruby Engine Layer |
|                 |               |                 |                   |
+-----------------+               +-----------------+-------------------+

Deploy to AWS

Deploying to AWS is done via the SAM CLI tool, it will take care of packaging, pushing and deploying the lambda functions to AWS

$ sam build && sam deploy --guided

Code of Conduct

Everyone interacting with the source code, issue trackers, chat rooms, and mailing lists is expected to follow the Code Of Conduct

Resources

See the AWS SAM developer guide for SAM usage & documentation