All Projects → relistan → spacesuit

relistan / spacesuit

Licence: other
API Gateway with URL remapping

Programming Languages

elixir
2628 projects
shell
77523 projects

Projects that are alternatives of or similar to spacesuit

rocket-lamb
A crate to allow running a Rocket webserver as an AWS Lambda Function with API Gateway or an Application Load Balancer
Stars: ✭ 73 (+284.21%)
Mutual labels:  api-gateway
serverless-websockets-chat
Realtime chat app based on AWS Lambda, API Gateway, DynamoDB, Websockets, React in TS
Stars: ✭ 19 (+0%)
Mutual labels:  api-gateway
xarray-beam
Distributed Xarray with Apache Beam
Stars: ✭ 83 (+336.84%)
Mutual labels:  beam
GatewayService
GatewayService (Ocelot).
Stars: ✭ 19 (+0%)
Mutual labels:  api-gateway
AspNetCore.ApiGateway
Asp Net Core Api Gateway Framework
Stars: ✭ 46 (+142.11%)
Mutual labels:  api-gateway
groot-api-gateway
API Gateway for the Groot project written in Arbor
Stars: ✭ 12 (-36.84%)
Mutual labels:  api-gateway
image-resizer-service
Serverless image resizing service for AWS
Stars: ✭ 95 (+400%)
Mutual labels:  api-gateway
kong-plugin-api-response-merger
Kong API response merger plugin
Stars: ✭ 14 (-26.32%)
Mutual labels:  api-gateway
amazon-ivs-ugc-web-demo
This repository shows how you can build a compelling user-generated content (UGC) live streaming webapp with Amazon IVS.
Stars: ✭ 14 (-26.32%)
Mutual labels:  api-gateway
Quark
Quark is a streaming-first Api Gateway using Akka
Stars: ✭ 13 (-31.58%)
Mutual labels:  api-gateway
go2gql
graphql-go schema generator by proto files
Stars: ✭ 33 (+73.68%)
Mutual labels:  api-gateway
gobis
Gobis is a lightweight API Gateway written in go which can be used programmatically or as a standalone server.
Stars: ✭ 48 (+152.63%)
Mutual labels:  api-gateway
apex-api-gateway-boilerplate
Boilerplate for AWS Lambda and API Gateway using Apex
Stars: ✭ 19 (+0%)
Mutual labels:  api-gateway
iridium
A register-based VM in Rust
Stars: ✭ 60 (+215.79%)
Mutual labels:  beam
aws-tailor
AWS account provisioning and management service
Stars: ✭ 105 (+452.63%)
Mutual labels:  api-gateway
Live-Stream-Chat-Retriever
Retrieve live streams chat messages from different sources (Twitch, YouTube Gaming, Dailymotion etc...) to print them into a single HTML page.
Stars: ✭ 40 (+110.53%)
Mutual labels:  beam
noiiice
a serverless blog built on NuxtJS, AWS, serverless framework, and irrational exuberance.
Stars: ✭ 42 (+121.05%)
Mutual labels:  api-gateway
bobbycar
IoT Transportation demo using Red Hat OpenShift and Middleware technologies
Stars: ✭ 33 (+73.68%)
Mutual labels:  api-gateway
data
[deprecated] Generate a DynamoDB data access layer from an .arc file. Automatically disambiguates testing (in memory) from deployment staging and production tables
Stars: ✭ 20 (+5.26%)
Mutual labels:  api-gateway
parser
arc.app, .arc, arc.json, arc.yaml, and arc.toml support
Stars: ✭ 20 (+5.26%)
Mutual labels:  api-gateway

Spacesuit

spacesuit build

An API gateway written in Elixir, built on top of the Cowboy web server and Hackney http client. Supports streaming requests, remapping by hostname, HTTP method, and endpoint. Now also includes full CORS support with middleware, allowing backing services to offload CORS to Spacesuit.

Sample config:

  "[...]:_" => [ # Match any hostname/port
    { "/users/:user_id", %{
      description: "users to [::1]:9090",
      GET: "http://[::1]:9090/:user_id", # ipv6 localhost (thanks osx)
      POST: "http://[::1]:9090/:user_id"
    }},

    {"/users/something/:user_id", %{
      description: "users/something to [::1]:9090",
      all_actions: "http://[::1]:9090/something/:user_id"
    }},

    {"/[...]", %{
      description: "others to hacker news",
      destination: "https://news.ycombinator.com"
    }}
  ]

Installation

You need to have Elixir and the BEAM VM installed. On OSX the easiest way to do that is to brew install elixir. Next you need to install dependencies, with mix deps.get. Now you're ready to roll.

Note: To run mix compile or mix test you also have to install Rebar3, the Erlang build system. On OSX, use brew install rebar to install it.

Running

Spacesuit listens on 8080 and waits for requests. You can start it up by running iex -S mix run or mix run --no-halt.

Configuration

Spacesuit relies on the mix configuration system with a common config in config/config.exs and environment based configs merged on top of that. If you were running in the dev environment, for example, config/config.exs would get loaded first and then config/dev.exs would be loaded afterward. Additionally, it can be configured with some environment variables. The most common of these are

  • MIX_ENV which describes the current evironment
  • SPACESUIT_LOGGING_LEVEL which is a string corresponding to the minimum level of logging we'll show in the console. (e.g. SPACESUIT_LOGGING_LEVEL="warn")

If you use New Relic for monitoring your applications, you can also turn on basic metric support in Spacesuit by providing the standard New Relic environment variable for your license key:

  • NEW_RELIC_LICENSE_KEY the string value containing your New Relic license, as provided to any other New Relic agent.

Route Configuration

The routes support a fairly extensive pattern match, primarily from the underlying Cowboy web server. The good documentation on that is available here. Spacesuit supports outbound remapping using a very similar syntax, as shown above.

The routes operate as a drop-through list so the first match will be the one used. This means you need to order your routes from the most specific to the least specific in descending order. E.g. if you have a wildcard match that will match all hostnames, it needs to be below any routes that match on specific hostnames. If you've written network access lists before, these operate in a similar manner.

Once you have written your routes, a good step is to run the mix validate_routes task, which will load the routes for the current MIX_ENV and check them all for correctness.

CORS Middleware

Spacesuit contains a CORS middleware which handles offloading CORS support from backend services. You can enable this in the config following the examples set there. Note if upstream services have CORS handling enabled internally and are sending CORS headers, responses from those services will override any from Spacesuit, even if CORS is enabled, except for OPTIONS requests which will be served from Spacesuit all the time if CORS support is enabled for an endpoint.

Coverage

You can view the coverage output in test mode by running:

MIX_ENV=test mix coveralls.html
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].