Skip to content

Commit

Permalink
Use SSL (#7)
Browse files Browse the repository at this point in the history
* Use SSL config

* Bump version from 1.3.0 -> 1.3.1
  • Loading branch information
TheByronHimes authored Sep 4, 2024
1 parent cb6d620 commit 0802680
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pyproject_generation/pyproject_custom.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "sms"
version = "1.3.0"
version = "1.3.1"
description = "State Management Service - Provides a REST API for basic infrastructure technology state management."
dependencies = [
"typer >= 0.12",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ We recommend using the provided Docker container.

A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/state-management-service):
```bash
docker pull ghga/state-management-service:1.3.0
docker pull ghga/state-management-service:1.3.1
```

Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile):
```bash
# Execute in the repo's root dir:
docker build -t ghga/state-management-service:1.3.0 .
docker build -t ghga/state-management-service:1.3.1 .
```

For production-ready deployment, we recommend using Kubernetes, however,
for simple use cases, you could execute the service using docker
on a single server:
```bash
# The entrypoint is preconfigured:
docker run -p 8080:8080 ghga/state-management-service:1.3.0 --help
docker run -p 8080:8080 ghga/state-management-service:1.3.1 --help
```

If you prefer not to use containers, you may install the service from source:
Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ components:
info:
description: A service for basic infrastructure technology state management.
title: State Management Service
version: 1.3.0
version: 1.3.1
openapi: 3.1.0
paths:
/documents/permissions:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
"Intended Audience :: Developers",
]
name = "sms"
version = "1.3.0"
version = "1.3.1"
description = "State Management Service - Provides a REST API for basic infrastructure technology state management."
dependencies = [
"typer >= 0.12",
Expand Down
7 changes: 6 additions & 1 deletion src/sms/core/events_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from aiokafka import TopicPartition
from aiokafka.admin import AIOKafkaAdminClient, RecordsToDelete
from hexkit.providers.akafka.provider.utils import generate_ssl_context

from sms.config import Config
from sms.ports.inbound.events_handler import EventsHandlerPort
Expand All @@ -33,7 +34,11 @@ def __init__(self, *, config: Config):
@asynccontextmanager
async def get_admin_client(self) -> AsyncGenerator[AIOKafkaAdminClient, None]:
"""Construct and return an instance of AIOKafkaAdminClient that is closed after use."""
admin_client = AIOKafkaAdminClient(bootstrap_servers=self._config.kafka_servers)
admin_client = AIOKafkaAdminClient(
bootstrap_servers=self._config.kafka_servers,
security_protocol=self._config.kafka_security_protocol,
ssl_context=generate_ssl_context(self._config),
)
await admin_client.start()
try:
yield admin_client
Expand Down

0 comments on commit 0802680

Please sign in to comment.