Skip to content

jaypeng2015/go-decision-maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decision Maker

Codeship Status for jaypeng2015/go-decision-maker

The decision maker in Go.

Instead of using AWS Step Functions, this one is just AWS API Gateway + Lambda Function.

Step by Step

Install Go

Mac:

brew install go

The latest version of go will be installed into ~/go.

For non Mac users, please read this.

Quick Start

cd ~/go
mkdir -p src/jaypeng2015/
git clone https://github.com/jaypeng2015/decision-maker
cd decision-maker
go get -v ./...
go test -v

Setup IDE

Provision

Configure your AWS credentials

  • Install the AWS CLI for your operating system.

  • Configure your AWS security access keys

      aws --profile decisionmaker configure
      AWS Access Key ID [None]: xxxxxxxxxxxxxxxx
      AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxx
      Default region name [None]: ap-southeast-2
      Default output format [None]: json
    
  • Activate the decisionmaker profile

      export AWS_PROFILE=decisionmaker
      export AWS_REGION=ap-southeast-2 ## To avoid `Error: MissingRegion: could not find region configuration`
    

Create an S3 Bucket

Create an S3 bucket and make sure you have write access since Sparta uploads the lambda package and CloudFormation template to that bucket as part of provisioning.

Check What Will Happen

Get a view of what’s going on by the describe command (replacing $S3_BUCKET with the S3 bucket you just created).

mkdir .sparta
go run application.go --level info describe --out .sparta/graph.html --s3Bucket $S3_BUCKET

Then open graph.html in your browser to see what will be provisioned.

Deploy

Replace $S3_BUCKET with the S3 bucket you just created and run:

go run application.go provision --s3Bucket $S3_BUCKET

Full Command Lines

A compiled application provides several command line options which are available by providing the -h/--help option as in:

$ go run application.go --help

The Decision Maker in Go.

Usage:
  application [command]

Available Commands:
  delete      Delete service
  describe    Describe service
  execute     Execute
  explore     Interactively explore service
  help        Help about any command
  provision   Provision service
  version     Sparta framework version

Flags:
  -f, --format string    Log format [text, json] (default "text")
  -h, --help             help for application
      --ldflags string   Go linker string definition flags (https://golang.org/cmd/link/)
  -l, --level string     Log level [panic, fatal, error, warn, info, debug] (default "info")
  -n, --noop             Dry-run behavior only (do not perform mutations)
  -t, --tags string      Optional build tags for conditional compilation

Use "application [command] --help" for more information about a command.

More information can be found here.

About

The decision maker in Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages