Showing posts with label Cloud Computing. Show all posts
Showing posts with label Cloud Computing. Show all posts

Tuesday, October 13, 2020

Awesome true freemium serverless clouds

What is the need for serverside code execution?

Nowadays JAMstack is getting popular. We can do almost all the application features in the browser application itself. JAMstack is a buzzword to represent browser applications that don't require a server to work. The application can be served from a CDN that stores application code in the form of static files. 

But there are many scenarios where we need to have some sort of interaction with a central location to access data or receive push notifications etc.

Serverless functions / FaaS

In such scenarios, Serverless functions can help us. Serverless functions or FaaS(Functions as a Service) is a cloud model where we can just host a function code without getting worried about servers and related configuration. Mostly pay per usage than a fixed monthly bill.

Freemium serverless functions

If we work for an enterprise or commercial application, we don't mainly care about free tiers. But if we are doing our personal projects we may research for any free service.

Fortunately, there are a lot of free options to run server-side code. Major cloud providers have free tiers but the problem is that we need to give them a credit card. The problem with the credit card is that we may get charged, in case of an attack such as DDoS is targeted to our function endpoint.

True freemium services

Firebase was my default choice as a true freemium serverless function provider. But recently they changed their model. They now require a credit card to avail of the freemium tier. 

This change caused the below GitHub project

https://github.com/joymon/awesome-freemium-serverless-clouds

The above link tries to aggregate all the true freemium service providers. Currently, it has only 3.

Have a look at the list and feel free to issue pull requests if there are other awesome freemium cloud providers.

Tuesday, December 11, 2018

Encrypting the ADO.Net connection to SQL Server and verification

Why should we encrypt ADO.Net communication

We all might have heard about encrypting the web server traffic using http(s) protocol. It make sense to any beginner that it should be encrypted since the communication is going via vulnerable public internet. But ADO.Net is also providing us option to encrypt the connections to SQL Server Database. Lets why some reasons to encrypt.

Connecting from client machine to database server

Nobody might be doing direct connections from client to database using windows identity or custom identities. But it was an option people used earlier and if we ended up in legacy systems this is one thing to take care. A low hanging fruit to increase security.

Connecting from web or queue processing server to ADO.Net

This is more often scenario. The client machine to web server communication is already encrypted. Nobody can intercept it. Once the communication reaches the hosting environment, it is difficult for an outside attacker to intercept the communication between web server and database server. This is true if we are in a corporate environment with someone else taken care of the network level protection.

Still there are chance that some insider attacker can intercept.

When we are in cloud environment

Another reason to encrypt the database communication is the cloud hosting. Though the cloud vendor says they are the best in the world to secure everything and obliged to keep things secret, there is still a factor of belief. What if something goes wrong and someone intercept the communication? So it is better to encrypt than taking a chance.

If someone hacks into the environment and obtain the encryption key as well, there is nothing to be done. For example the cloud provider is in a country which is in war with our country and our application is significant enough to help them to win the war. Its Unavoidable. If there is effect, there will be some side effects. We save cost but exposed to less secure environment. 

How to encrypt the SQL Server Communication

Though encrypting the communication is to be final answer to the security, let's see how to encrypt. SQL Server supports mainly certificate based encryption. In other words the certificate as key for encryption or used for key exchange to finalize the encryption. Digging into the details of how it works is not in the scope of this post. Below are some links as those are readily available.

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/enable-encrypted-connections-to-the-database-engine

https://support.microsoft.com/en-us/help/316898/how-to-enable-ssl-encryption-for-an-instance-of-sql-server-by-using-mi

More visual help here.

When the connection gets encrypted? It is a great question. There are so many combinations of configuration and below link explains when the SQL Server encrypt, when it use self signed certificate, when it fails etc...
https://docs.microsoft.com/en-us/sql/relational-databases/native-client/features/using-encryption-without-validation?view=sql-server-2017

