Skip to content

Commit

Permalink
Replace liftbridge with kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
dvolodin7 committed Oct 1, 2024
1 parent 0998509 commit 28e9c88
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 90 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ To see unreleased changes, please see the [CHANGELOG on the master branch](https

* `restart` command.

### Changed

* `liftbridge` service replaced with `kafka`

## 0.6.0 - 2024-08-05

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/gufo/thor/services/activator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

# Gufo Thor modules
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .noc import NocService
from .sae import sae
Expand All @@ -21,7 +21,7 @@ class ActivatorService(NocService):
"""activator service."""

name = "activator"
dependencies = (liftbridge, migrate, sae)
dependencies = (kafka, migrate, sae)


activator = ActivatorService()
4 changes: 2 additions & 2 deletions src/gufo/thor/services/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Gufo Thor modules
from .envoy import envoy
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .mongo import mongo
from .noc import NocHcService
Expand All @@ -22,7 +22,7 @@ class AuthService(NocHcService):
"""auth service."""

name = "auth"
dependencies = (envoy, liftbridge, migrate, mongo)
dependencies = (envoy, kafka, migrate, mongo)
allow_scale = True
expose_http_prefix = "/api/auth/"
compose_command = (
Expand Down
4 changes: 2 additions & 2 deletions src/gufo/thor/services/chwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Gufo Thor modules
from .clickhouse import clickhouse
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .noc import NocService

Expand All @@ -21,7 +21,7 @@ class ChwriterService(NocService):
"""chwriter service."""

name = "chwriter"
dependencies = (clickhouse, liftbridge, migrate)
dependencies = (clickhouse, kafka, migrate)


chwriter = ChwriterService()
4 changes: 2 additions & 2 deletions src/gufo/thor/services/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

# Gufo Thor modules
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .mongo import mongo
from .noc import NocService
Expand All @@ -22,7 +22,7 @@ class ClassifierService(NocService):
"""classifier service."""

name = "classifier"
dependencies = (liftbridge, migrate, mongo, postgres)
dependencies = (kafka, migrate, mongo, postgres)


classifier = ClassifierService()
4 changes: 2 additions & 2 deletions src/gufo/thor/services/correlator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

# Gufo Thor modules
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .mongo import mongo
from .noc import NocService
Expand All @@ -22,7 +22,7 @@ class CorrelatorService(NocService):
"""correlator service."""

name = "correlator"
dependencies = (liftbridge, migrate, mongo, postgres)
dependencies = (kafka, migrate, mongo, postgres)


correlator = CorrelatorService()
38 changes: 38 additions & 0 deletions src/gufo/thor/services/kafka.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ---------------------------------------------------------------------
# Gufo Thor: kafka service
# ---------------------------------------------------------------------
# Copyright (C) 2023, Gufo Labs
# ---------------------------------------------------------------------
"""
kafka service.
Attributes:
kafka: kafka service singleton.
"""

# Gufo Thor modules
from .base import BaseService


class KafkaService(BaseService):
"""kafka service."""

name = "kafka"
compose_image = "bitnami/kafka:3.6.2"
compose_volumes = [
"kafka_data:/data/",
]
compose_volumes_config = {"kafka_data": {}}
service_discovery = {"kafka": 9093}
compose_environment = {
"KAFKA_CFG_NODE_ID": "0",
"KAFKA_CFG_PROCESS_ROLES": "controller,broker",
"KAFKA_CFG_LISTENERS": "PLAINTEXT://:9092,CONTROLLER://:9093",
"KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP": "CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT",
"KAFKA_CFG_CONTROLLER_QUORUM_VOTERS": "0@kafka:9093",
"KAFKA_CFG_CONTROLLER_LISTENER_NAMES": "CONTROLLER",
"KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE": "false",
}


kafka = KafkaService()
46 changes: 0 additions & 46 deletions src/gufo/thor/services/liftbridge.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/gufo/thor/services/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .base import ComposeDependsCondition
from .clickhouse import clickhouse
from .consul import consul
from .liftbridge import liftbridge
from .kafka import kafka
from .mongo import mongo
from .noc import NocService
from .postgres import postgres
Expand All @@ -38,7 +38,7 @@ class MigrateService(NocService):
"""

name = "migrate"
dependencies = (clickhouse, consul, liftbridge, mongo, postgres)
dependencies = (clickhouse, consul, kafka, mongo, postgres)
compose_depends_condition = ComposeDependsCondition.COMPLETED_SUCCESSFULLY
compose_command = "./scripts/deploy/migrate.sh"

Expand Down
4 changes: 2 additions & 2 deletions src/gufo/thor/services/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Gufo Thor modules
from .datastream import datastream
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .noc import NocService

Expand All @@ -21,7 +21,7 @@ class PingService(NocService):
"""ping service."""

name = "ping"
dependencies = (datastream, liftbridge, migrate)
dependencies = (datastream, kafka, migrate)
compose_extra = {
"cap_add": [
"NET_RAW",
Expand Down
4 changes: 2 additions & 2 deletions src/gufo/thor/services/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

# Gufo Thor modules
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .mongo import mongo
from .noc import NocService
Expand All @@ -21,7 +21,7 @@ class RunnerService(NocService):
"""runner service."""

name = "runner"
dependencies = (liftbridge, migrate, mongo)
dependencies = (kafka, migrate, mongo)
allow_scale = False
require_slots = False

Expand Down
4 changes: 2 additions & 2 deletions src/gufo/thor/services/syslogcollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Gufo Thor modules
from .datastream import datastream
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .noc import NocService

Expand All @@ -21,7 +21,7 @@ class SyslogcollectorService(NocService):
"""syslogcollector service."""

name = "syslogcollector"
dependencies = (datastream, liftbridge, migrate)
dependencies = (datastream, kafka, migrate)


syslogcollector = SyslogcollectorService()
4 changes: 2 additions & 2 deletions src/gufo/thor/services/topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Gufo Thor modules
from .datastream import datastream
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .noc import NocService

Expand All @@ -21,7 +21,7 @@ class TopoService(NocService):
"""topo service."""

name = "topo"
dependencies = (datastream, liftbridge, migrate)
dependencies = (datastream, kafka, migrate)


topo = TopoService()
4 changes: 2 additions & 2 deletions src/gufo/thor/services/trapcollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Gufo Thor modules
from .datastream import datastream
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .noc import NocService

Expand All @@ -21,7 +21,7 @@ class TrapcollectorService(NocService):
"""trapcollector service."""

name = "trapcollector"
dependencies = (datastream, liftbridge, migrate)
dependencies = (datastream, kafka, migrate)


trapcollector = TrapcollectorService()
4 changes: 2 additions & 2 deletions src/gufo/thor/services/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Gufo Thor modules
from .datastream import datastream
from .liftbridge import liftbridge
from .kafka import kafka
from .migrate import migrate
from .mongo import mongo
from .noc import NocService
Expand All @@ -23,7 +23,7 @@ class WorkerService(NocService):
"""worker service."""

name = "worker"
dependencies = (datastream, liftbridge, migrate, mongo, postgres)
dependencies = (datastream, kafka, migrate, mongo, postgres)
allow_scale = True
require_slots = True

Expand Down
17 changes: 0 additions & 17 deletions src/gufo/thor/templates/liftbridge/liftbridge.yml

This file was deleted.

4 changes: 4 additions & 0 deletions src/gufo/thor/templates/noc/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ pg:
web:
theme: >
{{theme}}
msgstream:
client_class: noc.core.msgstream.redpanda.RedPandaClient
redpanda:
addresses: kafka:9092
6 changes: 3 additions & 3 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from gufo.thor.services.consul import consul
from gufo.thor.services.datastream import datastream
from gufo.thor.services.envoy import envoy
from gufo.thor.services.liftbridge import liftbridge
from gufo.thor.services.kafka import kafka
from gufo.thor.services.login import login
from gufo.thor.services.migrate import migrate
from gufo.thor.services.mongo import mongo
Expand Down Expand Up @@ -55,7 +55,7 @@ def test_depends_sorted(svc: str) -> None:
consul,
datastream,
envoy,
liftbridge,
kafka,
login,
migrate,
mongo,
Expand Down Expand Up @@ -133,7 +133,7 @@ def test_migrate_deps(svc: str) -> None:
assert (
migrate in deps
), "Depends on `clickhouse`, must depend on `migrate`"
if liftbridge in deps:
if kafka in deps:
assert (
migrate in deps
), "Depends on `liftbridge`, must depend on `migrate`"
Expand Down

0 comments on commit 28e9c88

Please sign in to comment.