Skip to content

Commit

Permalink
Merge pull request #148 from Clariteia/0.0.2
Browse files Browse the repository at this point in the history
0.0.2
  • Loading branch information
Sergio García Prado authored Jul 29, 2021
2 parents d90807e + 7fddc3f commit f6b383c
Show file tree
Hide file tree
Showing 85 changed files with 4,423 additions and 1,623 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/microservice-order-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ jobs:
working-directory: ./microservices/order

env:
MINOS_EVENTS_QUEUE_HOST: postgres
MINOS_EVENTS_BROKER: kafka
MINOS_COMMANDS_QUEUE_HOST: postgres
MINOS_COMMANDS_BROKER: kafka
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres
MINOS_SAGA_QUEUE_HOST: postgres
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka

steps:
- name: Check out repository code
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/microservice-payment-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
push:
paths:
- 'microservices/payment/**'

jobs:
build:
runs-on: ubuntu-latest
container: python:3.9-buster
services:
postgres:
image: postgres
env:
POSTGRES_DB: payment_db
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

zookeeper:
image: wurstmeister/zookeeper:latest
ports:
- 2181:2181

kafka:
image: wurstmeister/kafka:latest
ports:
- 9092:9092
env:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_HOST_NAME: kafka
defaults:
run:
working-directory: ./microservices/payment

env:
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: poetry install

- name: Run tests
run: poetry run pytest
54 changes: 54 additions & 0 deletions .github/workflows/microservice-ticket-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
push:
paths:
- 'microservices/ticket/**'

jobs:
build:
runs-on: ubuntu-latest
container: python:3.9-buster
services:
postgres:
image: postgres
env:
POSTGRES_DB: ticket_db
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

zookeeper:
image: wurstmeister/zookeeper:latest
ports:
- 2181:2181

kafka:
image: wurstmeister/kafka:latest
ports:
- 9092:9092
env:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_HOST_NAME: kafka
defaults:
run:
working-directory: ./microservices/ticket

env:
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: poetry install

- name: Run tests
run: poetry run pytest
54 changes: 54 additions & 0 deletions .github/workflows/microservice-user-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
push:
paths:
- 'microservices/user/**'

jobs:
build:
runs-on: ubuntu-latest
container: python:3.9-buster
services:
postgres:
image: postgres
env:
POSTGRES_DB: user_db
POSTGRES_USER: minos
POSTGRES_PASSWORD: min0s
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

zookeeper:
image: wurstmeister/zookeeper:latest
ports:
- 2181:2181

kafka:
image: wurstmeister/kafka:latest
ports:
- 9092:9092
env:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_HOST_NAME: kafka
defaults:
run:
working-directory: ./microservices/user

env:
MINOS_REPOSITORY_HOST: postgres
MINOS_SNAPSHOT_HOST: postgres
MINOS_BROKER_QUEUE_HOST: postgres
MINOS_BROKER_HOST: kafka

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: poetry install

- name: Run tests
run: poetry run pytest
10 changes: 8 additions & 2 deletions api_gateway/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ rest:
action: default

- name: UpdateInventory
route: /products/{product_id}/inventory
route: /products/{uuid}/inventory
method: PUT
controller: minos.api_gateway.rest.DefaultController
action: default

- name: UpdateInventoryDiff
route: /products/{product_id}/inventory
route: /products/{uuid}/inventory
method: PATCH
controller: minos.api_gateway.rest.DefaultController
action: default
Expand All @@ -63,6 +63,12 @@ rest:
controller: minos.api_gateway.rest.DefaultController
action: default

- name: CreateUser
route: /users
method: POST
controller: minos.api_gateway.rest.DefaultController
action: default

discovery:
host: localhost
port: 5567
Expand Down
2 changes: 2 additions & 0 deletions api_gateway/poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
37 changes: 37 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3.9"

services:
microservice-order:
build:
context: microservices/order
target: development
volumes:
- ./microservices/order:/microservice