Problem 1 - When connecting from SQL Profiler

Client unable to establish connection ssl provider the target principal name is incorrect

https://stackoverflow.com/questions/37734311/mssql-with-ssl-the-target-principal-name-is-incorrect

We have to use the full computer name when connecting.

Other problems

There are variety of problems users reported when they enable encryption without reading all the docs. Some are related to permission of SQL Account to the certificate, some related to expired or wrong issued to certificates, some experienced because the certificate was in wrong store etc...

Verify the ADO.Net connection is encrypted

As we saw earlier, even after doing the settings there are chances of connection falling back to plain mode without encryption. This section is about how to ensure the connections are encrypted.

Using the sys.dm_exec_connections

There is a DMV called dm_exec_connections. It can be simply queries like below to check the connections and its encryption status.

SELECT session_id, connect_time,client_net_address, net_transport, auth_scheme, encrypt_option, local_tcp_port
FROM sys.dm_exec_connections
WHERE net_transport = 'TCP'

Play with the above code to explore more properties of  SQL server connections. If we need to check whether the connection is encrypted from .Net code, we have to use the @@SPID to get the connection detail in the same DMV.

What is the certificate used for encryption? - Registry

After we enable the encryption via user interface, we can go to registry and ensure the certificate. Below is the location in registry.

HKLM:\Software\Microsoft\Microsoft SQL Server\<SQL InstanceID>\MSSQLServer\SuperSocketNetLib

As instructed in the guidelines, the encryption is enabled per SQL Instance. So one machine can have 2 SQL Instances. One encrypted and other not.

What is the certificate used for encryption? - SQL ErrogLogs

The SQL logs is another place to ensure the certificate what is used for encryption.

References

https://blog.coeo.com/securing-connections-to-sql-server-with-tls
https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-client-protocols?view=sql-server-2017
https://docs.microsoft.com/en-us/sql/tools/configuration-manager/sql-native-client-11-0-configuration?view=sql-server-2017

https://gyorgybalassy.wordpress.com/2012/09/14/how-to-encrypt-sql-tds-connections/
https://msdn.microsoft.com/en-us/library/ee210043%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396
https://stackoverflow.com/questions/25541281/what-is-the-default-network-protocol-in-sqlconnection-class

Tuesday, November 13, 2018

Freemium - What is always free in clouds platforms

Background

There are any different pricing model in the software industry which doesn't require any money to be spend to use software. Trial, totally free, freemium, sand boxed trial account etc...They are different in their own way. Totally free and freemium are the models which really help us build something based on the offering. Freemium might not be a new word for a follower of this blog. There were posts which has freemium reference such as Serverless monitoring, online diagramming tools, tool box for open source more precisely developers who don't want to invest on tools.

Once again Freemium is a model where we can use systems in free but for advanced usage we need to pay. Event if we don't want advanced features the basic features are free for ever. Refer wiki for the Freemium

Freemium cloud features

Lets see what is there from Cloud providers in freemium tier. ie what is there always free which can help us to develop production prototypes and start own company without investing any money other than domain if we want.

Please note that, these are not the free account or free trial which we cannot depend on to put something into production.

https://cloud.google.com/free/docs/always-free-usage-limits#container_name
https://azure.microsoft.com/en-in/free/free-account-faq/
https://firebase.google.com/pricing/
https://aws.amazon.com/free/?awsf.Free%20Tier%20Types=categories%23alwaysfree
https://www.heroku.com/pricing

Since the cloud providers may add more services as freemium, only links are provided not another copy paste which needs more time to make it up to date.

Freemium doesn't necessarily guarantee that it its free for lifetime. The vendors have their rights to change the pricing.

More links

https://en.wikipedia.org/wiki/Cloud-computing_comparison
https://www.infoworld.com/article/3179785/cloud-computing/aws-vs-azure-vs-google-cloud-which-free-tier-is-best.html
https://www.redpixie.com/blog/aws-vs-azure-vs-google-cloud

