DEV Community

Cover image for Project Plan: Blazor WebAPI server, Blazor Web client, MSSQL database - All in Docker
Aaron Prill
Aaron Prill

Posted on • Updated on

Project Plan: Blazor WebAPI server, Blazor Web client, MSSQL database - All in Docker

Introduction

This article series will detail my experience dockerizing a "mostly internal" legacy Windows application with a SQL Server backend (more on the legacy application being "dockerized" in part 2). To decouple my application, I will be leveraging microservices and tie them together with an API. Envoy will be used as a proxy to handle incoming requests to the gateway.

** Application Architecture **

The new application will be brokend down like so:

  • An ASP.net Core Blazor Server WebAPI project that will have the necessary endpoints to be the "gateway" to the back-end database.
  • I will utilize Entity Framework in this project and a "database-first" approach since this application has an existing database schema. Once I generate the initial Models I need, I may transition to a code-first/migrations model to create a new database with a cleaned-up schema (then later copy over the data from the legacy database).
  • The database is currently a SQL Server database hosted on-premise on a VM with an old Windows Server OS that Corporate It wants me to decomission - this is the main motivation for this project.
  • My goal is to host the Blazor WebAPI and SQL Server database in separate Docker containers from the "get go" (that is, during development Visual Studio will launch the WebAPI project in a docker container and attach the database into a separate docker container with a persistent volume).
  • Once I get the API methods coded and tested with Swagger, I'll move onto creating a client front-end that will also be in Blazor, but it will be a Blazor Webassembly (client) project.
  • The web client may or may not be hosted in docker during development, but once it is ready for deployment it will most likely be.

Well, for an "old dog" like me that project plan is agressive, but keep checking back to see how it goes. I'm sure we'll all learn something along the way!

Next, for more on the legacy application I'm dockerizing, check out part 2.

Helpful links

The following links are references to videos/articles I have found that I may refer back to while completing this project (keeping for my own reference).

Blazor Webapp Tutorial Playlist - Beginner to Advanced

  • Above summary copied from this video
  • Get started with front-end development in Blazor

Video: .Net Core App with SQL Server

  • App and DB running in separate containers
  • How to deploy with Docker-Compose

Video: Simple .Net Microservice with SQL Backend

  • Uses SQL Server Entity Core Framework
  • Tests Api with Postman
  • Deploys with Docker Compose

Video: ASP.Net Core API Gateway with Ocelot

  • Ties all the microservices together in short video
  • Separate series linked on creating front-end Blazor app
  • Uses Ocelot which is now dormant project
    • Envoy is the "new option" (see next video)

Video: Build an API Gateway with Envoy and use with .NET Core APIs

  • Long video but explains entire architecture in detail
  • Dives into using Envoy as the proxy for the APIs
  • Video description links to other videos relevant to the topic
  • Ingredients used:
    • VS Code
    • .Net Core SDK
    • Testing with Postman / Curl / Browser
    • OpenSSL (for Envoy HTTPS components)

Install Docker on Windows Server 2019

  • If you choose to deploy to an internal server/vm that server will need to have Docker/containter orchestration capabilities.
  • The above link discusses installing Docker on a Windows 2019 server/vm.

--

Top comments (0)