Skip to content

Commit

Permalink
commit server,agents,clients, AMP Bootstrap and fixes reports
Browse files Browse the repository at this point in the history
* add bootstrap feature to AMP cluster CLI (#306)

* update vendors (huge diff)
  • Loading branch information
freignat91 committed Dec 9, 2016
1 parent f45d1db commit a878678
Show file tree
Hide file tree
Showing 212 changed files with 11,313 additions and 1,932 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/amplifier-gateway
/amp-agent
/amp-log-worker
/amp-cluster
/dist
/*.exe
coverage.out
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.shrink
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ COPY ./amplifier /usr/local/bin/amplifier
COPY ./amp-agent /usr/local/bin/amp-agent
COPY ./amp-log-worker /usr/local/bin/amp-log-worker
COPY ./amplifier-gateway /usr/local/bin/amplifier-gateway
COPY ./cluster-server /usr/local/bin/cluster-server
COPY ./cluster-agent /usr/local/bin/cluster-agent
EXPOSE 50101
ENTRYPOINT []
CMD [ "amplifier" ]
49 changes: 37 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DIRS = $(shell find . -type d $(EXCLUDE_DIRS_FILTER))
PROTOFILES = $(shell find . -type f -name '*.proto' $(EXCLUDE_DIRS_FILTER))

# generated files that can be cleaned

GENERATED := $(shell find . -type f -name '*.pb.go' $(EXCLUDE_FILES_FILTER))

# ignore generated files when formatting/linting/vetting
Expand All @@ -48,6 +49,9 @@ SERVER := amplifier
AGENT := amp-agent
LOGWORKER := amp-log-worker
GATEWAY := amplifier-gateway
CLUSTERSERVER := cluster-server
CLUSTERAGENT := cluster-agent
AMPCLUSTER := amp-cluster

TAG := latest
IMAGE := $(OWNER)/amp:$(TAG)
Expand Down Expand Up @@ -101,62 +105,83 @@ clean:
@rm -f $$(which $(AGENT)) ./$(AGENT)
@rm -f $$(which $(LOGWORKER)) ./$(LOGWORKER)
@rm -f $$(which $(GATEWAY)) ./$(GATEWAY)
@rm -f $$(which $(CLUSTERSERVER)) ./$(CLUSTERSERVER)
@rm -f $$(which $(CLUSTERAGENT)) ./$(CLUSTERAGENT)
@rm -f $$(which $(AMPCLUSTER)) ./$(AMPCLUSTER)

install:
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(CLI)
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(SERVER)
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(AGENT)
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(LOGWORKER)
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(GATEWAY)
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(CLUSTERSERVER)
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(CLUSTERAGENT)
@go install $(LDFLAGS) $(REPO)/$(CMDDIR)/$(AMPCLUSTER)

build:
@hack/build $(CLI)
@hack/build $(SERVER)
@hack/build $(AGENT)
@hack/build $(LOGWORKER)
@hack/build $(GATEWAY)
@hack/build $(CLUSTERAGENT)
@hack/build $(CLUSTERSERVER)
@hack/build $(AMPCLUSTER)

build-server-image:
@docker build --build-arg BUILD=$(BUILD) -t appcelerator/$(SERVER):$(TAG) .

build-cli-linux:
@rm -f $(CLI)
@env GOOS=linux GOARCH=amd64 VERSION=$(VERSION) hack/build $(CLI)
@env GOOS=linux GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(CLI)

build-cli-darwin:
@rm -f $(CLI)
@env GOOS=darwin GOARCH=amd64 VERSION=$(VERSION) hack/build $(CLI)
@env GOOS=darwin GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(CLI)

build-cli-windows:
@rm -f $(CLI).exe
@env GOOS=windows GOARCH=amd64 VERSION=$(VERSION) hack/build $(CLI)
@env GOOS=windows GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(CLI)

build-server-linux:
@rm -f $(SERVER)
@env GOOS=linux GOARCH=amd64 VERSION=$(VERSION) hack/build $(SERVER)
@env GOOS=linux GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(SERVER)

build-server-darwin:
@rm -f $(SERVER)
@env GOOS=darwin GOARCH=amd64 VERSION=$(VERSION) hack/build $(SERVER)
@env GOOS=darwin GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(SERVER)

build-server-windows:
@rm -f $(SERVER).exe
@env GOOS=windows GOARCH=amd64 VERSION=$(VERSION) hack/build $(SERVER)
@env GOOS=windows GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(SERVER)

build-clustercli-linux:
@rm -f $(AMPCLUSTER)
@env GOOS=linux GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(AMPCLUSTER)

build-clustercli-darwin:
@rm -f $(AMPCLUSTER)
@env GOOS=darwin GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(AMPCLUSTER)

dist-linux: build-cli-linux build-server-linux
build-clustercli-windows:
@rm -f $(AMPCLUSTER).exe
@env GOOS=windows GOARCH=amd64 VERSION=$(VERSION) BUILD=$(BUILD) hack/build $(AMPCLUSTER)

dist-linux: build-cli-linux build-server-linux build-clustercli-linux
@rm -f dist/Linux/x86_64/amp-$(VERSION).tgz
@mkdir -p dist/Linux/x86_64
@tar czf dist/Linux/x86_64/amp-$(VERSION).tgz $(CLI) $(SERVER)
@tar czf dist/Linux/x86_64/amp-$(VERSION).tgz $(CLI) $(SERVER) $(AMPCLUSTER)

dist-darwin: build-cli-darwin build-server-darwin
dist-darwin: build-cli-darwin build-server-darwin build-clustercli-darwin
@rm -f dist/Darwin/x86_64/amp-$(VERSION).tgz
@mkdir -p dist/Darwin/x86_64
@tar czf dist/Darwin/x86_64/amp-$(VERSION).tgz $(CLI) $(SERVER)
@tar czf dist/Darwin/x86_64/amp-$(VERSION).tgz $(CLI) $(SERVER) $(AMPCLUSTER)

dist-windows: build-cli-windows build-server-windows
dist-windows: build-cli-windows build-server-windows build-clustercli-windows
@rm -f dist/Windows/x86_64/amp-$(VERSION).zip
@mkdir -p dist/Windows/x86_64
@zip -q dist/Windows/x86_64/amp-$(VERSION).zip $(CLI).exe $(SERVER).exe
@zip -q dist/Windows/x86_64/amp-$(VERSION).zip $(CLI).exe $(SERVER).exe $(AMPCLUSTER).exe

dist: dist-linux dist-darwin dist-windows

Expand Down
15 changes: 8 additions & 7 deletions api/client/amp.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ func (l logger) Println(args ...interface{}) {

// Configuration is for all configurable client settings
type Configuration struct {
Verbose bool
Github string
Target string
Images []string
Port string
ServerAddress string
CmdTheme string
Verbose bool
Github string
Target string
Images []string
Port string
ServerAddress string
ClusterServerAddress string
CmdTheme string
}

// AMP holds the state for the current environment
Expand Down
14 changes: 13 additions & 1 deletion api/rpc/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (s *Stats) StatsQuery(ctx context.Context, req *StatsRequest) (*StatsReply,
}
return ret, nil
}
sort.Sort(result)
sort.Sort(s.cleanUp(result))
return result, nil
}

Expand Down Expand Up @@ -105,6 +105,7 @@ func (s *Stats) combineStats(req *StatsRequest, list *[4]*StatsReply) *StatsRepl
}
}
}

return finalRet

}
Expand Down Expand Up @@ -161,6 +162,17 @@ func (s *Stats) updateRow(ref *StatsEntry, row *StatsEntry) {
}
}

func (s *Stats) cleanUp(result *StatsReply) *StatsReply {
ret := &StatsReply{}
for _, row := range result.Entries {
if row != nil {
ret.Entries = append(ret.Entries, row)
}
}
return ret

}

// statsQueryMetric extracts stat information according to StatsRequest for one metric (cpu | mem | io | net)
func (s *Stats) statQueryMetric(req *StatsRequest, metric string) (*StatsReply, error) {
idFieldName, metricFields := getMetricFieldsName(req, metric)
Expand Down
Loading

0 comments on commit a878678

Please sign in to comment.