Tuesday, January 26, 2016

AppVeyor a free cloud CI - First experience

Background

Though open source doesn't mean free, most of the people working in open source area wants to get things free which ever is required for their projects. Github as free source control repositoty, Google hangout for meetings etc...AppVeyor is one of the tool which should be added to this list especially its .Net project. If we google we can get lot of information about AppVeyor. This post is going to be discussed about my experience with AppVeyor. I am really late into this open source world.

When we consider starting of any software project, there are many things other than writing code. Most of those things needs minimum research before starting. Else it will take more time to setup later. As seen earlier there should be some place to host the code. We cannot have keep the code in each and every developer's machine and pass it in zip files. Github now became one stop destination for hosting code free. So at least that piece doesn't require any more research. Another thing is Continuous Integration.

Continuous Integration

The need for CI

If we have experience more than 10 years, probably we might not have heard this word in college or during the initial years inside software industry. At that time we were considering a release as something special like Kumbamela which occurs in predefined intervals. Intervals were in years and in some places months. Nobody saw even in dream that they can give something bi-weekly to customer. But things changed with the adoption of a magic word called Agile. People started to give releases in 2 weeks to customers or at least forced to do so. That automatically bring the demand for continuous integration especially in automated ways.

In the earlier days when the release is approaching one person/team will be allocated for creating builds. All he needs to do is to compile the project and create MSI. Install it. Run basic tests and give to QA for detailed testing. Some teams opted for rotational policy for this build person / team. 

Software engineers are expected to solve others problems especially repeatable and involves human power. Who solves their problems? Of course themselves. In order to save a build person/team's pain the Continuous Integration is born.

What is continuous integration

As the name says integrate the works of developers continuously instead of waiting till the release date. Integration should mean getting the code changes of all developers, compiling the same and generating binaries/installers. Nice to have features are running unit tests, deploying to test machines and running integration tests. Advanced practitioners can even push to production if all the tests are passed. Everything is expected to be automatic. Better integration should start based on a souce code check-in.

This ensure that the defects are caught early instead of waiting till the release date.

CI Platforms

We saw that it needs to happen automatically on check-in. Where all these operations can run? They need dedicated one or more machines because developers cannot just sit idle during this time by running it in their machines.

In the initial days of CI people used separate systems for doing integration. Obviously when we automate integration we need software to do the process. Some people wrote their own programs to do all these operations and clever people created products out of it idea and made money. There were open source CI systems also emerged.

Even if buy or get OSS, it required a machine to run CI. Open source people at least who are working as individuals and small teams were struggling in this area. A machine is not free. Even if we keep old system for CI, we need to invest for internet, power etc...Enterprises also suffered a little as they need to maintain the CI machines.

Advances in the cloud technology solved this problem. Cloud allowed anybody to have a machine in cloud for short span of time. The SaaS model ie Software as a Service made the things more simple. They started giving CI as a Service. In other words, anybody can out soure the CI activities to cloud based systems without worrying about setting up a machine in cloud. All we had to do is to connect our source code with CI as a Service system. They have machines in cloud in which they download our source compile it, package it, run unit tests and even deploy it to production.

What is there for open source. There started some hosted CI providers who give free CI to open source projects along with their paid service. Wow...Anybody can do CI free in cloud. There are many major players. Lists can be found in many places in internet. One of those is AppVeyor.

AppVeyor experience

I started my research when I continuously saw a "Build Passing" flag in many open source projects in Github. Most of those lead me to travis-ci. When I started looking for a CI for my open source projects, I had no confusion to go to travis-ci. But when I read their .Net support, I got little confused. They have Linux servers only which points to mono. My first project which needs CI is not just an app. Its visual studio extension which directly depend on VS SDK. I started research again for CI which has native .Net support. The below links gave me confidence to try with AppVeyor.

Nuget restore

