Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
8a4e552
fixed compose for wsl
StangaSimo Aug 27, 2025
d848d60
fixed postegress on brokeroo, added kafka on compose and on brokeroo
StangaSimo Aug 29, 2025
6c45947
fixed the fix that unfixed traky
StangaSimo Aug 29, 2025
53a012a
added simple cache and async logger
skipperoo Sep 1, 2025
9239b88
added StatVar delta distance from last point and fuel consumption
skipperoo Sep 1, 2025
025fa6a
Update logger.go
skipperoo Sep 1, 2025
963defd
added ctx on kafka write
StangaSimo Sep 2, 2025
76e1c65
added flink
StangaSimo Sep 3, 2025
393f24c
added retry for brokeroo on mqtt
StangaSimo Sep 3, 2025
4c4b93e
flink is aggregatingggggggg
StangaSimo Sep 4, 2025
e030769
added redis with fallback
skipperoo Sep 5, 2025
d710e4d
adding rabbitmq events watcher
skipperoo Sep 7, 2025
89dfbda
added redis + rabbit events for connection/disconnection
skipperoo Sep 8, 2025
51c09f6
minor fixes
skipperoo Sep 8, 2025
b8e7d38
flink flinking
StangaSimo Sep 9, 2025
0da7501
Merge branch 'master' into simo-dev
StangaSimo Sep 9, 2025
65ba84c
Merge branch 'ls-dev' into simo-dev
StangaSimo Sep 9, 2025
f4f356d
tracky fix
StangaSimo Sep 9, 2025
ac80b02
kube init
StangaSimo Sep 9, 2025
61bcafa
compose
skipperoo Sep 9, 2025
4c4a992
trakeroo broken
StangaSimo Sep 9, 2025
ccf58dd
compose
skipperoo Sep 9, 2025
4d6d87e
compose
skipperoo Sep 9, 2025
6c50d3b
nothing
StangaSimo Sep 9, 2025
04bd301
resolved conflict
StangaSimo Sep 9, 2025
1ac64a1
compose
skipperoo Sep 9, 2025
8ea8774
testing workflow
skipperoo Sep 9, 2025
c33a27a
testing workflow
skipperoo Sep 9, 2025
7fcf0fa
testing workflow
skipperoo Sep 9, 2025
b527d65
testing workflow
skipperoo Sep 9, 2025
db48ffa
testing workflow
skipperoo Sep 9, 2025
a794ec9
testing workflow
skipperoo Sep 9, 2025
a8713d4
testing workflow
skipperoo Sep 9, 2025
f3504a3
testing workflow
skipperoo Sep 9, 2025
ac8d947
testing workflow
skipperoo Sep 9, 2025
e40f7c4
testing workflow
skipperoo Sep 9, 2025
61c52a1
testing workflow
skipperoo Sep 9, 2025
88e6315
testing workflow
skipperoo Sep 9, 2025
5c68d02
added grafana sample dashboard
skipperoo Sep 9, 2025
1ba6c5b
flink update and small brokeroo fixes
StangaSimo Sep 10, 2025
2febdb4
adding http publish
skipperoo Sep 11, 2025
1c7119a
almost flink
StangaSimo Sep 16, 2025
7f0389d
refactor froc
StangaSimo Sep 16, 2025
ba2134e
light refactor of flink
StangaSimo Sep 23, 2025
5f835be
flink refactor
StangaSimo Sep 30, 2025
6154574
merged branches
skipperoo Oct 3, 2025
2c4ea5a
manual ack and removed redundant unmarshal
skipperoo Oct 6, 2025
68f2a6d
Merge branch 'dev' into ls-dev
skipperoo Oct 6, 2025
22047d0
Merge pull request #4 from skiby7/ls-dev
StangaSimo Oct 6, 2025
815c34a
parametri inseritiii
StangaSimo Oct 6, 2025
e45f23c
allowed preflight
skipperoo Oct 7, 2025
da37173
preflight
skipperoo Oct 7, 2025
bb7a4f6
Merge pull request #5 from skiby7/ls-dev
skipperoo Oct 7, 2025
4c0e765
updated gitignore
StangaSimo Oct 7, 2025
fd239d7
updated gitignore
StangaSimo Oct 7, 2025
6601f95
updated gitignore
StangaSimo Oct 7, 2025
ed7e6fa
updated gitignore
StangaSimo Oct 7, 2025
b97f939
removed .gradle
StangaSimo Oct 7, 2025
804470d
removed trash
StangaSimo Oct 7, 2025
a32c2f0
Merge pull request #6 from skiby7/simo-dev
StangaSimo Oct 7, 2025
4e3aefb
changed password
skipperoo Oct 7, 2025
51ef446
fixed schema to allow user apps access to schema trackeroo
skipperoo Oct 7, 2025
3ff728a
added build on pushes o dev
skipperoo Oct 7, 2025
795d227
changed init of tsdb in cluster
skipperoo Oct 7, 2025
18b0300
fixing tsdb
skipperoo Oct 7, 2025
f2495d1
fixing tsdb
skipperoo Oct 7, 2025
6c8e6dc
fixing \tsdb
skipperoo Oct 7, 2025
a98478d
fixing tsdb
skipperoo Oct 7, 2025
feabadb
fixing tsdb
skipperoo Oct 7, 2025
ebf151c
fixing tsdb
skipperoo Oct 7, 2025
b8edad1
fixing tsdb
skipperoo Oct 7, 2025
87cd46c
fixing tsdb
skipperoo Oct 7, 2025
2f2352b
fixing tsdb
skipperoo Oct 7, 2025
37674af
deploying infra
skipperoo Oct 7, 2025
d470334
deploying infra
skipperoo Oct 7, 2025
f3fc2df
deploying infra
skipperoo Oct 7, 2025
055f22f
deploying infra
skipperoo Oct 7, 2025
42f610a
deploying infra
skipperoo Oct 7, 2025
fdd8093
deploying infra
skipperoo Oct 7, 2025
e54d613
deploying infra
skipperoo Oct 7, 2025
c806102
sizes
skipperoo Oct 7, 2025
abac2d0
sizes
skipperoo Oct 7, 2025
d18d97e
fix
skipperoo Oct 7, 2025
65b05bb
fix
skipperoo Oct 7, 2025
a1ad3d5
fix
skipperoo Oct 7, 2025
0c874ef
fix
skipperoo Oct 7, 2025
b8ba3a6
fix
skipperoo Oct 7, 2025
601be8f
fix
skipperoo Oct 7, 2025
ae0460a
fix
skipperoo Oct 7, 2025
afa0d14
fix
skipperoo Oct 7, 2025
a91b2d7
fix
skipperoo Oct 7, 2025
a64e175
fix
skipperoo Oct 7, 2025
206816b
fix
skipperoo Oct 7, 2025
a6de197
fix
skipperoo Oct 7, 2025
18eed95
fix
skipperoo Oct 7, 2025
5719eda
fix
skipperoo Oct 7, 2025
b4dbf45
fix
skipperoo Oct 7, 2025
5cde7ef
fix
skipperoo Oct 7, 2025
fc85f31
fix
skipperoo Oct 7, 2025
44326f8
fix
skipperoo Oct 7, 2025
9f579fb
fix
skipperoo Oct 7, 2025
63edbff
fix
skipperoo Oct 7, 2025
eaf21a0
added retention policy to tsdb
skipperoo Oct 8, 2025
cbe781c
fixed trackeroo deployment
skipperoo Oct 8, 2025
98d78bc
fixed trackeroo deployment
skipperoo Oct 8, 2025
46fdbff
wrong user key mount
skipperoo Oct 8, 2025
1673e31
wrong user key mount
skipperoo Oct 8, 2025
e59b666
tried playbooks
StangaSimo Oct 8, 2025
c53cb74
tried playbooks
StangaSimo Oct 8, 2025
8818633
wrong user key mount
skipperoo Oct 8, 2025
4e8af5e
trackeroo pull polocy
skipperoo Oct 8, 2025
7dd54cc
preventing workloads to be scheduled on the servers
skipperoo Oct 8, 2025
b35032d
preventing workloads to be scheduled on the servers
skipperoo Oct 8, 2025
58d91f3
preventing workloads to be scheduled on the servers
skipperoo Oct 8, 2025
33e09c4
preventing workloads to be scheduled on the servers
skipperoo Oct 8, 2025
56bdcba
preventing workloads to be scheduled on the servers
skipperoo Oct 8, 2025
7a97fe0
preventing workloads to be scheduled on the servers
skipperoo Oct 8, 2025
3b1e65a
preventing workloads to be scheduled on the servers
skipperoo Oct 8, 2025
ef3d922
giving nodes more resources
skipperoo Oct 8, 2025
8bfa91c
redis access to disk
skipperoo Oct 8, 2025
a1a6920
trackeroo mqtt and rabbit handling
skipperoo Oct 8, 2025
e2cb400
trackeroo mqtt and rabbit handling
skipperoo Oct 8, 2025
986cdbf
trackeroo mqtt and rabbit handling
skipperoo Oct 8, 2025
0001d8f
trackeroo mqtt and rabbit handling
skipperoo Oct 8, 2025
4865ba2
ansible maybe
StangaSimo Oct 8, 2025
7825658
Merge remote-tracking branch 'origin/dev' into simo-dev
StangaSimo Oct 8, 2025
61d5be0
flink ansible fix
StangaSimo Oct 8, 2025
9b7bfaf
fix ansible
StangaSimo Oct 8, 2025
b1caaa6
fix
StangaSimo Oct 8, 2025
5521e59
gitignore
skipperoo Oct 8, 2025
b7c665d
fixed kafka
StangaSimo Oct 8, 2025
f3295fb
fix
StangaSimo Oct 8, 2025
2746491
fix
StangaSimo Oct 8, 2025
ca25918
kafka fix
StangaSimo Oct 8, 2025
1b68c0b
fix 1
StangaSimo Oct 8, 2025
6a98d8c
fix 2
StangaSimo Oct 8, 2025
30d682b
kafka
skipperoo Oct 8, 2025
b38fdfb
kafka
skipperoo Oct 8, 2025
ecbb920
kafka
skipperoo Oct 8, 2025
937d1e5
kafka
skipperoo Oct 8, 2025
ce2b17b
kafka
skipperoo Oct 8, 2025
7a079b4
fix 2
StangaSimo Oct 8, 2025
9c4da68
fix 2
StangaSimo Oct 8, 2025
b424ea1
fix kafka
StangaSimo Oct 8, 2025
2fcba99
tags
skipperoo Oct 8, 2025
c3a80be
fix kafka
StangaSimo Oct 8, 2025
197da5f
Merge branch 'simo-dev' of github.com:skiby7/sdc-project into simo-dev
skipperoo Oct 8, 2025
ef1f441
fix flink
StangaSimo Oct 8, 2025
d80ef7b
fix flink 2
StangaSimo Oct 8, 2025
d9b7602
fix flink port
StangaSimo Oct 8, 2025
530d79f
fix flink
StangaSimo Oct 8, 2025
a6f1039
fix flink
StangaSimo Oct 8, 2025
bd0c993
fix flink
StangaSimo Oct 8, 2025
dfeacac
fix flink
StangaSimo Oct 8, 2025
fac4f6d
fix flink
StangaSimo Oct 8, 2025
2832a12
fix flink
StangaSimo Oct 8, 2025
389c91d
Merge branch 'simo-dev' of github.com:skiby7/sdc-project into simo-dev
skipperoo Oct 8, 2025
31678ed
hoping that flink flinks
skipperoo Oct 8, 2025
d5bf2fe
hoping that flink flinks
skipperoo Oct 8, 2025
950074c
hoping that flink flinks
skipperoo Oct 8, 2025
bdd736b
hoping that flink flinkss
skipperoo Oct 8, 2025
157af78
Merge pull request #7 from skiby7/simo-dev
skipperoo Oct 8, 2025
351ba45
allocating resources to brokeroo
skipperoo Oct 8, 2025
c186c01
setting brokeroo replicas and client id
skipperoo Oct 8, 2025
42568a7
changed brokeroo from deployment to statefulset
skipperoo Oct 8, 2025
50a3aa1
prevent rabbit from deleting the messages upon disconnection
skipperoo Oct 8, 2025
44f49af
prevent rabbit from deleting the messages upon disconnection
skipperoo Oct 8, 2025
116a6ea
reverted
skipperoo Oct 8, 2025
1ce3ad3
benchmarking brokeroo
skipperoo Oct 8, 2025
d0b7d0c
shrinking batchsize
skipperoo Oct 8, 2025
4debeb3
auto ack
skipperoo Oct 8, 2025
a3ebe60
increased tsdb storage
skipperoo Oct 8, 2025
53746ff
small brokeroo updates
StangaSimo Oct 11, 2025
de15ca8
Merge branch 'dev' into simo-dev
StangaSimo Oct 11, 2025
eb7a27a
async added to brokero, maybe
StangaSimo Oct 11, 2025
28a1a41
removed .class
StangaSimo Oct 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Comment thread
skipperoo marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ grafana
trackeroo-backend/mongo/data
nominatim-data
osrm-data
mqtt_client
130 changes: 122 additions & 8 deletions trackeroo-backend/brokeroo/cmd/brokeroo/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"database/sql"
"encoding/json"
"fmt"
Expand All @@ -13,6 +14,7 @@ import (

mqtt "github.com/eclipse/paho.mqtt.golang"
_ "github.com/lib/pq"
"github.com/segmentio/kafka-go"
)

