diff --git a/container/start.sh b/container/start.sh index 0897b83e3..15f2b10db 100755 --- a/container/start.sh +++ b/container/start.sh @@ -26,7 +26,7 @@ case $1 in echo "{}" > /opt/karapace/rest.config.json echo "Starting Karapace REST API" - exec python3 -m karapace.kafka_rest_apis /opt/karapace/rest.config.json + exec python3 -m karapace.karapace_all /opt/karapace/rest.config.json ;; registry) # Reexport variables for compatibility @@ -46,7 +46,7 @@ case $1 in echo "{}" > /opt/karapace/registry.config.json echo "Starting Karapace Schema Registry" - exec python3 -m karapace.schema_registry_apis /opt/karapace/registry.config.json + exec python3 -m karapace.karapace_all /opt/karapace/registry.config.json ;; *) echo "usage: start-karapace.sh " diff --git a/karapace/kafka_rest_apis/__main__.py b/karapace/kafka_rest_apis/__main__.py deleted file mode 100644 index cea52308b..000000000 --- a/karapace/kafka_rest_apis/__main__.py +++ /dev/null @@ -1,34 +0,0 @@ -from contextlib import closing -from karapace import version as karapace_version -from karapace.config import DEFAULT_LOG_FORMAT_JOURNAL, read_config -from karapace.kafka_rest_apis import KafkaRest - -import argparse -import logging -import sys - - -def main() -> int: - parser = argparse.ArgumentParser(prog="karapace rest", description="Karapace: Your Kafka essentials in one tool") - parser.add_argument("--version", action="version", help="show program version", version=karapace_version.__version__) - parser.add_argument("config_file", help="configuration file path", type=argparse.FileType()) - arg = parser.parse_args() - - with closing(arg.config_file): - config = read_config(arg.config_file) - - logging.basicConfig(level=logging.INFO, format=DEFAULT_LOG_FORMAT_JOURNAL) - logging.getLogger().setLevel(config["log_level"]) - kc = KafkaRest(config=config) - try: - kc.run(host=kc.config["host"], port=kc.config["port"]) - except Exception: # pylint: disable-broad-except - if kc.raven_client: - kc.raven_client.captureException(tags={"where": "karapace_rest"}) - raise - - return 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/karapace/schema_registry_apis.py b/karapace/schema_registry_apis.py index c4de94ea9..336f65e7c 100644 --- a/karapace/schema_registry_apis.py +++ b/karapace/schema_registry_apis.py @@ -1,12 +1,9 @@ from avro.errors import SchemaParseException -from contextlib import closing from enum import Enum, unique from http import HTTPStatus from kafka import KafkaProducer -from karapace import version as karapace_version from karapace.compatibility import check_compatibility, CompatibilityModes from karapace.compatibility.jsonschema.checks import is_incompatible -from karapace.config import DEFAULT_LOG_FORMAT_JOURNAL, read_config from karapace.karapace import KarapaceBase from karapace.master_coordinator import MasterCoordinator from karapace.rapu import HTTPRequest @@ -14,10 +11,7 @@ from karapace.utils import json_encode, KarapaceKafkaClient from typing import Any, Dict, Optional, Tuple -import argparse import asyncio -import logging -import sys import time @@ -907,29 +901,3 @@ def no_master_error(self, content_type): content_type=content_type, status=HTTPStatus.INTERNAL_SERVER_ERROR, ) - - -def main() -> int: - parser = argparse.ArgumentParser(prog="karapace", description="Karapace: Your Kafka essentials in one tool") - parser.add_argument("--version", action="version", help="show program version", version=karapace_version.__version__) - parser.add_argument("config_file", help="configuration file path", type=argparse.FileType()) - arg = parser.parse_args() - - with closing(arg.config_file): - config = read_config(arg.config_file) - - logging.basicConfig(level=logging.INFO, format=DEFAULT_LOG_FORMAT_JOURNAL) - logging.getLogger().setLevel(config["log_level"]) - kc = KarapaceSchemaRegistry(config=config) - try: - kc.run(host=kc.config["host"], port=kc.config["port"]) - except Exception: # pylint: disable-broad-except - if kc.raven_client: - kc.raven_client.captureException(tags={"where": "karapace"}) - raise - - return 0 - - -if __name__ == "__main__": - sys.exit(main())