When I started AppVeyor, first stop was on nuget restoration. I know there is nuget restore command. But I was not sure where to enter the command. First google lead me to AppVeyor page where they explains how to deal with nuget packages

It didn't help me in first shot. It was telling that solution was not found

sln not finding

The exact error goes as below

MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
This folder contains no solution files, nor packages.config files.
Command exited with code 1

Nowhere it tells its due to nuget except 'nor packages.config'. Googled and immediately found the below link which explains if the solution is in inner folder in github src, we need to explicitly mention the .sln file path in nuget restore command as parameter.
http://help.appveyor.com/discussions/problems/1446-yml-file-isnt-finding-my-solution-file

VS Extension issue due to AWS

AppVeyor's console output for build is really awesome. It shows real time status about build. It showed below error message.

Setting up Visual Studio for debugging extensions. This one-time operation may take a minute or more.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe /RootSuffix Exp /ResetSettings General.vssettings /Embedding /Command File.Exit
log4net : error XmlHierarchyConfigurator: Could not create Appender [RollingFileAppender] of type [log4net.Appender.RollingFileAppender]. Reported error follows. [C:\projects\joyful-visualstudio\src\VS2013\JoyfulTools\VSExtension\VSExtension.csproj]
System.IO.FileNotFoundException: Could not load file or assembly 'AWSToolkit.Util' or one of its dependencies. The system cannot find the file specified.
File name: 'AWSToolkit.Util'
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Util.TypeConverters.TypeConverter.ConvertFrom(Object source)
at log4net.Util.OptionConverter.ConvertStringTo(Type target, String txt)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ConvertStringTo(Type type, String value)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.SetParameter(XmlElement element, Object target)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.CreateObjectFromXml(XmlElement element, Type defaultTargetType, Type typeConstraint)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.SetParameter(XmlElement element, Object target)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.CreateObjectFromXml(XmlElement element, Type defaultTargetType, Type typeConstraint)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.SetParameter(XmlElement element, Object target)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)

I am not at all using AWSToolkit or log4net. This is the time the impression about AppVeyor went down. My initial google didn't give me proper answers so I created a support ticket in their forum

http://help.appveyor.com/discussions/problems/3348-vsix-project-build-fail-on-starting-integration-test

The response to the question came in amazing speed which I never experienced in any other support systems. He really knows the system well he clearly told the issue is related with an extension which is in the Visual Studio installed in their CI machines. Disabling that will solve the issue. He gave PowerShell command to disable the same.

I was not much clear on where to apply this script. This issues was already faced by others as well and they tried the same workaround. So I looked there and tried the normal command to disable the AWSToolkit.
http://help.appveyor.com/discussions/questions/1275-build-failed-log4net-error-xmlhierarchyconfigurator-could-not-create-appender-rollingfileappender

Yes it rocks. Now there is integration happening for each and every check in and I can get the artifact in their site.
https://ci.appveyor.com/project/joymon/joyful-visualstudio/build/1.0.0.27/artifacts

Note : I really don't have any relation with AppVeyor except using their free service. I cannot just stop me from writing about their free service and excellent support for free customers. May be in future they change their policy. But still then they are great.

Tuesday, December 29, 2015

Published my first Google App Engine Python Application


This would have been a post if everything went easily. But it was not easy. Got one trouble. Ok let me start the story.

Introduction

Google App Engine (here after GAE) was there for long time at least from 2011 its no more preview. Unfortunately I didn't get a chance to play with it. Now since my family went to India during the winter season, I have enough time to play around.

I never thought it would be easy as publishing web site from Visual Studio to Azure in single click. But app engine is simple as one click publish.

First I ensured that it still has free quota. Because being in the Microsoft shop in my day job who embraces Azure a lot, there is no way I will be hosting an application into Google cloud. So its for my personal use and for personal use I never wanted to pay money. Oh except my domain and hosting space.
https://cloud.google.com/appengine/docs/quotas

