Skip to content

Commit

Permalink
aggiunto Twilio-AlertMonitoring,
Browse files Browse the repository at this point in the history
MongoDB
DockerCompose
  • Loading branch information
Andrea-Cavallo committed Aug 17, 2024
1 parent 9679426 commit ed74612
Show file tree
Hide file tree
Showing 24 changed files with 790 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go

go:
- "1.22"
- "1.23"
- "tip"

matrix:
Expand Down
45 changes: 1 addition & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,8 @@
# Super cool Go con GRPC

<img src="GRPC.png" alt="600">


## Struttura packages
```text
/go_with_grpc
├── /api # Definizioni condivise delle API
│ └── /protos
│ └── temperature.proto
├── /pkg # Codice condiviso (pkg temperature)
│ └── /temperature
│ ├── temperature.pb.go
│ └── temperature_grpc.pb.go
├── /temperature_grpc_client # grpc client per le implementazioni
│ ├── /cmd
│ │ └── /client
│ │ └── main.go
│ └── /service
│ ├── client.go
│ └── client.md
├── /temperature_grpc_server # grpc server
│ ├── /cmd
│ │ └── /server
│ │ └── main.go
│ └── /service
│ └── server.go
├── .idea
├── .editorconfig
├── .gitignore
├── .travis.yml
├── common.mk
├── go.mod
├── go_with_grpc.iml
├── Makefile
├── qodana.yml
├── README.md
└── requirements.txt
<img src="GRPC.png" height="800" width="600">


```

## Esecuzione del Progetto

### 1. Prerequisiti
Expand Down
1 change: 0 additions & 1 deletion api/protos/temperature.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ message TemperatureReading {
int64 timestamp = 3; // Timestamp Unix della lettura
}


// Richiesta per ottenere la temperatura attuale in questo caso prende in ingresso solo la citta
message GetCurrentTemperatureRequest {
string location = 1;
Expand Down
92 changes: 92 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
version: '3.8'

services:
mongodb:
image: mongo:latest
container_name: my_mongodb
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
MONGO_INITDB_DATABASE: temperatureDB
volumes:
- mongo_data:/data/db
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js

jaeger:
image: jaegertracing/all-in-one:1.32
container_name: jaeger
ports:
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
- "5778:5778"
- "16686:16686"
- "14268:14268"
- "14250:14250"
- "4317:4317" # Porta OTLP gRPC per i tracciamenti
- "9411:9411"

otel-collector:
image: otel/opentelemetry-collector:latest
command: ["--config=/etc/otel-collector-config.yaml"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "4319:4317"
- "55681:55681"


prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml

grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=secret

loki:
image: grafana/loki:2.7.1
container_name: loki
ports:
- "3100:3100"
volumes:
- ./loki-config.yml:/etc/loki/loki-config.yml

node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
ports:
- "9100:9100"

cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.1
container_name: cadvisor
ports:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro

k6:
image: loadimpact/k6:latest
container_name: k6
volumes:
- ./scripts:/scripts
- ./api/protos:/api/protos
entrypoint: ["k6", "run", "/scripts/grpc-test.js"]

volumes:
mongo_data:
clickhouse_data:
39 changes: 39 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,52 @@ module go_with_grpc
go 1.23

require (
github.com/twilio/twilio-go v1.22.3
go.mongodb.org/mongo-driver v1.16.1
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0
go.opentelemetry.io/otel/sdk v1.28.0
gonum.org/v1/plot v0.14.0
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
)

require (
git.sr.ht/~sbinet/gg v0.5.0 // indirect
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect
github.com/campoy/embedmd v1.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/go-fonts/liberation v0.3.3 // indirect
github.com/go-latex/latex v0.0.0-20240709081214-31cef3c7570e // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-pdf/fpdf v0.9.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/image v0.19.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
)
Loading

0 comments on commit ed74612

Please sign in to comment.