.NET Core & SQL Server Preview on Linux Containers

net-core-sql-server-preview-on-linux-containers

Using SQL Server preview bits with Visual Studio or Eclipse:

 

Microsoft .Net on Linux:  Last year Microsoft has brought some of the core features of its .NET platform — which has traditionally been Windows-only — to Linux and Mac. The company has announced its full  .NET Core runtime for Linux and Mac OS. Now company is planning to bring SQL Server support on Linux which is still under private preview and expected to launch sometime next year. The release of .NET Core for platforms other than Windows is to fulfill the aims to meet developers where they are — instead of necessarily making them use Windows. The.NET Core and SQL Server are clearly part of this move. Microsoft want to use .NET and SQL on cross-platform in order to build and leverage a bigger ecosystem for it.

MS Announcement SQL on Linux: We all are aware of the recent announcement on SQL Server 2016 in march 2016. SQL Server on Linux; gives you the power to build and deploy intelligent applications on a single data management and business analytics platform. This makes it easier for you to work with data of any type, size, and speed using the tools, languages, and frameworks you want to use in a trusted cloud, hybrid, or on-premises environment. It’s another step to make SQL Server simpler and more accessible.

Background on SQL on Linux: SQL team has done so far is create an abstraction layer between the database and operating system, the challenge will be to ensure all the pieces work seamlessly and smoothly. Currently we need to configure the SQL for every build from registry and verify, test as needed to ensure SQL Server for Linux is running smoothly and working as expected: it’s an immensely complicated piece of code and when you’re dealing with databases, the slightest error can have catastrophic consequences.

Challenge for Developers and IT community: As a Visual Studio or Eclipse developer the goal is to integrate every single build to explore it works correctly. Click2Cloud Inc. a Bellevue based company specialize in cloud acceleration and developer platform has extended a simple way for SQL images on Linux platform, the platform allows to build and configure applications on choice of your PAAS e.g. Azure / Redhat OpenShift or cloud of choice.  The plugin is the way to ensure that solution is validated and works as expected. The plugin has ability to work directly from private/public registry for the desired images to be pulled repeatedly. It also allows developers to define environment variable and abstract the complexity involved in the end to end process. The plug-in has feature to create new .net/python or Node.JS application with SQL or other backend server.

Options for Developers /IT team: Click2Cloud offers two plugins for Developer to IT teams.

How do I use Visual studio to verify SQL on Linux PaaS?

As a private preview member we are excited in getting the latest build of SQL/try out new feature and validate it. To make the process easier Bellevue based Click2Cloud Inc. has built a powerful tool that works with Docker (private) registry and allows the end user to configure SQL Server on Linux. The same plugin has various templates that allows end user to combine ASP.Net, Node.JS, Python application with backend as SQL Server and deployed on the choice of cloud.  In the recent RedHat Summit we worked with Microsoft SQL team to make it simple to use SQL server deployed on Linux based environment. Its explained in the article below. In this blog we will walk you through the solution; Using SQL 2016 private preview image from Docker registry. The step by step instructions below will cover, how you can get the image and build an application using the Microsoft Visual Studio.  In this series of blogs, the next blog will cover; Step by step approach for build and deploy application using .net/ Node.Js /Python applications on Visual Studio with SQL/ Mongo/ No SQL or any other backend server on Linux Containers.  Final one will cover Template based solutions for Linux Container to create working applications in few clicks; it will also cover integration with GIT/TFS as source repository and devops platform as application lifecycle platform.

 

Step 1:  Install the VS Docker Plugin / Click2Cloud Docker Extension for Visual studio : https://visualstudiogallery.msdn.microsoft.com/e8591432-b2fe-457c-acb4-a4c2dc0ac863  please ensure that you have pre requisite as described in documentation. In case you face any challenge. email contact@click2cloud.net, Click2Cloud will be able to help you with configuration of IDE plugin for Docker and Cloud Acceleration Plugin. The user should have access to the Docker server and pre requisites are installed. For the user who want to try building an application on Linux based cloud, there is another plugin that can be used for validating SQL running on Openshift Cloud.

 

Step 2: Configuring private registry for SQL image pull : Use the Docker pull feature on your plug-in to pull the MS-SQL Server image with your private registry credentials. The credentials for accessing the private registry need to configure on the screen below.

step-2-1-configuring-private-registry-for-sql-image-pull

On this provide the access information that you have received for accessing your private registry:

step-2-2-configuring-private-registry-for-sql-image-pull

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 3: Use the Docker pull

The Pull Image wizard can be launched from the Docker Explorer Window. You can provide the specific tag in the MS-SQL Server image name and if none is specified, the MS-SQL Server image tagged latest will be pulled.

The pull feature also has ability to search desired image to visual studio:

step-3-1-use-the-docker-pull

 

Step 4 – Run a MS-SQL Server Docker Image

