Skip to content

Commit 8442b6b

Browse files
committed
added crypto microservice
1 parent 24997c0 commit 8442b6b

33 files changed

+2529
-41
lines changed

tutorials/stock-wallet/docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,12 @@ services:
8282
target: production
8383
environment: *id001
8484
depends_on: *id002
85+
microservice-crypto:
86+
restart: always
87+
build:
88+
context: microservices/crypto
89+
target: production
90+
environment: *id001
91+
depends_on: *id002
8592
x-microservice-environment: *id001
8693
x-microservice-depends-on: *id002

tutorials/stock-wallet/external/postgres/10-create-database.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ CREATE DATABASE wallet_db;
55
CREATE DATABASE wallet_query_db;
66

77
CREATE DATABASE stocks_db;
8-
CREATE DATABASE stocks_query_db;
8+
CREATE DATABASE stocks_query_db;
9+
CREATE DATABASE crypto_db;
10+
CREATE DATABASE crypto_query_db;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.venv
2+
*.lmdb
3+
dist/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
aggregate: Crypto
2+
apigateway: minos
3+
apigateway_deploy: self-hosted
4+
author: Clariteia Devs
5+
broker: kafka
6+
broker_deploy: self-hosted
7+
database: postgres
8+
deploy: docker-compose
9+
description: Crypto crawler
10+
discovery: minos
11+
discovery_database: redis
12+
discovery_deploy: self-hosted
13+
14+
language: python
15+
name: crypto
16+
package_manager: poetry
17+
postgres_deploy: self-hosted
18+
project_deploy: docker-compose
19+
project_description: A Microservice example for stock options
20+
project_name: stock-wallet
21+
project_version: 0.1.0
22+
redis_deploy: self-hosted
23+
template_name: project-init
24+
template_registry: https://github.com/minos-framework/minos-templates/releases/download/v0.1.3
25+
template_version: v0.1.3
26+
version: 0.1.0

tutorials/stock-wallet/microservices/crypto/.minos-microservice.yaml

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ghcr.io/clariteia/minos-microservice:0.1.8 as development
2+
3+
COPY ./pyproject.toml ./
4+
RUN poetry install --no-root
5+
COPY . .
6+
CMD ["poetry", "run", "microservice", "start"]
7+
8+
FROM development as build
9+
RUN poetry export --without-hashes > req.txt && pip wheel -r req.txt --wheel-dir ./dist
10+
RUN poetry build --format wheel
11+
12+
FROM python:3.9-slim as production
13+
COPY --from=build /microservice/dist/ ./dist
14+
RUN pip install --no-deps ./dist/*
15+
COPY config.yml ./config.yml
16+
ENTRYPOINT ["microservice"]
17+
CMD ["start"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# crypto Microservice
2+
3+
## Description
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
service:
2+
name: crypto
3+
aggregate: src.aggregates.Crypto
4+
injections:
5+
lock_pool: minos.common.PostgreSqlLockPool
6+
postgresql_pool: minos.common.PostgreSqlPool
7+
broker_publisher: minos.plugins.kafka.InMemoryQueuedKafkaBrokerPublisher
8+
broker_subscriber_builder: minos.plugins.kafka.InMemoryQueuedKafkaBrokerSubscriberBuilder
9+
broker_pool: minos.networks.BrokerClientPool
10+
transaction_repository: minos.aggregate.PostgreSqlTransactionRepository
11+
event_repository: minos.aggregate.PostgreSqlEventRepository
12+
snapshot_repository: minos.aggregate.PostgreSqlSnapshotRepository
13+
crypto_repository: src.CryptoQueryServiceRepository
14+
saga_manager: minos.saga.SagaManager
15+
discovery: minos.networks.DiscoveryConnector
16+
services:
17+
- minos.networks.BrokerHandlerService
18+
- minos.networks.RestService
19+
- minos.networks.PeriodicTaskSchedulerService
20+
middleware:
21+
- minos.saga.transactional_command
22+
services:
23+
- minos.aggregate.TransactionService
24+
- minos.aggregate.SnapshotService
25+
- minos.saga.SagaService
26+
- src.queries.CryptoQueryService
27+
- src.commands.CryptoCommandService
28+
rest:
29+
host: 0.0.0.0
30+
port: 8080
31+
broker:
32+
host: localhost
33+
port: 9092
34+
queue:
35+
database: crypto_db
36+
user: minos
37+
password: min0s
38+
host: localhost
39+
port: 5432
40+
records: 1000
41+
retry: 2
42+
repository:
43+
database: crypto_db
44+
user: minos
45+
password: min0s
46+
host: localhost
47+
port: 5432
48+
query_repository:
49+
database: crypto_query_db
50+
user: minos
51+
password: min0s
52+
host: localhost
53+
port: 5432
54+
snapshot:
55+
database: crypto_db
56+
user: minos
57+
password: min0s
58+
host: localhost
59+
port: 5432
60+
saga:
61+
storage:
62+
path: ./crypto.lmdb
63+
discovery:
64+
client: minos.plugins.minos_discovery.MinosDiscoveryClient
65+
host: localhost
66+
port: 5567

0 commit comments

Comments
 (0)