First Python application targeting Google App Engine

Then I started with the below basics on Python based GAE development and how to publish a simple Python web app into GAE.
https://cloud.google.com/appengine/docs/python/
https://cloud.google.com/appengine/docs/python/tools/devserver
https://cloud.google.com/appengine/docs/python/gettingstartedpython27/introduction

Then setup the environment. I already had Python 2.7. So installed only the GAE SDK.
https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python

Its very simple. Once we install the SDK. It will provide us an option to run our web site locally. Once we are satisfied we can push to app engine ie cloud

The helloworld sample in google help is very preliminary. So googled for little higher startup sample and I got the below link.

http://www.labnol.org/internet/host-website-on-google-app-engine/18801/

In the above link I was able to see some more better sample which deal with html files as well. I took that did some modification in html and tried to run from local app engine server. It worked fine.

Deployment

Then I tried to deploy to real GAE by clicking on the Deploy button in the GAE launcher. It opened the browser and I entered my google credentials. But unfortunately it didn't publish to my app engine. The window stayed as is with the below message

If your browser is on a different machine then exit and re-run this
application with the command-line parameter

  --noauth_local_webserver

Then I started googling and found that it happens sometimes and if we use the command based deployment it will work. I tried that and didn't succeed.

Then googled with error and language Python. Then I got another workaround to a known issue.

If the local development server is running we will not be able to deploy to GAE. I just stopped the local server and deployed. It worked.

The public url is as follows
http://joystestproject.appspot.com/


Monday, March 3, 2014

Cloud based VisualStudio Online TFS - Some recipes to work with it

I started using Microsoft's FREE cloud based Visual Studio Online TFS when my company's TFS server got crashed and the situation continued for couple of weeks. Since we were doing some research projects, we didn't feel the source is something must be kept in company TFS. Only problem we faced was the number of team members are limited in free TFS Cloud account. But since most of us were not actively participating in the development, we were able to live with 5 people tfs team.

Now the in-house TFS is up and I am in the process of moving the source to company tfs. I moved one project and then thought of deleting it from my personal cloud tfs. Since the TFS online  is new, it was little difficult to find help. Actually its not about finding help. Its about the user experience of Visual Studio online portal. If the user experience is good, the presense of help documents doesn't matter. But it seems the team has done good job in updating MSDN with the help. Since the direct google doesn't give the links, I thought of posting the same here. So below are some common tasks and how it can be done if we are using Visual Studio Online TFS.

Visual Studio Online, TFS Online, Cloud based TFS are all same. If you want can start creating your own team projects by signing into www.VisualStudio.com with your live id.

Monday, August 27, 2012

New BUZZ words in programming for a traditional .Net developer

Languages & technologies

If you are developer like me who struck in MSFT .Net technologies and didn’t update your resume for long, you might not have heard about the below new buzz words happening in the software development world. Or if you had heard these words you might not have understood why all these are there where .Net+IIS+SQL combination can do everything for me. Here is just an attempt to collect all these technologies with a small description.

Hadoop

A technology to achieve distributed computing. You can execute your long running process in different machines .This uses Map-Reduce algorithm to distribute tasks and collect the results.

Cloud Computing

Cloud refers to server environment where you don’t need to worry about the server software,infrastructure scaling etc…You will be charged only for the usage of your application.

Node.JS

A server side technology which allows you to write Javascript at server side. Node.JS is really fast and suitable for server side of mobile applications and simple web sites where there is no CPU intensive processing.

Google Go

A new programming language from Google which mainly focus on concurrency and speed of compilation.

WinRT

New programming model from Microsoft for Windows 8 and future versions. The applications called Metro style apps run in a sandboxed environment. It support C++ COM oriented programming .But now there is another layer on top of that to support .Net and its languages.

NuGet

A package management mechanism for .Net applications. You can download nuget packages via Visual Studio and add to your projects. It does the versioning of the libraries as well.

