Git Product home page Git Product logo

rpc's Introduction

No longer maintained

This software is no longer being maintainted and should not be chosen for new projects. See this issue for more information

Apex Serverless Architecture

Apex lets you build, deploy, and manage AWS Lambda functions with ease. With Apex you can use languages that are not natively supported by AWS Lambda through the use of a Node.js shim injected into the build. A variety of workflow related tooling is provided for testing functions, rolling back deploys, viewing metrics, tailing logs, hooking into the build system and more.

This project is designed for event-driven pipelines as it does not abstract away FaaS (functions as a service). If you are building web applications, APIs, or sites, consider using Apex Up, which provides a more out-of-the-box experience for these use-cases.

Installation

On macOS, Linux, or OpenBSD run the following:

curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sh

Note that you may need to run the sudo version below, or alternatively chown /usr/local:

curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sudo sh

On Windows download binary.

After downloading, rename binary file 'apex.exe', then add to PATH.

If already installed, upgrade with:

apex upgrade

Runtimes

Currently supports:

  • Node.js
  • Golang
  • Python
  • Ruby
  • Java
  • Rust
  • Clojure

Example projects for all supported runtimes can be found in _examples directory.

Features

  • Supports languages Lambda does not natively support via shim
  • Binary install (install apex quickly for continuous deployment in CI etc)
  • Hook support for running commands (transpile code, lint, dependency management, etc)
  • Batteries included but optional (opt-in to higher level abstractions)
  • Environment variable population via command-line, file, or inline config
  • Idempotent deployments (checksums skip already-deployed code)
  • Multiple environments via project.ENV.json and function.ENV.json files
  • Configuration inheritance and overrides
  • Command-line function invocation with JSON streams
  • Command & function name autocompletion
  • Function name globbing (ex: apex deploy api_*)
  • Transparently generates a zip for your deploy
  • Project bootstrapping with optional Terraform support
  • Function metrics and cost analysis
  • Ignore deploying files with .apexignore
  • Function rollback support
  • Tail function logs
  • Concurrency for quick deploys
  • Dry-run to preview changes
  • VPC support
  • Multiple region support
  • Lambda@Edge support

Sponsors

Does your company use Apex? Help keep the project bug-free and feature rich by sponsoring the project.

Backers

Love our work and community? Become a backer.

Example

Apex projects are made up of a project.json configuration file, and zero or more Lambda functions defined in the "functions" directory. Here's an example file structure:

project.json
functions
├── bar
│   ├── function.json
│   └── index.js
└── foo
    ├── function.json
    └── index.js

The project.json file defines project level configuration that applies to all functions, and defines dependencies. For this simple example the following will do:

{
  "name": "example",
  "description": "Example project"
}

Each function uses a function.json configuration file to define function-specific properties such as the runtime, amount of memory allocated, and timeout. This file is completely optional, as you can specify defaults in your project.json file. For example:

{
  "name": "bar",
  "description": "Node.js example function",
  "runtime": "nodejs4.3",
  "memory": 128,
  "timeout": 5,
  "role": "arn:aws:iam::293503197324:role/lambda"
}

Now the directory structure for your project would be:

project.json
functions
├── bar
│   └── index.js
└── foo
    └── index.js

Finally the source for the functions themselves look like this in Node.js:

console.log('start bar')
exports.handle = function(e, ctx) {
  ctx.succeed({ hello: e.name })
}

Apex operates at the project level, but many commands allow you to specify specific functions. For example you may deploy the entire project with a single command:

$ apex deploy

Or whitelist functions to deploy:

$ apex deploy foo bar

Invoke it!

$ echo '{ "name": "Tobi" }' | apex invoke bar
{ "hello": "Tobi" }

See the Documentation for more information.

Links


Build Status Slack Status GoDoc OpenCollective OpenCollective

rpc's People

Contributors

kklas avatar lucat1 avatar satyarohith avatar tj avatar wesleimp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpc's Issues

Unions for response types to include errors

Hello!

Very interested in this library! Looks very useful.

I'm interested in how you approach error handling with this library, but could not find any examples or docs.

Examples of errors might be resource not found for a given id, user not authenticated, user not authorized, etc.

Thanks,
Louis

Generate Terraform providers

It would be great to generate Terraform providers, maybe not for all methods, but it could be opt-in per method.

JSON-Schema superset

I need to look into inheriting from json-schema more, but I think we would then have to support everything JSON-Schema does — oneOf for example — but it would be nice to support the entire thing.

Target all JavaScript platforms with one generator

Prerequisites

  • I searched to see if the issue already exists.
    Related to #7 .

Description

The library could be made isomorphic and therefore also run on client-side JavaScript runtimes if we used a library like isomorphic-(un)fetch. Furthermore using a cross-environment fetch implementation would work on both client-side and deno.
Node would still need to import a package AFAIK you could define the function in the global scope outside of this library, before requiring it, but I don't think it would be ideal.

To make the node implementation isomorphic it would take nothing more than changing the node-fetch import to some isomorphic library. I suggest we do this change internally rather than relying on the user aliasing the module with some bundler like webpack, as not everyone uses it.

Keeping all of this in mind, I think we could could kill two birds with one stone here by simply adding a --fetch-library argument to specify the desired input library or removing it (for deno) with some arbitrary value.

Examples:
--fetch-library=isomorphic-unfetch:

import fetch from 'isomorphic-unfetch'

--fetch-library=deno:

/* no import required */

Generate CLIs

Not a big priority for me, but might be a nice option to generate CLIs, pretty much a 1:1 mapping, for example logs add_project --name 'My Project' --description 'Production logs for My Project' --retention 30 --location us-central1.

Output would be a Go program so it's easy to cross-compile and distribute. Would likely also need some env var support generated for auth etc.

timestamp fields get parsed as string in the ts client

Currently the generated typescript client code simply uses JSON.parse() when parsing responses. timestamp fields will get decoded as strings while in the generated type they're marked as a Date object.

I guess it's related to #3 since validation and decoding would be done at the same time?

Improved validation error messages

Right now it's something like element 5: message is required, might be nicer to use a json-path-ish thing like events[5].message is required. Some tests would also be nice haha

Mock server for testing

We could potentially generate mock servers from any schema, as long as it has example responses defined then just return one of those at random. It could be a nice way for people to test their client implementations.

[TS types] can we have camel casing for field names?

Currently it's snake_cased: https://github.com/apex/rpc/blob/master/generators/tstypes/testdata/todo_types.ts#L4

I'm using prettier on my codebase which is a very opinionated code formatter and I guess many other people are too considering the number of stars it has on github.

Prettier is strict about using camelCasing for object field names so it gives me very annoying eslint errors when I try to instantiate api types.

It would be great if we had a flag in the generator to generate camelCased fields instead. WDYT?

Move rpc-apex-docs

This is just my personal stuff, it's not going to be useful for anyone else.

Deno client

Not sure if it would differ much from the TypeScript/JS Node one, maybe not if it has fetch()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.