Develop a Virtual Assistant with IBM Watson and .NET Core on IBM Cloud Code Engine-Part 1

  1. Develop and deploy the virtual assistant web site with .NET Core and IBM Code Engine (Part 1)
  2. Develop the Virtual Assistant with IBM Watson Assistant and integrate it with the web site (Part 2)
  3. Add search capabilities to the Virtual Assistant using IBM Watson Discovery (Part 3)
  4. Develop a serverless function with .NET Core and IBM Functions to query the account balance from the virtual assistant (Part 4)
IBM Cloud Code Engine

Prerequisites

In order to complete the examples provided in this series you will need the following:

  1. An IBM Cloud account
  2. A GitHub account
  3. A Dockerhub account
  4. Docker Desktop (I use Docker Desktop for Windows)
  5. Visual Studio 2019 Community Edition

Develop and deploy the virtual assistant web site with .NET Core and IBM Code Engine

In this article (first article of the series) I will explain how to develop and deploy the virtual assistant hosting web site using Visual Studio with .NET Core. I will explain how to generate a valid docker image that can be deployed on different Kubernetes Services including IBM Kubernetes Service, IBM Code Engine and Red Hat OpenShift. This will be achieved through the following steps:

  1. Create the Web Application with Visual Studio 2019 and .NET Core
  2. Integrate the source code with GitHub
  3. Generate the docker image and publish it to Dockerhub
  4. Deploy the source code or the docker image to IBM Code Engine

Create the Web Application with Visual Studio and .NET Core

We start creating the Web Site using the ASP .NET Core Web Application template

ASP .NET Core Web Application Template
Configure Project name and Location
.NET Core Web Application Project in Visual Studio Solution Explorer

Integrate the source code with GitHub

In the final step we will deploy the web application in IBM Code Engine. IBM Code Engine supports deployment of a containerized application from a docker image or from source code directly. That is the reason why we are pushing our code to github.com.

Add solution to Git Repository
GitHub account and project information
Git repository on GitHub

Generate the Docker image for the web site application

One of the challenges when creating docker images is security configuration. There are other challenges in order to make your .NET Core image to run in the different public Cloud services out there. The following dockerfile has worked for me in IBM Kubernetes Services, Red Hat OpenShift 4.x, IBM Code Engine, Azure Kubernetes Services.

Test application with F5
Web Application running on local environment
Integrated Git functions in Visual Studio
Publish folder in github repository
  1. docker login
  2. docker build -t username/newbankvirtualassistant:latest .
  3. docker push username/newbankvirtualassistant:latest
Docker image published to dockerhub
  1. We have created the Web Application in Visual Studio with .NET Core
  2. We have created our git repository with the code on github
  3. We have created our docker image and published on dockerhub

Deploy the application on IBM Code Engine service

IBM Code Engine is a public IBM Cloud Service currently in beta which allows you to run containerized applications, batch jobs, serverless functions on a pay as you go billing mode. One great advantage of IBM Code Engine is that you are abstracted from any deployment file and kubernetes details. And as mentioned before you can deploy an application from the source code in your git repository as I will show you in the next lines.

IBM Code Engine welcome screen
IBM Code Engine deployed application and URL
.NET Core Web Application running on IBM Code Engine

Wrap up and next steps

We finished the first part of our Virtual Assistant project. We created the web site that will host the assistant using .NET Core and IBM Code Engine. In the next article we will create the basic Virtual Assistant and integrate it with the web site.

Jean Paul Tabja

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jean Paul Tabja

Jean Paul Tabja

Software Solutions Architect with focus on Cloud and AI technologies