This repository contains a Docker Compose setup and application skeleton to practice modern cloud DOTNET application development, specifically ASPNET.
This starter is made with 3 goals in mind:
- Provide an ASPNET application skeleton with typical enterprise infrastructure already in place around it. This includes Identity Server for user authentication, logs storage setup via OpenTelemetry, various databases, queue and file storage.
- Showcase a Docker Compose setup that allows you to run a mini-Cloud on your personal machine. With a single
compose.yaml
file you can selectively spin-up everything you need. - Showcase devcontainers.
This starter is made for DOTNET students practicing ASPNET and cloud development, for enterprise developers looking needing a complete Docker Compose setup to try-out and for Hackathon participants needing a quick DOTNET starter with infrastructure already setup.
It's expected that you are running a machine with VSCode with Remote Development Extension, PowerShell, DOTNET 8 SDK and Docker installed (Docker Desktop is recommended). At least 16GB of RAM, 4-Core CPU and an SSD are recommended if you intend to run entire Docker Compose. Please also note, initial launch will require considerable time and web bandwidth, as it will download required Docker images. Containers use Linux-based images, for host you can use Windows 10 or 11 based machine with WSL2 installed, MacOS or Linux - all components are cross-platform. For Linux you will need to handle trusting DEV certificates on your own, and it's not trivial.
- VSCode recommended extension lists, task and launch files
app-console
application configured to use all databases in infrastructureapp-aspnet
application configured to use all services in infrastructurecertificate
script to setup dev-certificate trusted byhost
and usable by infrastructure containers
Infrastructure:
service name in compose.yaml | service type | description |
---|---|---|
azurite-storage |
Docker Image | Azurite storage emulator based on Azure Storage, provides Blobs, Queue Storage, and Table Storage |
duende-identity-server |
ASPNET app with Dockerfile | Duende Identity Server: OAuth and OIDC server |
mongo-document-db |
Docker Image | Mongo document database |
ms-sql-db |
Docker Image | Microsoft SQL Server 2022 |
seq-open-telemetry-logs |
Docker Image | Seq: logs storage and search service |
Once you've cloned the repository, generate a dev-certificate trusted by your machine and available to Containers:
./certificate/generate.ps1
Launch infrastructure services:
docker compose down; docker compose --profile infrastructure up -d --build
Then run console-app to make sure DBs are available:
cd app-console;
dotnet run;
Or run ASPNET application
cd app-aspnet;
dotnet run;
Open page https://localhost:5002/
and login with username: alice
, password: alice
or username: bob
, password: bob
. You may need to instruct browser to trust dev-certificate. You should see a page with information about currently logged-in user and DB connections statuses.
Navigate to http://localhost:5340/
to see your application logs. Login is admin
, password is in file ./infrastructure/seq-open-telemetry-logs/password-hash-write.ps1. This file also shows how to use Docker to distribute and run scripts, it essentialy uses image as an isolated executable with 0 dependencies on hosting OS.
Examine ./app-console/Program.cs or ./app-aspnet/Pages/Index.cshtml.cs to see how dependencies are used.
If you want to develop app-aspnet
in container - run
docker compose down; docker compose --profile infrastructure --profile app-aspnet up -d --build
SSH into container or use VSCode extension to connect VSCode to it and in /source/app
(default workdir in Dockerfile) run dotnet run
. Navigate to https://localhost:5002/
You will have to instruct your browser to trust certificate of Identity Server. This method also works with app-console
profile.
Check compose.yaml
ports
section for each service to see, which ports are exposed. volumes
section will have instructions how to save data in host
. Remember, you can examine the contents of any volume
in Docker and check data files there.
This repository contains a configured .devcontainer
, in VSCode you can use command "Dev Containers: Open Folder in Container". Devcontainer includes a selection of extension to access included databases from VSCode and otherwise facilitate development.