microservice-payment:
build:
context: microservices/payment
target: development
volumes:
- ./microservices/payment:/microservice

microservice-product:
build:
context: microservices/product
target: development
volumes:
- ./microservices/product:/microservice

microservice-ticket:
build:
context: microservices/ticket
target: development
volumes:
- ./microservices/ticket:/microservice

microservice-user:
build:
context: microservices/user
target: development
volumes:
- ./microservices/user:/microservice
44 changes: 32 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
version: "3.9"

x-microservice-environment: &microservice-environment
- MINOS_EVENTS_QUEUE_HOST=postgres
- MINOS_EVENTS_BROKER=kafka
- MINOS_COMMANDS_QUEUE_HOST=postgres
- MINOS_COMMANDS_BROKER=kafka
- MINOS_BROKER_QUEUE_HOST=postgres
- MINOS_BROKER_HOST=kafka
- MINOS_EVENTS_QUEUE_HOST=postgres # TODO: Remove
- MINOS_EVENTS_BROKER=kafka # TODO: Remove
- MINOS_COMMANDS_QUEUE_HOST=postgres # TODO: Remove
- MINOS_COMMANDS_BROKER=kafka # TODO: Remove
- MINOS_REPOSITORY_HOST=postgres
- MINOS_SNAPSHOT_HOST=postgres
- MINOS_SAGA_QUEUE_HOST=postgres
- MINOS_SAGA_BROKER=kafka
- MINOS_SAGA_QUEUE_HOST=postgres # TODO: Remove
- MINOS_SAGA_BROKER=kafka # TODO: Remove
- MINOS_DISCOVERY_HOST=discovery

x-microservice-depends-on: &microservice-depends-on
- postgres
- kafka
- discovery
- api-gateway

services:
zookeeper:
Expand All @@ -37,10 +39,12 @@ services:
postgres:
restart: always
build: external/postgres
ports:
- 5432:5432
volumes:
- postgres_volume:/var/lib/postgresql
environment:
- POSTGRES_MULTIPLE_DATABASES=order_db,payment_db,product_db,ticket_db
- POSTGRES_MULTIPLE_DATABASES=order_db,payment_db,product_db,ticket_db,user_db
- POSTGRES_USER=minos
- POSTGRES_PASSWORD=min0s
logging:
Expand Down Expand Up @@ -80,25 +84,41 @@ services:

microservice-order:
restart: always
build: microservices/order
build:
context: microservices/order
target: production
environment: *microservice-environment
depends_on: *microservice-depends-on

microservice-payment:
restart: always
build: microservices/payment
build:
context: microservices/payment
target: production
environment: *microservice-environment
depends_on: *microservice-depends-on

microservice-product:
restart: always
build: microservices/product
build:
context: microservices/product
target: production
environment: *microservice-environment
depends_on: *microservice-depends-on

microservice-ticket:
restart: always
build: microservices/ticket
build:
context: microservices/ticket
target: production
environment: *microservice-environment
depends_on: *microservice-depends-on

microservice-user:
restart: always
build:
context: microservices/user
target: production
environment: *microservice-environment
depends_on: *microservice-depends-on

Expand Down
2 changes: 1 addition & 1 deletion external/discovery/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python

RUN apt install git
RUN pip install git+git://github.com/Clariteia/discovery.git@4e8b7b4170d9f41028421b3e810242cefd42c91a
RUN pip install minos-discovery==0.0.3

COPY config.yml ./config.yml
CMD ["discovery", "start", "config.yml"]
6 changes: 3 additions & 3 deletions external/tavern/tests/test_order_create.tavern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ stages:
url: http://api-gateway:5566/orders
method: POST
json:
products: [1, 2, 3,4]
product_uuids: [1, 2, 3,4]

response:
status_code: 200
json:
- !anystr
!anystr
save:
json:
uuid: "[0]"
saga_uuid: "@"
Loading

0 comments on commit f6b383c

Please sign in to comment.