Skip to content

wendylau87/warungpintar2021

Repository files navigation

WarungPintar2021

https://github.com/wendylau87/warungpintar2021

Summary

this microservices for simulate orchestration saga transaction

Prequisites

  • MySQL Database
  • Postman
  • kafkacat
apt-get install kafkacat

Import Database

  1. Migrate database from folder masterscv/database/migrations/schema.sql
  2. Migrate database from folder inventoryscv/database/migrations/schema.sql
  3. Migrate database from folder transactionscv/database/migrations/schema.sql

Setup Environment for all service

  1. Open file .env at folder mastersvc
DB_DRIVER=mysql
DB_USER=${dbuser}
DB_PASSWORD=${dbpassword}
DB_HOST=${dbhostname}
DB_PORT=3306
DB_DATABASE=wp_master
  1. Change value for this parameter (for hostname,you can use your IP) :
    • ${dbuser}
    • ${dbpassword}
    • ${dbhostname}
  2. Open file .env at folder transactionsvc
DB_DRIVER=mysql
DB_USER=${dbuser}
DB_PASSWORD=${dbpassword}
DB_HOST=${dbhostname}
DB_PORT=3306
DB_DATABASE=wp_transaction
KAFKA_HOST=${kafkahostname}
KAFKA_PORT=19092
KAFKA_NETWORK=tcp
KAFKA_TOPIC=inbound
KAFKA_PARTITION=0
  1. Change value for this parameter (for hostname,you can use your IP) :
    • ${dbuser}
    • ${dbpassword}
    • ${dbhostname}
    • ${kafkahostname}
  2. Open file .env at folder inventorysvc
DB_DRIVER=mysql
DB_USER=${dbuser}
DB_PASSWORD=${dbpassword}
DB_HOST=${dbhostname}
DB_PORT=3306
DB_DATABASE=wp_inventory
KAFKA_HOST=${kafkahostname}
KAFKA_PORT=19092
KAFKA_NETWORK=tcp
KAFKA_TOPIC=inbound
KAFKA_PARTITION=0
  1. Change value for this parameter (for hostname,you can use your IP) :
    • ${dbuser}
    • ${dbpassword}
    • ${dbhostname}
    • ${kafkahostname}

How to run services

  1. ensure you have migrate all databases.
  2. ensure you have change the environment file.
  3. run command to build docker image
$ docker-compose build
  1. ensure all images have been build (mastersvc, transactionsvc, inventorysvc, zookeeper, kafka)
  2. run command to host all containers
$ docker-compose up -d
  1. ensure all service has been running
$ docker ps
  1. run this command for checking kafka is available
$ kafkacat -C -b ${kafkahostname}:19092 -t inbound -p 0

Testing the service

  1. open postman
  2. import postman file WarungPintar2021.postman_collection.json
  3. execute postman transactionsvc - Add inbound
  4. if success you can check the message at kafkacat and check the database wp_inventory table inventory the new record should be there.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published