The new “Run a Docker Image” wizard lets you run an MS-SQL Server image by passing the most relevant arguments in the context of a developer machine:

  • the name of the container (although this is optional)
  • the exposed ports (the table is prepopulated with port numbers retrieved from the selected Image information)
  • the links to containers
  • the data volume
  • the environment variables
    (ACCEPT_YULA =Y, SA_PASSWORD= ****** environment variables must be given)

 

When you click Finish, the container will start and show output in an Output Window and the Docker Explorer window will show which ports are used.

step-4-1-run-a-ms-sql-server-docker-image

 

 

Step 5 – MS-SQL Server Container Log Streaming

The display logs Context Menu, allows you to monitor MS-SQL containers logs in an Output window which helps for streaming the new output from the MS -SQL container’s STDOUT and STDERR at the time of execution.

ms-sql-server-container-log-streaming

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 6 – Open Terminal to interact with MS-SQL Server

Containers created with a pseudo TTY allocated (-t) will open within a PowerShell Terminal which provides fully featured interaction with Docker container in Terminal view

When running a MS-SQL Server container, you can execute shell commands from the Open Terminal context menu.

step-6-open-terminal-to-interact-with-ms-sql-server

 

Step 7 – MS-SQL Server Version

Connect to the MS -SQL Container from SQL Server Management Studio to check MS-SQL Server version and to perform other operations.

mssql-running-on-linux

 

Step 8 – MS-SQL Server Container Details

Here you can find the MS-SQL Server Container details from database properties context menu.

ms-sql-server-container-details

 

Step 9 – Connect to MS-SQL Server from an ASPNET Web Application running in another Docker Container

Here, you can simply pull the click2cloud/aspnet-mssql image, an image amongst many available at http://hub.docker.com. and The Run Image Wizard will help you to create a container based on a click2cloud/aspnet-mssql Image which is linked with MS-SQL Server container.

 

1. This MS-SQL Server image exposes the standard MS-SQL port (1443), so container linking makes the MS-SQL server instance available to click2cloud/aspnet-mssql

9-1-connect-to-ms-sql-server-from-an-aspnet-web-application-running-in-another-docker-container

 

 

 

 

 

 

 

 

 

 

 

2.  Use Run image wizard to start click2cloud/aspnet-mssqlapplication

9-2-connect-to-ms-sql-server-from-an-aspnet-web-application-running-in-another-docker-container

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.  Click on Add Button available on Links to other Containers

4.  Section and select MS-SQL Server Container from dropdown and provide Alias name.

5.  When you clickFinish, the click2cloud/aspnet-mssql container will start and show output in an Output Window and the Docker Explorer window will show which ports are used.

 

Step 10 – Browse Application

User can browse aspnet-mssql application running in Docker container from aspnet-mssql container -> Ports -> Show in Web Browser.  In the next blog we will cover the step by step instructions on debuging SQL code and .net application on linux container.  The blog will also contain the link for sample application. Till then Happy Coding on a hetrogeneous platform.

 

browse-application

 

 

Really! It takes 15 min to SQL Server Preview on RHEL

Click2Cloud Inc. has always aimed to facilitate developers with the ultimate flexibility and choice of programming languages, frameworks and services with use of proper toolset. In other words, we want developers to simply pick what they need and start coding. We enable .NET and Microsoft SQL Server to the list of available OpenShift platforms. The Plugin allows developers to create .NET applications using familiar OpenShift workflows. With Click2Cloud Inc., OpenShift can deliver a PaaS solution for .NET & Microsoft SQL Server; while still enabling the secure, multi-tenant architecture that users wants. The complete environment can be hosted on independently as VM/ cloud, Microsoft Azure or any desired cloud.

Step by Step Approach:

  1. Pull image from plug to local Boot to Docker
  2. Push(Deploy) image to Openshift
  3. Show it RedHat OpenShift Enterprise 3.3- (Using Web Console)
  4. Created a project in RedHat OpenShift Enterprise 3.3- (Using Web Console)
  5. Created application using MSSQL template – (Using Web Console)
  6. See Running MSSQL Container – (Using Click2cloud Visual Studio Plugin.)
  7. Sample application ASP.NET Core Application with MSSQL database
  8. Connected to MSSQL DB Container – (Using Microsoft SQL Server Management Studio)
  9. Debug the code J Yeah!

 

ASP Core and SQL image hosted on Redhat Openshift side by side

asp-core-and-sql-image-hosted-on-redhat-openshift-side-by-side

 

Running POD on Redhat Openshift (interestingly the kubernetes is able to scale the POD)

running-pod-on-redhat-openshift-interestingly-the-kubernetes-is-able-to-scale-the-pod

Persistent Volume and SQL (interestingly the kubernetes is able to scale the POD)

persistent-volume-and-sql-111

Build Running with SQL backend – SWEET 🙂

build-running-with-sql-backend

Persistent Volume and SQL

 

persistent-volume-and-sql

 

 

 

 

 

 

 

 

 

Leave a Reply