This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmd = exec.Command("go", "build", "-o", executableOutput, "-tags", "lambdabinary", ".") | |
cmd.Env = os.Environ() | |
cmd.Env = append(cmd.Env, "GOOS=linux", "GOARCH=amd64") | |
ctx.logger.WithFields(logrus.Fields{ | |
"Name": executableOutput, | |
}).Info("Compiling binary") | |
err = runOSCommand(cmd, ctx.logger) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func NewLambda(roleNameOrIAMRoleDefinition interface{}, | |
fn LambdaFunction, | |
lambdaOptions *LambdaFunctionOptions) *LambdaAWSInfo { | |
if nil == lambdaOptions { | |
lambdaOptions = &LambdaFunctionOptions{"", 128, 3, nil} | |
} | |
lambdaPtr := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()) | |
lambda := &LambdaAWSInfo{ | |
lambdaFnName: lambdaPtr.Name(), | |
lambdaFn: fn, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createForwarder = function(path) { | |
var forwardToGolangProcess = function(event, context, metricName) | |
{ | |
if (!golangProcess) { | |
ensureGoLangBinary(function() { | |
golangProcess = child_process.spawn(SPARTA_BINARY_PATH, ['execute', '--signal', process.pid], {}); | |
golangProcess.stdout.on('data', function(buf) { | |
buf.toString('utf-8').split('\n').forEach(function (eachLine) { | |
sparta_utils.log(eachLine); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INFO[0000] Welcome to Sparta Option=provision TS=2016-04-11T17:16:54Z Version=0.5.5 | |
INFO[0000] -------------------------------------------------------------------------------- | |
INFO[0000] Verifying IAM Lambda execution roles | |
INFO[0000] IAM roles verified Count=1 | |
INFO[0000] Running `go generate` | |
INFO[0000] Compiling binary Name=SpartaHelloWorld.lambda.amd64 | |
INFO[0008] Executable binary size KB=13317 MB=13 | |
INFO[0008] Creating ZIP archive for upload TempName=/Users/mweagle/Documents/gopath/src/MediumPost/SpartaHelloWorld440815707 | |
INFO[0009] Registering Sparta function FunctionName=main.helloWorld | |
INFO[0009] Lambda function deployment package size KB=4779 MB=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: application.go | |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"github.com/Sirupsen/logrus" | |
sparta "github.com/mweagle/Sparta" |
NewerOlder