Skip to content

Commit

Permalink
Merge pull request #9 from srikrishnabh1/srbh
Browse files Browse the repository at this point in the history
initial code base
  • Loading branch information
share2kanna committed Nov 3, 2022
2 parents 98eff43 + ec6828e commit 8f950c4
Show file tree
Hide file tree
Showing 46 changed files with 3,913 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
all:
cd proto && protoc --go_out=../agent/pkg/agentpb/ --go_opt=paths=source_relative \
--go-grpc_out=../agent/pkg/agentpb/ --go-grpc_opt=paths=source_relative \
./agent.proto

cd proto && protoc --go_out=../server/pkg/pb/agentpb --go_opt=paths=source_relative \
--go-grpc_out=../server/pkg/pb/agentpb --go-grpc_opt=paths=source_relative \
./agent.proto

cd proto && protoc --go_out=../server/pkg/pb/climonpb --go_opt=paths=source_relative \
--go-grpc_out=../server/pkg/pb/climonpb --go-grpc_opt=paths=source_relative \
./climon.proto

cd proto && protoc --go_out=../cilmon/pkg/pb/climonpb --go_opt=paths=source_relative \
--go-grpc_out=../cilmon/pkg/pb/climonpb --go-grpc_opt=paths=source_relative \
./climon.proto
16 changes: 16 additions & 0 deletions agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.19 AS builder
# All these steps will be cached
RUN mkdir /agent
WORKDIR /agent

# COPY the source code as the last step
COPY . .
RUN go mod vendor
RUN go build -o intelopsagent cmd/agent/main.go

FROM alpine:3.16
RUN apk add --no-cache libc6-compat
RUN mkdir /agent
WORKDIR /agent
COPY --from=builder /agent/intelopsagent .
ENTRYPOINT ["./intelopsagent"]
28 changes: 28 additions & 0 deletions agent/cmd/agent/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"log"
"net"

"google.golang.org/grpc"

"intelops.io/agent/pkg/agentpb"
"intelops.io/agent/pkg/config"
"intelops.io/agent/pkg/server"
)

func main() {
listener, err := net.Listen("tcp", config.DefaultAgentPort)
if err != nil {
log.Fatalf("failed to listen: %v", err)
}

grpcServer := grpc.NewServer()
agentpb.RegisterAgentServer(grpcServer, &server.Agent{})
log.Println("server listening at ", listener.Addr())
//Todo: handle the interrupts

if err := grpcServer.Serve(listener); err != nil {
log.Fatalf("failed to start agent : %v", err)
}
}
34 changes: 34 additions & 0 deletions agent/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module intelops.io/agent

go 1.19

require (
go.temporal.io/sdk v1.17.0
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/status v1.1.1 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/stretchr/testify v1.8.0 // indirect
go.temporal.io/api v1.11.1-0.20220907050538-6de5285cf463 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/net v0.0.0-20220906165146-f3363e06e74c // indirect
golang.org/x/sys v0.0.0-20220906165534-d0df966e6959 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
google.golang.org/genproto v0.0.0-20220902135211-223410557253 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
239 changes: 239 additions & 0 deletions agent/go.sum

Large diffs are not rendered by default.

220 changes: 220 additions & 0 deletions agent/pkg/agentpb/agent.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f950c4

Please sign in to comment.