Coder Social home page Coder Social logo

8l4nk / sparta Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mweagle/sparta

0.0 1.0 0.0 177.26 MB

go microservices, powered by AWS Lambda

Home Page: https://gosparta.io

License: MIT License

Go 64.27% JavaScript 8.18% CSS 5.42% HTML 22.12% Shell 0.02%

sparta's Introduction

Sparta

Build Status

GoDoc

Go Report Card

Visit gosparta.io for complete documentation.

Overview

Sparta takes a set of golang functions and automatically provisions them in AWS Lambda as a logical unit.

AWS Lambda functions are defined using the standard AWS Lambda signatures:

  • func()
  • func() error
  • func(TIn) error
  • func() (TOut, error)
  • func(context.Context) error
  • func(context.Context, TIn) error
  • func(context.Context) (TOut, error)
  • func(context.Context, TIn) (TOut, error)

The TIn and TOut parameters represent encoding/json un/marshallable types.

For instance:

// Standard AWS λ function
func helloWorld(ctx context.Context) (string, error) {
  ...
}

where

  • ctx : The request context that includes both the AWS Context as well as Sparta specific values

Consumers define a set of lambda functions and provide them to Sparta to create a self-documenting, self-deploying AWS Lambda binary:

  lambdaFn, _ := sparta.NewAWSLambda("Hello World",
    helloWorld,
    sparta.IAMRoleDefinition{})

  var lambdaFunctions []*sparta.LambdaAWSInfo
  lambdaFunctions = append(lambdaFunctions, lambdaFn)

  err := sparta.Main("HelloWorldStack",
    "My Hello World stack",
    lambdaFunctions,
    nil,
    nil)

Visit gosparta.io for complete documentation.

Contributing

Sparta contributions are most welcome. Please consult the latest issues for open issues.

Building

Locally building or testing Sparta itself is typically only needed to make package changes. Sparta is more often used as a required import of another application. Building is done via mage.

To get started building and verifying local changes:

  1. go get -u -d github.com/magefile/mage
  2. In the .../mweagle/Sparta directory, run mage -l to list the current targets:

$ mage -l Targets: build the application clean the working directory compareAgainstMasterBranch is a convenience function to show the comparisons of the current pushed branch against the master branch describe runs the TestDescribe test to generate a describe HTML output file at graph.html docsBuild builds the public documentation site in the /docs folder docsCommit builds and commits the current documentation with an autogenerated comment docsEdit starts a Hugo server and hot reloads the documentation at http://localhost:1313 docsInstallRequirements installs the required Hugo version ensureAllPreconditions ensures that the source passes ALL static ensure* precondition steps ensureCleanTree ensures that the git tree is clean ensureFormatted ensures that the source code is formatted with goimports ensureGoFmt ensures that the source is gofmt -s is empty ensureLint ensures that the source is golinted ensureMarkdownSpelling ensures that all *.MD files are checked for common spelling mistakes ensurePrealloc ensures that slices that could be preallocated are enforced ensureSpelling ensures that there are no misspellings in the source ensureStaticChecks ensures that the source code passes static code checks ensureTravisBuildEnvironment is the command that sets up the Travis environment to run the build. ensureVet ensures that the source has been go vetted generateBuildInfo creates the automatic buildinfo.go file so that we can stamp the SHA into the binaries we build... generateConstants runs the set of commands that update the embedded CONSTANTS for both local and AWS Lambda execution installBuildRequirements installs or updates the dependent packages that aren't referenced by the source, but are needed to build the Sparta source logCodeMetrics ensures that the source code is formatted with goimports publish the latest source test runs the Sparta tests testCover runs the test and opens up the resulting report travisBuild is the task to build in the context of a Travis CI pipeline

Confirm tests are passing on HEAD by first running mage -v test.

As you periodically make local changes, run mage -v test to confirm backward compatibility.

Tests

When possible, please include a test case that verifies the local change and ensures compatibility.

Contributors

Thanks to all Sparta contributors (alphabetical):

sparta's People

Contributors

bbigras avatar daniel-cavallaro avatar dependabot[bot] avatar mjuarez avatar mweagle avatar nylar avatar philippgille avatar ryansb avatar sasanrose avatar sdbeard avatar solarkennedy avatar swinz avatar thomshutt avatar

Watchers

 avatar

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.