type Config struct {
Expand All @@ -22,6 +24,7 @@ type Config struct {
MQTTPassword string
PostgresURL string
TopicPattern string
KafkaBroker string
}

type MQTTData struct {
Expand All @@ -32,14 +35,17 @@ type MQTTData struct {
}

type Service struct {
config *Config
mqttClient mqtt.Client
db *sql.DB
config *Config
mqttClient mqtt.Client
db *sql.DB
kafkaWriter *kafka.Writer
knownTopics map[string]bool /* for caching kafka topics */
}

func NewService(config *Config) *Service {
return &Service{
config: config,
config: config,
knownTopics: make(map[string]bool),
}
}

Expand All @@ -57,6 +63,68 @@ func (s *Service) connectPostgres() error {
return nil
}

func (s *Service) connectKafka() error {
s.kafkaWriter = kafka.NewWriter(kafka.WriterConfig{
Brokers: []string{s.config.KafkaBroker},
})

if err := s.ensureTopicExists("health-check"); err != nil {
log.Printf("failed to create first topic for healt-check: %v", err)
}

err := s.kafkaWriter.WriteMessages(context.Background(),
kafka.Message{
Topic: "health-check",
Value: []byte("ping"),
},
)
if err != nil {
log.Printf("Failed to write test message to Kafka: %v", err)
return err
}

log.Println("Successfully connected to Kafka at", s.config.KafkaBroker)
return nil
}

func (s *Service) ensureTopicExists(topic string) error {

if s.knownTopics[topic] {
return nil
}

conn, err := kafka.Dial("tcp", s.config.KafkaBroker)
if err != nil {
return fmt.Errorf("dial broker: %w", err)
}
defer conn.Close()

controller, err := conn.Controller()
if err != nil {
return fmt.Errorf("get controller: %w", err)
}

controllerConn, err := kafka.Dial("tcp", fmt.Sprintf("%s:%d", controller.Host, controller.Port))
if err != nil {
return fmt.Errorf("dial controller: %w", err)
}
defer controllerConn.Close()

err = controllerConn.CreateTopics(kafka.TopicConfig{
Topic: topic,
NumPartitions: 1,
ReplicationFactor: 1,
})

if err != nil && !strings.Contains(err.Error(), "Topic with this name already exists") {
return fmt.Errorf("create topic %s: %w", topic, err)
}

s.knownTopics[topic] = true
log.Printf("Topic pronto: %s", topic)
return nil
}

func (s *Service) connectMQTT() error {
opts := mqtt.NewClientOptions()
opts.AddBroker(s.config.MQTTBroker)
Expand Down Expand Up @@ -124,19 +192,51 @@ func (s *Service) messageHandler(client mqtt.Client, msg mqtt.Message) {

// Get current Unix timestamp
tsUnix := time.Now().Unix()
ts := time.Now()

if err := s.insertData(tsUnix, devID, tag, jsonPayload); err != nil {
/* postgress */
if err := s.insertData(ts, tsUnix, devID, tag, jsonPayload); err != nil {
log.Printf("Failed to insert data: %v", err)
return
}

/* kafka */
kafkaTopic := sanitizeTopic(topic)

/*TODO check ctx for timeout
tx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

err := s.kafkaWriter.WriteMessages(ctx, kafka.Message{
Topic: kafkaTopic,
Key: []byte(devID),
Value: payload,
})
*/
if err := s.ensureTopicExists(kafkaTopic); err != nil {
log.Printf("Errore creazione topic %s: %v", kafkaTopic, err)
return
}

err := s.kafkaWriter.WriteMessages(context.Background(),
kafka.Message{
Topic: kafkaTopic,
Value: payload,
},
)
if err != nil {
log.Printf("Failed to write to Kafka: %v", err)
} else {
log.Printf("Message forwarded to Kafka topic: %s", kafkaTopic)
}

log.Printf("Successfully inserted data for dev_id: %s, tag: %s", devID, tag)
}

func (s *Service) insertData(tsUnix int64, devID, tag string, payload json.RawMessage) error {
query := `INSERT INTO trackeroo.data (ts_unix, dev_id, tag, payload) VALUES ($1, $2, $3, $4)`
func (s *Service) insertData(ts time.Time, tsUnix int64, devID, tag string, payload json.RawMessage) error {
query := `INSERT INTO trackeroo.data (ts, ts_unix, dev_id, tag, payload) VALUES ($1, $2, $3, $4, $5)`

_, err := s.db.Exec(query, tsUnix, devID, tag, payload)
_, err := s.db.Exec(query, ts, tsUnix, devID, tag, payload)
if err != nil {
return fmt.Errorf("failed to insert into database: %w", err)
}
Expand All @@ -155,6 +255,10 @@ func (s *Service) Start() error {
return err
}

// Connect to Kafka
if err := s.connectKafka(); err != nil {
return err
}
return nil
}

Expand All @@ -171,6 +275,11 @@ func (s *Service) Stop() {
s.db.Close()
log.Println("Closed PostgreSQL connection")
}

if s.kafkaWriter != nil {
s.kafkaWriter.Close()
log.Println("Closed Kafka writer")
}
}

func loadConfig() *Config {
Expand All @@ -181,6 +290,7 @@ func loadConfig() *Config {
MQTTPassword: getEnvOrDefault("MQTT_PASSWORD", ""),
PostgresURL: getEnvOrDefault("POSTGRES_URL", "postgres://user:password@localhost/dbname?sslmode=disable"),
TopicPattern: getEnvOrDefault("TOPIC_PATTERN", "j/data/+/+"),
KafkaBroker: getEnvOrDefault("KAFKA_BROKER", "kafka:9092"),
}
}

Expand All @@ -191,6 +301,10 @@ func getEnvOrDefault(key, defaultValue string) string {
return defaultValue
}

func sanitizeTopic(topic string) string {
return strings.ReplaceAll(topic, "/", "-")
}

func main() {
log.Println("Starting MQTT to PostgreSQL service...")

Expand Down
8 changes: 7 additions & 1 deletion trackeroo-backend/brokeroo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ require (
github.com/lib/pq v1.10.9
)

require (
github.com/klauspost/compress v1.15.9 // indirect
github.com/pierrec/lz4/v4 v4.1.15 // indirect
)

require (
github.com/gorilla/websocket v1.5.3 // indirect
golang.org/x/net v0.27.0 // indirect
github.com/segmentio/kafka-go v0.4.49
golang.org/x/net v0.38.0 // indirect
golang.org/x/sync v0.7.0 // indirect
)
8 changes: 8 additions & 0 deletions trackeroo-backend/brokeroo/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ github.com/eclipse/paho.mqtt.golang v1.5.0 h1:EH+bUVJNgttidWFkLLVKaQPGmkTUfQQqjO
github.com/eclipse/paho.mqtt.golang v1.5.0/go.mod h1:du/2qNQVqJf/Sqs4MEL77kR8QTqANF7XU7Fk0aOTAgk=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY=
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0=
github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/segmentio/kafka-go v0.4.49 h1:GJiNX1d/g+kG6ljyJEoi9++PUMdXGAxb7JGPiDCuNmk=
github.com/segmentio/kafka-go v0.4.49/go.mod h1:Y1gn60kzLEEaW28YshXyk2+VCUKbJ3Qr6DrnT3i4+9E=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
63 changes: 44 additions & 19 deletions trackeroo-backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ services:
MQTT_HOST: localhost
MQTT_PORT: 1883
MQTTS_PORT: 8883
volumes:
- trackeroo-backend-data:/app/data

mongo:
image: mongo:latest
Expand All @@ -33,27 +35,24 @@ services:
retries: 5
start_period: 5s
volumes:
- mongo-data:/data/db
- ./mongo/init.js:/docker-entrypoint-initdb.d/init.js:ro
- ./mongo/data:/data/db

rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
ports:
- "5672:5672" # AMQP
- "15672:15672" # Management UI
- "1883:1883" # MQTT
- "8883:8883" # MQTT
- "5672:5672"
- "15672:15672"
- "1883:1883"
- "8883:8883"
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin123
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: '-rabbitmq_mqtt tcp_listeners [{"0.0.0.0",1883}]'
volumes:
- rabbitmq-data:/var/lib/rabbitmq
- ./rabbitmq/etc:/etc/rabbitmq/
- ./rabbitmq/data:/var/lib/rabbitmq
command: >
bash -c "rabbitmq-plugins enable --offline rabbitmq_mqtt;
rabbitmq-server"

tsdb:
image: ghcr.io/skiby7/tsdb:latest
Expand All @@ -63,16 +62,14 @@ services:
timeout: 5s
retries: 5
container_name: tsdb
command: ["postgres", "-c", "shared_preload_libraries=timescaledb"]
environment:
POSTGRES_DB: tracker_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

# Custom Postgres parameters
POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256 --auth-local=scram-sha-256"

volumes:
- ./tsdb/data:/var/lib/postgresql/data
- tsdb-data:/var/lib/postgresql/data
- ./tsdb/initdb:/docker-entrypoint-initdb.d

pgadmin:
Expand All @@ -85,7 +82,7 @@ services:
ports:
- "8085:80"
volumes:
- ./tsdb/pgadmin_data:/var/lib/pgadmin
- pgadmin-data:/var/lib/pgadmin
depends_on:
tsdb:
condition: service_healthy
Expand All @@ -102,10 +99,13 @@ services:
POSTGRES_URL: postgres://admin:administrator@tsdb:5432/tracker_db?sslmode=disable
TOPIC_PATTERN: j/data/+/+
depends_on:
kafka:
condition: service_started
tsdb:
condition: service_healthy
rabbitmq:
condition: service_started

grafana:
image: grafana/grafana:latest
container_name: grafana
Expand All @@ -114,11 +114,8 @@ services:
tsdb:
condition: service_healthy
environment:
# Default admin user
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin123

# Optional: Configure Grafana to use Postgres as its own database
GF_DATABASE_TYPE: postgres
GF_DATABASE_HOST: tsdb:5432
GF_DATABASE_NAME: tracker_db
Expand All @@ -127,7 +124,35 @@ services:
ports:
- "3000:3000"
volumes:
- ./grafana:/var/lib/grafana
- grafana-data:/var/lib/grafana

zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000

kafka:
image: confluentinc/cp-kafka:7.5.0
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
depends_on:
- zookeeper

volumes:
trackeroo-backend-data:
mongo-data:
rabbitmq-data:
tsdb-data:
pgadmin-data:
grafana-data:

secrets:
users_key:
file: secrets/users_key
file: secrets/users_key
Loading