Skip to content

Microservices in .NET Core by Christian Horsdal Gammelgaard. Running on a Raspberry Pi with a 64-bit operating system in a Docker installation.

License

Notifications You must be signed in to change notification settings

GregEakin/Microservices

Repository files navigation

Microservices in .NET Core

Sample shopping cart implementation from the book Microservices in .NET Core by Christian Horsdal Gammelgaard, ISBN 9781617293375.

Running .NET 5.0 on a Raspberry Pi with a 64-bit operating system inside a Docker container.

Debug the Unit Tests

  1. Clone the repository into an IDE
  2. Build the project: debug configuration
  3. Verify 22 unit tests pass
  4. Debug the unit tests
    1. Breakpoint: ShoppingCartController.cs, line 55
    2. Debug: ShoppingCartControllerTest.cs, AddCartItemTest()

Deploy the Microservices

  1. Start with a Raspberry Pi
  2. Install a 64-bit operating system
  3. Install Docker
    1. Select arm64 in step three
  4. Install Docker-Compose
    1. Use the Alternative Install Options
    2. sudo apt install python3-pip
    3. pip3 install docker-compose
    4. export PATH="$PATH:$HOME/.local/bin"
  5. Clone the repository
    1. sudo apt install git
    2. git clone https://github.com/GregEakin/Microservices.git
  6. cd Microservices
  7. docker-compose build
  8. docker-compose up -d
  9. docker-compose ps
  10. Database PostgreSQL: host rpi, port 5432, user cartapp, pass cartpw
    1. Manually add UserIds to Shopping Cart table
  11. Review the API: Postman
    1. ProductCatalogSvc: http://rpi:8086/swagger/index.html
      1. GET http://rpi:8086/api/Products/products?id=0&id=19
    2. ShoppingCartSvc: http://rpi:8087/swagger/index.html
      1. POST http://rpi:8087/api/ShoppingCart/14/items [0,19]
      2. GET http://rpi:8087/api/ShoppingCart/14
      3. DELETE http://rpi:8087/api/ShoppingCart/14/items [0,19]
  12. docker-compose down --volumes
  13. docker-compose push

Current Shopping Cart Features

  • REST ASP.NET interface
  • Persistence storage - Database
  • Get cart contents
  • Add products to the cart
  • Empty the cart
  • Ask Product Catalog for information
  • Caching Product Catalog information
  • Generate event notifications
  • Unit Tests

Current Product Features

  • REST ASP.NET interface
  • Returns dummy information
  • Unit Tests

Additional Shopping Cart Features Needed

  • Product Copy and Pictures
  • Inventory Events
  • Customers
  • Reservations
  • Promotions
  • Save for Later
  • Suggestions
  • Send reminders

Additional Services Needed

  • Event Logging
  • Customers
  • Inventory
  • Suppliers
  • Shippers
  • Promotions
  • Accounting
  • Security
  • Performance
  • Feedback
  • Wish List
  • Collections
  • Advertising
  • Browsing History
  • Help

About

Microservices in .NET Core by Christian Horsdal Gammelgaard. Running on a Raspberry Pi with a 64-bit operating system in a Docker installation.

Topics

Resources

License

Stars

Watchers

Forks