New relic

This is one place to monitor performance of all the technology stacks used in the application. It supports .Net or Java  application monitoring, SQL performance, transaction tracing etc...

Storage & Database

NOSQL

General term to denote the databases which don’t need SQL queries to access data. These are focused on fast retrieval rather than ACID.

MongoDB

This is a document database which uses NOSQL. Supports indexing, replication & load balancing.

HBase

HBase is an open source, non-relational, distributed database modeled after Google's BigTable .It is used by Facebook for messaging messaging.

CouchDB

Another NOSQL database which uses JSON to store data. CouchDB supports ReST API and mainly targeted for offline usage.

Redis

This is a key value pair stored in memory. Redis can be accessed from network as well which makes it a caching mechanism.

Hope I can add more. The reason for this post is I got inspired by the technology radar by thoughtworks and thought of adding some description to the words where you will not get the details about technologies from their image.

Tuesday, November 8, 2011

Yes.I was able to run Azure apps in emulator

“Role instances are taking longer than expected to start. Do you want to continue waiting?”

The above error message must be very familiar to the newbies of Windows Azure when they try to run Azure application in Azure emulator .When we search for this error msg, we get so many links which says the experience of resolving this error. My situation was also not exceptional .Among my team members only my machine got this disease.

When I opened the first link I could see a list of 14 check points to be corrected to get the emulator working. I went through each and every point and verified it.But no luck. There was an interesting solution that we need to opt for retry and it will work .I tried clicking on the Wait button 10-15 times without any luck. Another forum said this was an identified issue in Azure sdk 1.3 and fixed in 1.4 .But I am getting the issue even in Azure 1.5.

There were some guys who got it working by reinstalling the Azure sdk and some went to the extend of reinstalling OS. That was not my option because we are using a OS image which has some special softwares pre installed. So I tried to dig into the inner details of emulator working.

Inner details of Azure emulator

When I started digging into emulator the first thing I could see is it will create a temporary site in IIS 7.But when I looked in IIS, I was able to realize that the issue is with creating the temporary site for Azure emulator. After that I tried opening the system tray icon of emulator and checked the emulator console view by clicking on the ‘I’ button. There was nothing. Then I decided to check where are log files of Azure emulator?

It was simple the location of Azure emulator logs is

c:\users\<username>\AppData\Local\dftmp\

Now I got a bunch of error log files and started analyzing it and could see a good error (sometimes errors are better than nothing) from the \dftmp\DevFCLogs folder which said

“There is already a listener on IP endpoint 127.0.0.1:12001”

The next google took me to a strange msdn page which asked to me to free the below ports.

12000, 12001, 12002, 808, 16001, or 15100.

After freeing the ports I was able to run the application successfully in emulator .But look at the port 808 which I an using for net.tcp binding and essential for my other project.That means I need to change that port or work on only one project at a time. When I googled again I could see that there are some more people with same issue with the 808 port

Summary

If you follow the step by step instruction to install Azure sdk and got it working in the first shot, you are the lucky person in Azure world. Otherwise you are screwed especially if you are the coder. I was lucky that I am not the developer in that project and could survive some days by drawing boxes and arrows Smile

If you are in the same situation where I was go through the Azure SDK 1.5 known issues and try the workarounds. Also look are the “Getting Started with Locally Running a Windows Azure Application” page in MSDN. Then start looking at the 14 check points mentioned above.Add the unblocking of ports as 15th check point. Finally goto the logs folder and google it. I don’t think there is any need to reinstall the OS.

My initial opinion about Windows Azure is, it’s a cloud in all means. An unclear dark cloud which may cause heavy rain at any time to which we are throwing our apps and data. Another complaint is about the Azure sdk which is not mature even in its v 1.5 to at least block the direct URL access to WCF REST service by configuration where ACS protects the service. Hope I can post more about Azure later.