A work in progress demonstrating
- k8s deployments to digital ocean using helm charts
- microservices using dotnet
- CI-CD using github actions
- monorepo
- to build a demo software as a service application
-
- 2.1. Sales Gateway
- 2.2. Management Gateway
-
- 3.1. Users Microservice
- 3.2. Stores Microservice
- 3.3. Catalog Microservice
- 3.4. Carts Microservice
- 3.5. Search Microservice
- 3.6. Orders Microservice
The top level domain is ecommerce-store-builder.dev
Example stores
Custom domain names for example stores
The top level domain is ecommerce-store-builder.com
Example stores
Custom domain names for example stores
client -> ingress -> frontend -> backend -> service
Use Cases
- Create account
- Add user to account
- Auth user
Publishes
- Account Created
- User Created
Subscribes
- None
Use Cases
- Create store
- Get store
- Get store by domain
- Set store theme
- Set store custom domain
API
- Create (userId, email, password) [Anonymous]
- Auth (email, password) [Anonymous]
Application
Domain
- User
Infrastructure
- CurrentSiteContext
- CurrentUserContext
Publishes
- UserCreated
Subscribes
API
- Create (storeId, name) [Anonymous]
- GetById (storeId) [Anonymous]
- GetByDomain (domain) [Anonymous]
- SetTheme (storeId, theme) [Owner]
- SetCustomDomain (storeId, domain) [Owner]
- List () [Admin]
Application
Domain
- Cart
- CartItem
Infrastructure
Publishes
- StoreCreated
- StoreUpdated
Subscribes
- infra
docker-compose -f docker-compose-infra.yaml up
- platform
docker-compose -f docker-compose.yaml build
docker-compose -f docker-compose.yaml -f docker-compose.override.yaml up
docker-compose -f docker-compose.yaml down
127.0.0.1 marketing.saas.io
127.0.0.1 registration.saas.io
127.0.0.1 shopping.saas.io
127.0.0.1 management.saas.io
127.0.0.1 admin.saas.io
127.0.0.1 example1.saas.io
127.0.0.1 example2.saas.io
127.0.0.1 example3.saas.io
127.0.0.1 example1.io
127.0.0.1 example2.io
127.0.0.1 example3.io
FrontEnds
- marketing 8010
- registration 8020
- shopping 8030
- management 8040
- admin 8050
Gateways
- marketing 7010
- registration 7020
- shopping 7030
- management 7040
- admin 7050
Backends
- registration 6020
- shopping 6030
Services
- catalog 5010
- carts 5020
- media 5030
- search 5040
- stores 5050
- accounts 5060
- Setup Secrets
DIGITALOCEAN_ACCESS_TOKEN
REGISTRY_ENDPOINT
in the formghcr.io/peterkneale/k8s-dotnet-microservices-monorepo-saas
REGISTRY_HOST
in the formghcr.io
- Set environment variables
export GITHUB_USERNAME=peterkneale
export GITHUB_TOKEN=XXXXXXXXXXXXXX
export DIGITALOCEAN_TOKEN=XXXXXXXXXXXXXX
export REGISTRY_HOST=ghcr.io
export REGISTRY_ENDPOINT=ghcr.io/peterkneale/k8s-dotnet-microservices-monorepo-saas
export TAG=latest
echo $GITHUB_TOKEN | docker login $REGISTRY_HOST -u $GITHUB_USERNAME --password-stdin
echo $DIGITALOCEAN_TOKEN | doctl auth init --context saas
- Setup cluster in Digital Ocean
- Install add-ons
NGINX Ingress Controller
andCert-Manager
- run
k8s-install.sh
in/deploy/infra/digitalocean
Accessing a resource in the k8s cluster can be performed by using kubectl's port forwarding feature Forwarding the local port 8080 to the below services will make them available on http://localhost:8080
-
Dashboard
kubectl -n default port-forward svc/infra-dashboard-kubernetes-dashboard 8443:443 kubectl describe secret -n kube-system | grep deployment -A 12
-
A service
kubectl port-forward --namespace development svc/service-accounts-saas 8080:80
$ curl localhost:8080/health/alive Healthy