Containerization primarily offers us the benefit of swift deployment, scaling, and patching of our applications. Moreover, an existing .NET application can be migrated to Windows containers without modifying the code most of the time. An appropriate docker base image needs to be chosen, and a Dockerfile needs to be prepared for containerizing your application. Keeping your application containerized in container registries like DockerHub, and Azure Container Registry offers portability and agility. They offer the ability to spin up new custom versions of our application easier and faster than virtual machines.
Azure Container Registry
Windows Server 2019 / Windows 10 (If you use a different operating system, use the corresponding source code and make required changes to the entire setup.)
Preparing MongoDB Docker Image
1. Clone the GitHub repo at “https://github.com/aneez004/mongo-windows.git”. Then, switch to the git folder.
2. Modify the mongodbuser.ps1 file
3. Add a database username and password of your choice, or keep the defaults. Here we add the user “grandadmin” with a password “grand” to the database admin. In the Dockerfile, we are using the mongo windows image as the base image, and we copy over the PowerShell script to create the db user.
4. Build and tag the docker image with a preferred tag name.
docker build -t <image name:tag>
1. Clone the Github repo at “https://github.com/aneez004/grandnode2.git”. Then, navigate to the “grandnode2” folder.
2. Verify the Dockerfile.
3. Build and tag the image.
docker build -t <image name:tag>
Running the E-Commerce Application Locally
1. Run the mongodb docker container.
docker run -d -p 27017:27017 –name mongodb aneez004/mongo:grandnodev1
2. Run the grandnode docker container by linking to the mongodb container.
docker run -d -p 8080:80 –link mongodb:mongo –name grandnode aneez004/grandnode:v1
Migration of Windows workloads to micro-service-based architecture is gaining acceptance as it offers increased flexibility, security, high availability, and portability for their applications. Microsoft .NET applications can now be easily containerized and deployed on existing managed Kubernetes clusters like Amazon EKS or Azure AKS by adding windows worker nodes to the existing cluster with Linux nodes.
Here is a Step By Step Procedure for AWS App Mesh Integration With EKS
CloudThatis the official AWS Advanced Consulting Partner, Microsoft Gold Partner, and Google Cloud Partner, helping people develop knowledge on the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.
Feel free to drop a comment or any queries that you have regarding AWS services, Kubernetes Engine, or consulting requirements and we will get back to you quickly. To get started, go through our Expert Advisory page and Managed Services Packagethat is CloudThat’s offerings.
1. What are the guidelines for selecting a windows base image for containerization?
a. Use ‘Windows server core’ if your application requires a complete .NET framework.
b. Use ‘Nano Server’ if building an application based on the .NET core.
c. If your application requires more dependencies and core windows libraries, use the’ Windows’ image.
2. How to achieve High Availability with MongoDB?
a. Unlike relational databases, MongoDB is built on a distributed systems architecture, enabling us to scale out the database across multiple instances – which can be one region or spread globally across multiple regions.
b. MongoDB stores the data used within the application and queries the data with a modern query language. Schema is flexible, enabling developers to integrate new functionality continuously.