From 590ed81b83028ebc0b74f7b0100a26f120c3202e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Garc=C3=ADa=20Prado?= Date: Wed, 9 Feb 2022 10:51:03 +0100 Subject: [PATCH 01/17] ISSUE #? * Update kafka mount path. --- .../kubernetes/external/kafka/deploy/deployment.yaml.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/broker/kafka/deploy/kubernetes/external/kafka/deploy/deployment.yaml.jinja b/project/broker/kafka/deploy/kubernetes/external/kafka/deploy/deployment.yaml.jinja index 27a1ec9..6c79650 100644 --- a/project/broker/kafka/deploy/kubernetes/external/kafka/deploy/deployment.yaml.jinja +++ b/project/broker/kafka/deploy/kubernetes/external/kafka/deploy/deployment.yaml.jinja @@ -29,7 +29,7 @@ spec: fieldPath: status.podIP volumeMounts: - name: kafka - mountPath: /kafka + mountPath: /kafka/kafka-logs volumes: - name: kafka persistentVolumeClaim: From 20e80f385dd1166652b2a256978a2042118c4425 Mon Sep 17 00:00:00 2001 From: albamig Date: Wed, 9 Feb 2022 15:00:14 +0100 Subject: [PATCH 02/17] - Repository added. issue #24 --- microservice/language/python/init/_utils.py | 1 + .../language/python/init/config.yml.jinja | 6 ++++++ .../python/init/src/queries/models.py.jinja | 3 +++ .../python/init/src/queries/repository.py.jinja | 16 ++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 microservice/language/python/init/src/queries/models.py.jinja create mode 100644 microservice/language/python/init/src/queries/repository.py.jinja diff --git a/microservice/language/python/init/_utils.py b/microservice/language/python/init/_utils.py index 7b66f39..4c718cc 100644 --- a/microservice/language/python/init/_utils.py +++ b/microservice/language/python/init/_utils.py @@ -20,5 +20,6 @@ def build_deploy_playbook(path: Path) -> str: data = list() data.append({"name": "Create Database", "import_playbook": "create-database.yaml"}) + data.append({"name": "Create Query Database", "import_playbook": "create-database.yaml"}) return yaml.dump(data, sort_keys=False) diff --git a/microservice/language/python/init/config.yml.jinja b/microservice/language/python/init/config.yml.jinja index af0d649..fce4ad7 100644 --- a/microservice/language/python/init/config.yml.jinja +++ b/microservice/language/python/init/config.yml.jinja @@ -44,6 +44,12 @@ repository: password: "" host: localhost port: 5432 +query_repository: + database: {{ name }}_db + user: postgres + password: "" + host: localhost + port: 5432 snapshot: database: {{ name }}_db user: postgres diff --git a/microservice/language/python/init/src/queries/models.py.jinja b/microservice/language/python/init/src/queries/models.py.jinja new file mode 100644 index 0000000..95ebc0c --- /dev/null +++ b/microservice/language/python/init/src/queries/models.py.jinja @@ -0,0 +1,3 @@ +from sqlalchemy.orm import declarative_base + +Base = declarative_base() \ No newline at end of file diff --git a/microservice/language/python/init/src/queries/repository.py.jinja b/microservice/language/python/init/src/queries/repository.py.jinja new file mode 100644 index 0000000..b757691 --- /dev/null +++ b/microservice/language/python/init/src/queries/repository.py.jinja @@ -0,0 +1,16 @@ +from minos.common import MinosSetup, MinosConfig +from sqlalchemy import create_engine +from src.queries.models import Base + +class {{ aggregate }}QueryServiceRepository(MinosSetup): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.engine = create_engine({{ THE URL DATABASE }}) + + async def _setup(self) -> None: + Base.metadata.create_all(self.engine) + + @classmethod + def _from_config(cls, *args, config: MinosConfig, **kwargs) -> {{ aggregate }}QueryRepository: + return cls(*args, **(config.query_repository._asdict()) | kwargs) \ No newline at end of file From aecd0800ec1800881156288c968d184f6d2127d3 Mon Sep 17 00:00:00 2001 From: albamig Date: Wed, 9 Feb 2022 15:44:43 +0100 Subject: [PATCH 03/17] - Query repository extended. issue #24 --- .../language/python/init/src/__init__.py.jinja | 1 + .../language/python/init/src/queries/__init__.py.jinja | 4 ++++ .../python/init/src/queries/repository.py.jinja | 10 ++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/microservice/language/python/init/src/__init__.py.jinja b/microservice/language/python/init/src/__init__.py.jinja index 002718a..fcd3dcd 100644 --- a/microservice/language/python/init/src/__init__.py.jinja +++ b/microservice/language/python/init/src/__init__.py.jinja @@ -13,4 +13,5 @@ from .commands import ( ) from .queries import ( {{ aggregate }}QueryService, + {{ aggregate }}QueryServiceRepository, ) diff --git a/microservice/language/python/init/src/queries/__init__.py.jinja b/microservice/language/python/init/src/queries/__init__.py.jinja index cdf600b..49f9072 100644 --- a/microservice/language/python/init/src/queries/__init__.py.jinja +++ b/microservice/language/python/init/src/queries/__init__.py.jinja @@ -1,3 +1,7 @@ from .services import ( {{ aggregate }}QueryService, ) + +from .repository import ( + {{ aggregate }}QueryServiceRepository, +) \ No newline at end of file diff --git a/microservice/language/python/init/src/queries/repository.py.jinja b/microservice/language/python/init/src/queries/repository.py.jinja index b757691..5149ac6 100644 --- a/microservice/language/python/init/src/queries/repository.py.jinja +++ b/microservice/language/python/init/src/queries/repository.py.jinja @@ -1,16 +1,22 @@ from minos.common import MinosSetup, MinosConfig from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker from src.queries.models import Base class {{ aggregate }}QueryServiceRepository(MinosSetup): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.engine = create_engine({{ THE URL DATABASE }}) + self.engine = create_engine("postgresql+psycopg2://postgres:@localhost:5432/{{ name }}_db".format(**kwargs)) + self.session = sessionmaker(bind=self.engine) async def _setup(self) -> None: Base.metadata.create_all(self.engine) @classmethod def _from_config(cls, *args, config: MinosConfig, **kwargs) -> {{ aggregate }}QueryRepository: - return cls(*args, **(config.query_repository._asdict()) | kwargs) \ No newline at end of file + return cls(*args, **(config.query_repository._asdict()) | kwargs) + + @property + def session(self): + return self.session \ No newline at end of file From 08f36c0451dff0e61a964e6feb29d484bb41269a Mon Sep 17 00:00:00 2001 From: albamig Date: Wed, 9 Feb 2022 16:35:42 +0100 Subject: [PATCH 04/17] - Changed repository db name. issue #24 --- microservice/language/python/init/config.yml.jinja | 2 +- .../language/python/init/src/queries/repository.py.jinja | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/microservice/language/python/init/config.yml.jinja b/microservice/language/python/init/config.yml.jinja index fce4ad7..64b397b 100644 --- a/microservice/language/python/init/config.yml.jinja +++ b/microservice/language/python/init/config.yml.jinja @@ -45,7 +45,7 @@ repository: host: localhost port: 5432 query_repository: - database: {{ name }}_db + database: {{ name }}_query_db user: postgres password: "" host: localhost diff --git a/microservice/language/python/init/src/queries/repository.py.jinja b/microservice/language/python/init/src/queries/repository.py.jinja index 5149ac6..fd22f4e 100644 --- a/microservice/language/python/init/src/queries/repository.py.jinja +++ b/microservice/language/python/init/src/queries/repository.py.jinja @@ -7,7 +7,7 @@ class {{ aggregate }}QueryServiceRepository(MinosSetup): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.engine = create_engine("postgresql+psycopg2://postgres:@localhost:5432/{{ name }}_db".format(**kwargs)) + self.engine = create_engine("postgresql+psycopg2://postgres:@localhost:5432/{{ name }}_query_db".format(**kwargs)) self.session = sessionmaker(bind=self.engine) async def _setup(self) -> None: From 037e0a6917b053363831a15fe6a2d8db2d074639 Mon Sep 17 00:00:00 2001 From: albamig Date: Wed, 9 Feb 2022 17:23:44 +0100 Subject: [PATCH 05/17] - Added sqlalchemy dependency. - Deleted blank line. issue #24 --- .../language/python/init/src/queries/repository.py.jinja | 1 - .../language/python/package-manager/poetry/pyproject.toml.jinja | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/microservice/language/python/init/src/queries/repository.py.jinja b/microservice/language/python/init/src/queries/repository.py.jinja index fd22f4e..8ba8e04 100644 --- a/microservice/language/python/init/src/queries/repository.py.jinja +++ b/microservice/language/python/init/src/queries/repository.py.jinja @@ -4,7 +4,6 @@ from sqlalchemy.orm import sessionmaker from src.queries.models import Base class {{ aggregate }}QueryServiceRepository(MinosSetup): - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.engine = create_engine("postgresql+psycopg2://postgres:@localhost:5432/{{ name }}_query_db".format(**kwargs)) diff --git a/microservice/language/python/package-manager/poetry/pyproject.toml.jinja b/microservice/language/python/package-manager/poetry/pyproject.toml.jinja index cb7c831..09e15bb 100644 --- a/microservice/language/python/package-manager/poetry/pyproject.toml.jinja +++ b/microservice/language/python/package-manager/poetry/pyproject.toml.jinja @@ -15,6 +15,7 @@ minos-microservice-cqrs = "^0.5.0" minos-broker-kafka = "^0.5.0" minos-discovery-minos = "^0.5.0" typer = "^0.3.2" +SQLAlchemy = "^1.4.32" [tool.poetry.dev-dependencies] black = "^19.10b" From 33979690a72e2ec738b0470ed466063dfa4dec69 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 12:02:45 +0100 Subject: [PATCH 06/17] - Solved config problems issue #25 --- .../deploy/docker-compose/{deploy => }/Dockerfile | 0 microservice/language/python/init/config.yml.jinja | 12 ++++++------ 2 files changed, 6 insertions(+), 6 deletions(-) rename microservice/language/python/deploy/docker-compose/{deploy => }/Dockerfile (100%) diff --git a/microservice/language/python/deploy/docker-compose/deploy/Dockerfile b/microservice/language/python/deploy/docker-compose/Dockerfile similarity index 100% rename from microservice/language/python/deploy/docker-compose/deploy/Dockerfile rename to microservice/language/python/deploy/docker-compose/Dockerfile diff --git a/microservice/language/python/init/config.yml.jinja b/microservice/language/python/init/config.yml.jinja index af0d649..f97b77a 100644 --- a/microservice/language/python/init/config.yml.jinja +++ b/microservice/language/python/init/config.yml.jinja @@ -32,22 +32,22 @@ broker: port: 9092 queue: database: {{ name }}_db - user: postgres - password: "" + user: minos + password: min0s host: localhost port: 5432 records: 1000 retry: 2 repository: database: {{ name }}_db - user: postgres - password: "" + user: minos + password: min0s host: localhost port: 5432 snapshot: database: {{ name }}_db - user: postgres - password: "" + user: minos + password: min0s host: localhost port: 5432 saga: From f58ac19744441b70cc2619f431f935e6e0894f44 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 13:04:00 +0100 Subject: [PATCH 07/17] - Env variables added. issue #25 --- project/deploy/docker-compose/_utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/project/deploy/docker-compose/_utils.py b/project/deploy/docker-compose/_utils.py index 5fa8ae9..ba6f4b4 100644 --- a/project/deploy/docker-compose/_utils.py +++ b/project/deploy/docker-compose/_utils.py @@ -14,8 +14,14 @@ def build_docker_compose(path: Path) -> str: data = dict() data["version"] = "3.9" - data["x-microservice-environment"] = [] - data["x-microservice-depends-on"] = [] + data["x-microservice-environment"] = { + "MINOS_BROKER_QUEUE_HOST": "postgres", + "MINOS_BROKER_HOST": "kafka", + "MINOS_REPOSITORY_HOST": "postgres", + "MINOS_SNAPSHOT_HOST": "postgres", + "MINOS_DISCOVERY_HOST": "discovery" + } + data["x-microservice-depends-on"] = ["postgres", "kafka", "discovery"] data["volumes"] = {} data["services"] = {} From b1d2cf7d2fcfdc456c4db13cec5f0dcc736d3722 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 14:17:11 +0100 Subject: [PATCH 08/17] - Microservice added to docker-compose. issue #25 --- .../init/.build_docker_compose.txt.jinja | 1 + microservice/language/python/init/_utils.py | 27 +++++++++++++++++++ microservice/language/python/init/copier.yml | 3 ++- project/init/copier.yml | 10 +++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 microservice/language/python/init/.build_docker_compose.txt.jinja diff --git a/microservice/language/python/init/.build_docker_compose.txt.jinja b/microservice/language/python/init/.build_docker_compose.txt.jinja new file mode 100644 index 0000000..e357280 --- /dev/null +++ b/microservice/language/python/init/.build_docker_compose.txt.jinja @@ -0,0 +1 @@ +{{ build_docker_compose(destination.parent.parent / "docker-compose.yml", name) }} diff --git a/microservice/language/python/init/_utils.py b/microservice/language/python/init/_utils.py index 7b66f39..9ae24b4 100644 --- a/microservice/language/python/init/_utils.py +++ b/microservice/language/python/init/_utils.py @@ -22,3 +22,30 @@ def build_deploy_playbook(path: Path) -> str: data.append({"name": "Create Database", "import_playbook": "create-database.yaml"}) return yaml.dump(data, sort_keys=False) + + +def build_docker_compose(path: Path, microservice_name: str) -> str: + """Build Docker Compose file content.""" + + if not path.exists(): + raise ValueError("A base Compose file must exist.") + + with path.open() as file: + data = yaml.safe_load(file) + + microservice_container = { + "restart": "always", + "build": { + "context": f"microservices/{microservice_name}", + "target": "production" + }, + "environment": data["x-microservice-environment"], + "depends_on": data["x-microservice-depends-on"] + } + + data["services"][f"microservice-{microservice_name}"] = microservice_container + + with path.open("w") as file: + yaml.dump(data, file, sort_keys=False) + + return "" diff --git a/microservice/language/python/init/copier.yml b/microservice/language/python/init/copier.yml index 99e08d5..f3bc518 100644 --- a/microservice/language/python/init/copier.yml +++ b/microservice/language/python/init/copier.yml @@ -26,7 +26,7 @@ deploy: choices: - docker-compose - kubernetes - default: kubernetes + default: docker-compose _envops: block_start_string: "{%" @@ -45,3 +45,4 @@ _exclude: _functions: - "_utils.build_deploy_playbook" + - "_utils.build_docker_compose" diff --git a/project/init/copier.yml b/project/init/copier.yml index 5a39f62..53b7c6b 100644 --- a/project/init/copier.yml +++ b/project/init/copier.yml @@ -9,6 +9,16 @@ project_version: type: str help: What is the version of the project? default: 0.1.0 +project_deploy: + type: str + link: + docker-compose: "{{ template_registry }}/project-deploy-docker-compose.tar.gz" + kubernetes: "{{ template_registry }}/project-deploy-kubernetes.tar.gz" + help: What deploy system do you want to use? + choices: + - docker-compose + - kubernetes + default: docker-compose _envops: block_start_string: "{%" From 1f31917b5f14334c0e8ec654746d2daf77144dd7 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 15:27:59 +0100 Subject: [PATCH 09/17] - Microservice common vriables moved to microservice init. issue #25 --- microservice/language/python/init/_utils.py | 11 +++++++++++ project/deploy/docker-compose/_utils.py | 8 -------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/microservice/language/python/init/_utils.py b/microservice/language/python/init/_utils.py index 9ae24b4..41c74dd 100644 --- a/microservice/language/python/init/_utils.py +++ b/microservice/language/python/init/_utils.py @@ -33,6 +33,17 @@ def build_docker_compose(path: Path, microservice_name: str) -> str: with path.open() as file: data = yaml.safe_load(file) + if "x-microservice-environment" not in data: + data["x-microservice-environment"] = { + "MINOS_BROKER_QUEUE_HOST": "postgres", + "MINOS_BROKER_HOST": "kafka", + "MINOS_REPOSITORY_HOST": "postgres", + "MINOS_SNAPSHOT_HOST": "postgres", + "MINOS_DISCOVERY_HOST": "discovery" + } + if "x-microservice-depends-on" not in data: + data["x-microservice-depends-on"] = ["postgres", "kafka", "discovery"] + microservice_container = { "restart": "always", "build": { diff --git a/project/deploy/docker-compose/_utils.py b/project/deploy/docker-compose/_utils.py index ba6f4b4..80ccc3d 100644 --- a/project/deploy/docker-compose/_utils.py +++ b/project/deploy/docker-compose/_utils.py @@ -14,14 +14,6 @@ def build_docker_compose(path: Path) -> str: data = dict() data["version"] = "3.9" - data["x-microservice-environment"] = { - "MINOS_BROKER_QUEUE_HOST": "postgres", - "MINOS_BROKER_HOST": "kafka", - "MINOS_REPOSITORY_HOST": "postgres", - "MINOS_SNAPSHOT_HOST": "postgres", - "MINOS_DISCOVERY_HOST": "discovery" - } - data["x-microservice-depends-on"] = ["postgres", "kafka", "discovery"] data["volumes"] = {} data["services"] = {} From 55805e2066617d453d4ae2deee5e52369e98fa93 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 15:43:33 +0100 Subject: [PATCH 10/17] - Added empty poetry.lock. issue #25 --- microservice/language/python/package-manager/poetry/poetry.lock | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 microservice/language/python/package-manager/poetry/poetry.lock diff --git a/microservice/language/python/package-manager/poetry/poetry.lock b/microservice/language/python/package-manager/poetry/poetry.lock new file mode 100644 index 0000000..e69de29 From 077143db47475ab5a38b2743811dd48466aa82f6 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 16:14:49 +0100 Subject: [PATCH 11/17] - Deleted poetry.lock dependency. issue #25 --- microservice/language/python/deploy/docker-compose/Dockerfile | 2 +- microservice/language/python/package-manager/poetry/poetry.lock | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 microservice/language/python/package-manager/poetry/poetry.lock diff --git a/microservice/language/python/deploy/docker-compose/Dockerfile b/microservice/language/python/deploy/docker-compose/Dockerfile index e61dce5..9679ad7 100644 --- a/microservice/language/python/deploy/docker-compose/Dockerfile +++ b/microservice/language/python/deploy/docker-compose/Dockerfile @@ -1,6 +1,6 @@ FROM ghcr.io/clariteia/minos-microservice:0.1.8 as development -COPY ./pyproject.toml ./poetry.lock ./ +COPY ./pyproject.toml ./ RUN poetry install --no-root COPY . . CMD ["poetry", "run", "microservice", "start"] diff --git a/microservice/language/python/package-manager/poetry/poetry.lock b/microservice/language/python/package-manager/poetry/poetry.lock deleted file mode 100644 index e69de29..0000000 From ad06607deff78527b984e97ef3d829ab1e0338b7 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 10 Feb 2022 15:29:27 +0000 Subject: [PATCH 12/17] Restyled by black --- microservice/language/python/init/_utils.py | 17 +++++------------ project/deploy/docker-compose/_utils.py | 8 ++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/microservice/language/python/init/_utils.py b/microservice/language/python/init/_utils.py index 41c74dd..65dca82 100644 --- a/microservice/language/python/init/_utils.py +++ b/microservice/language/python/init/_utils.py @@ -1,10 +1,6 @@ -from __future__ import ( - annotations, -) +from __future__ import annotations -from pathlib import ( - Path, -) +from pathlib import Path import yaml @@ -39,19 +35,16 @@ def build_docker_compose(path: Path, microservice_name: str) -> str: "MINOS_BROKER_HOST": "kafka", "MINOS_REPOSITORY_HOST": "postgres", "MINOS_SNAPSHOT_HOST": "postgres", - "MINOS_DISCOVERY_HOST": "discovery" + "MINOS_DISCOVERY_HOST": "discovery", } if "x-microservice-depends-on" not in data: data["x-microservice-depends-on"] = ["postgres", "kafka", "discovery"] microservice_container = { "restart": "always", - "build": { - "context": f"microservices/{microservice_name}", - "target": "production" - }, + "build": {"context": f"microservices/{microservice_name}", "target": "production"}, "environment": data["x-microservice-environment"], - "depends_on": data["x-microservice-depends-on"] + "depends_on": data["x-microservice-depends-on"], } data["services"][f"microservice-{microservice_name}"] = microservice_container diff --git a/project/deploy/docker-compose/_utils.py b/project/deploy/docker-compose/_utils.py index 80ccc3d..cd0f81d 100644 --- a/project/deploy/docker-compose/_utils.py +++ b/project/deploy/docker-compose/_utils.py @@ -1,10 +1,6 @@ -from __future__ import ( - annotations, -) +from __future__ import annotations -from pathlib import ( - Path, -) +from pathlib import Path import yaml From 4d3d4bca2f0a59d9e13ccb8ab55ed5dc11b7d87d Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 10 Feb 2022 15:29:29 +0000 Subject: [PATCH 13/17] Restyled by isort --- microservice/language/python/init/_utils.py | 8 ++++++-- project/deploy/docker-compose/_utils.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/microservice/language/python/init/_utils.py b/microservice/language/python/init/_utils.py index 65dca82..20ba020 100644 --- a/microservice/language/python/init/_utils.py +++ b/microservice/language/python/init/_utils.py @@ -1,6 +1,10 @@ -from __future__ import annotations +from __future__ import ( + annotations, +) -from pathlib import Path +from pathlib import ( + Path, +) import yaml diff --git a/project/deploy/docker-compose/_utils.py b/project/deploy/docker-compose/_utils.py index cd0f81d..80ccc3d 100644 --- a/project/deploy/docker-compose/_utils.py +++ b/project/deploy/docker-compose/_utils.py @@ -1,6 +1,10 @@ -from __future__ import annotations +from __future__ import ( + annotations, +) -from pathlib import Path +from pathlib import ( + Path, +) import yaml From d8c2e8f2990a796877b88673d181e18b73086488 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 16:41:28 +0100 Subject: [PATCH 14/17] - Expose microservice port. issue #25 --- microservice/language/python/init/_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/microservice/language/python/init/_utils.py b/microservice/language/python/init/_utils.py index 41c74dd..b1590c1 100644 --- a/microservice/language/python/init/_utils.py +++ b/microservice/language/python/init/_utils.py @@ -50,6 +50,7 @@ def build_docker_compose(path: Path, microservice_name: str) -> str: "context": f"microservices/{microservice_name}", "target": "production" }, + "ports": ["8080:8080"], "environment": data["x-microservice-environment"], "depends_on": data["x-microservice-depends-on"] } From 422b656f5a330c50a8cbea0c1de219503610b6d5 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 17:10:31 +0100 Subject: [PATCH 15/17] - Deleted microservice exposed port. issue #25 --- microservice/language/python/init/_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/microservice/language/python/init/_utils.py b/microservice/language/python/init/_utils.py index 5885d1b..20ba020 100644 --- a/microservice/language/python/init/_utils.py +++ b/microservice/language/python/init/_utils.py @@ -47,7 +47,6 @@ def build_docker_compose(path: Path, microservice_name: str) -> str: microservice_container = { "restart": "always", "build": {"context": f"microservices/{microservice_name}", "target": "production"}, - "ports": ["8080:8080"], "environment": data["x-microservice-environment"], "depends_on": data["x-microservice-depends-on"], } From fe855861c53eb5a946aa418d8168df5d0c594201 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 17:15:52 +0100 Subject: [PATCH 16/17] - Exposed api-gateway port. issue #25 --- project/apigateway/minos/deploy/docker-compose/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/apigateway/minos/deploy/docker-compose/_utils.py b/project/apigateway/minos/deploy/docker-compose/_utils.py index 6109b19..45e2047 100644 --- a/project/apigateway/minos/deploy/docker-compose/_utils.py +++ b/project/apigateway/minos/deploy/docker-compose/_utils.py @@ -21,7 +21,7 @@ def build_docker_compose(path: Path) -> str: container = { "restart": "always", "build": "external/apigateway", - "ports": ["5566"], + "ports": ["5566:5566"], "depends_on": ["discovery"], "environment": { "PYTHONPATH": "/api_gateway", From 31d53c899fa72aec0ad12e15982c9b7201133eb9 Mon Sep 17 00:00:00 2001 From: albamig Date: Thu, 10 Feb 2022 18:11:50 +0100 Subject: [PATCH 17/17] - Fixed lint. issue #24 --- microservice/language/python/init/src/queries/models.py.jinja | 2 +- .../language/python/init/src/queries/repository.py.jinja | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/microservice/language/python/init/src/queries/models.py.jinja b/microservice/language/python/init/src/queries/models.py.jinja index 95ebc0c..59be703 100644 --- a/microservice/language/python/init/src/queries/models.py.jinja +++ b/microservice/language/python/init/src/queries/models.py.jinja @@ -1,3 +1,3 @@ from sqlalchemy.orm import declarative_base -Base = declarative_base() \ No newline at end of file +Base = declarative_base() diff --git a/microservice/language/python/init/src/queries/repository.py.jinja b/microservice/language/python/init/src/queries/repository.py.jinja index 8ba8e04..97165db 100644 --- a/microservice/language/python/init/src/queries/repository.py.jinja +++ b/microservice/language/python/init/src/queries/repository.py.jinja @@ -3,6 +3,7 @@ from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from src.queries.models import Base + class {{ aggregate }}QueryServiceRepository(MinosSetup): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)