nitric

command module
v0.14.1-rc.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

Nitric Logo

test status codecov Quality Gate Status

Nitric is a provider independent framework and runtime for cloud-native and serverless applications. Using Nitric, applications take advantage of cloud-native services for events, queues, compute, APIs, storage, and documents without direct integration to cloud specific APIs.

This decoupling enables applications to remain portable between cloud-providers and alternate deployment options such as Kubernetes or stand-alone servers, from a single application codebase.

Documentation

The full documentation is available at nitric.io/docs

Status

Nitric is currently in Public Preview, anyone can use or deploy applications, but work remains and changes are likely

Nitric Membrane

The Membrane is at the heart of the solution. Nitric applications communicate with the Membrane via gRPC to access the following services in a provider agnostic way:

  • Events
  • Queues
  • Storage & Buckets
  • Document Store
  • Secret Store

We provide an expressive infrastructure-as-code style SDK for Node.js. However, Nitric is built on gRPC, so support for many languages is possible.

If you have additional languages you'd like supported, let us know in the issues, we also welcome community contributions for new language support.

Development

Requirements

  • Git
  • Golang (1.16)
  • Make
  • Docker
  • Google Protocol Buffers Compiler

Getting Started

Install dependencies
make install-tools
Install Protocol Buffers

Download the Google Protobuf Compiler (standalone binary called protoc) from https://github.com/protocolbuffers/protobuf and add it to your $PATH.

On MacOS with Homebrew, you can run brew install protobuf On Fedora, run sudo dnf install -y protobuf protobuf-compiler protobuf-devel

Run unit tests

make test

Run integration tests

make test-integration

Build Static Membranes

AWS
Standard Binary

Linux support only - used in container images and for production.

make aws-static
Cross-platform Binary

Useful for local testing

make aws-static-xp
Container Images
make aws-docker
Google Cloud Platform
Standard Binary

Linux support only - used in container images and for production.

make gcp-static
Cross-platform Binary

Useful for local testing

make gcp-static-xp
Container Images
make gcp-docker
Dev Membrane

Note: the Dev Membrane should only be used for local development and testing.

Standard Binary

The dev binary is always cross-platform, since it doesn't need to be optimized for production deployments.

make dev-static
Container Images
make dev-docker

Run Locally

To run the membrane server locally, perform a local build of the membrane binary for the platform you're targeting, then run the resulting binary.

Example building and running the static Google Cloud Membrane locally
# Make the GCP Static Cross-platform binary
make gcp-static-xp

# Run the membrane binary
./bin/membrane

Note: for the AWS membrane, the Lambda Gateway (default) will fail to start. Instead, set the GATEWAY_ENVIRONMENT environment variable so that the HTTP gateway is launched instead.

# Make the AWS Static Cross-platform binary
make aws-static-xp

# Set environment variable in subshell, then run the membrane binary
(export GATEWAY_ENVIRONMENT=http; ./bin/membrane)
Running without a child process

It can be useful to run the Membrane in a 'service only' mode, where the cloud APIs are available but you don't need/want to start a child process to handle incoming request. This can be achieved by setting the MIN_WORKERS variable to 0:

(export MIN_WORKERS=0; ./bin/membrane)

Project Structure

The Membrane project source code structure is outlined below:

Directory Package Description
/interfaces/nitric/v1 v1 protoc generated GRPC services code
/pkg/adapters/grpc grpc GRPC service to SDK adaptors
/pkg/membrane membrane membrane application
/pkg/plugins/... ... Cloud service SDK plugins
/pkg/providers/... main Cloud provider main application and plugin injection
/pkg/sdk sdk SDK service interfaces
/pkg/triggers triggers provides Nitric event triggers
/pkg/utils utils provides utility functions
/pkg/worker worker Membrane workers representing function/service connections
/tests/mocks/... ... Cloud service SDK mocks
/tests/plugins/... ... Plugin services integration test suites
/tools tools include for 3rd party build tools

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cloud
aws Module
azure Module
common Module
debug Module
gcp Module
core module
e2e module
mocks
azblob
Package mock_iface is a generated GoMock package.
Package mock_iface is a generated GoMock package.
azqueue
Package mock_iface is a generated GoMock package.
Package mock_iface is a generated GoMock package.
key_vault
Package mock_key_vault is a generated GoMock package.
Package mock_key_vault is a generated GoMock package.
mock_event_grid
Package mock_eventgridapi is a generated GoMock package.
Package mock_eventgridapi is a generated GoMock package.
nitric
Package mock_v1 is a generated GoMock package.
Package mock_v1 is a generated GoMock package.
s3
Package mock_s3iface is a generated GoMock package.
Package mock_s3iface is a generated GoMock package.
secret_manager
Package mock_secret_manager is a generated GoMock package.
Package mock_secret_manager is a generated GoMock package.
secrets_manager
Package mock_secretsmanageriface is a generated GoMock package.
Package mock_secretsmanageriface is a generated GoMock package.
sqs
Package mock_sqsiface is a generated GoMock package.
Package mock_sqsiface is a generated GoMock package.
sync
Package mock_sync is a generated GoMock package.
Package mock_sync is a generated GoMock package.
worker
Package worker is a generated GoMock package.
Package worker is a generated GoMock package.
pkg
plugins/gateway/app_platform
The Digital Ocean App Platform HTTP gateway plugin
The Digital Ocean App Platform HTTP gateway plugin
plugins/gateway/base_http
The Digital Ocean App Platform HTTP gateway plugin
The Digital Ocean App Platform HTTP gateway plugin
plugins/gateway/cloudrun
The GCP HTTP gateway plugin for CloudRun
The GCP HTTP gateway plugin for CloudRun
plugins/gateway/dev
The AWS HTTP gateway plugin
The AWS HTTP gateway plugin
provider
aws Module
test module
tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL