Skip to content

marcoschmidl/cloud-native-sample

 
 

Repository files navigation

Cloud-Native Sample Application

This repository contains a sample application that serves as a demonstration for building and automating a polyglot cloud-native application. The application is designed to showcase proven practices for developing and deploying cloud-native software using a combination of programming languages and tools:

  • Programming Languages

    • .NET (C#)
    • Go
  • Tools

    • Docker
    • Docker Compose
    • Dapr (Distributed Application Runtime)
    • Kubernetes (when running in Azure)
    • HashiCorp Terraform
    • GitHub Actions
    • Makefiles

[TBD: Some general introduction.]

Builds

AuthenticationService OrdersService ProductsService ShippingService OMC OrderMonitorService Gateway

License

MIT License

Application Diagram

Architecture Overview

Observability Stack

For the scope of this application, we've choosen the following technologies to address observability concerns:

Local execution

We decided to go with Docker Compose for local development story. As an alternative, you can also setup a local Kubernetes cluster (KIND / minikube /...).

URLs and demo credentials

When running the application in Docker Compose, you'll end up with the following ports forwarded on your host machine:

Use http://localhost:5000 to access the OMC proxied through the gateway locally.

Note: Dapr-dashboard does currently not work in Docker compose mode

Necessary plugins for local execution

We use Loki as log aggregation system. In the local environment, we leverage lokis docker plugin to ship all logs from containers output streams (STDOUT and STDERR) to Loki.

# Install Docker Plugin for Loki
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions

Local Environment Execution using the Makefile

Find the Makefile in the root of the repository. Use it to perform common tasks as shown below:

# Install loki plugin locally
make init

# Start the sample locally (in docker)
make start 

# Quickstart (no image build) the sample locally (in docker)
make quickstart

# get logs
make logs

# stop the sample
make stop

# clean-up the local docker environment
## stops everything
## removes images
## removes volumes
## removes orphan containers
## removes custom docker network
make cleanup

Local Environment Execution using the docker-compose CLI

# Build Container images
docker-compose build

# Cleanup previously started instances
docker-compose rm -f

# Start cloud-native sample application (detached)
docker-compose up -d
# Start cloud-native sample application (blocking)
docker-compose up

# To stream logs to the terminal use
docker-compose logs

Cleanup environment

# remove running containers
docker-compose rm -f

# remove custom Docker network
docker network rm cloud-native -f

# uninstall Loki Plugin
docker plugin rm loki -f

Local Environment Execution using the cn-sample CLI

You can also automate the local environment execution using the cn-sample CLI (see /tools/<your_platform>).

Consider adding cn-sample to your path before invoking it.

The sn-sample CLI is designed to be invoked from the root directory of this repository.

Azure environment

For demonstration purposes, we added all necessary Infrastructure-as-Code (IaC) (using HashiCorp Terraform) and corresponding GitHub Actions to deploy and run the application in Microsoft Azure leveraging Azure Kubernetes Service (AKS).

When running in the cloud, one must always decide on Run vs. Rent. For example: Instead of running a message broker like RabbitMQ on your own (yes, running something in a container means you run it on your own, because you've to maintain and troubleshoot it), and renting a message broker like Azure Service Bus.

Again, you can find corresponding GitHub Actions in the repository to switch between Run and Rent in Azure. Those GitHub Actions must be triggered manually.

About

Sample application to demonstrate how to build, orchestrate, and automate a polyglot cloud-native application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 48.4%
  • Less 11.3%
  • HTML 11.3%
  • CSS 10.8%
  • HCL 5.9%
  • Go 5.5%
  • Other 6.8%