Showing posts with label Service. Show all posts
Showing posts with label Service. Show all posts

Tuesday, 25 December 2018

MongoDB Atlas - Off Premise Way (DBaaS)


MongoDb also provide cloud services (Database as a Service - DaaS), called MongoDB Atlas, to host your mongo database on cloud. Let's see how we can setup an cloud account and access the MDB from local machine.

Cluster Step :
1. Create an account on https://cloud.mongodb.com
2. Once you are in, the very first thing which it asked to choose your cluster configuration.
2a. It gives you to choose one of cloud service which are - AWS, Google, Azure, Choose whatever you like
2b. But always choose "FREE TIER CLUSTER" (M0 Instance) else there will be usage charge.
3. Once you have selected appropriate config, it will start building your mongoDB Cluster, it will take few mins to complete the setup.
4. When done, it will be like this, usually use Cluster0 as name, you can modify it though -




How to access from local system :

You need to install Mongo Shell to access cloud db which comes with Mongo DB pkg. You can download and install on your OS (Windows/Linux) from here - https://www.mongodb.com/download-center/enterprise

1. Login on https://cloud.mongodb.com and click on Clusters in left hand side list.
2. Click on Connect and follow below steps -
3a. Whitelist your id so that you can connect with your system or any ip address. Click on "Add a different IP Address" and to allow to connect from any system, Use 0.0.0.0 as IP address
3b. Create your cluster credential


4. Once done, you will see the below screen
5a. Now, Click on Choose connection method and click on "Connect with Mongo Shell" -


5b. Now, click on standard connection string


6. Copy the string and replace the <PASSWORD> with the password which you created in Cluster Setup Step #4.
7. Now, As I have installed the MongoDB Shell in Step #1, we need to add MongoDB Bin directory path into system path. You can add this path into windows env variable or Linux user profile so that you can access mongo command from any location.
8. Once path has been added, open cmd or terminal and paste the connection string which you copied and modified in step #5


9. When connected successfully, you can try to run commands as below -


10. For more commands, you can visit this link - https://www.datagenx.net/2018/12/learn-mongo-db-basics.html

11. Mongo Atlas Cloud Step has been completed and verified successfully. You can connect with the same connection string from any system (if firewall allows and have mongo shell installed)

Let me know in comments if you face any issue while doing Atlas setup.
Next Post on this Series and more on MongoDB can be find here -> LINK




Like the below page to get the update  
Facebook Page      Facebook Group      Twitter Feed      Google+ Feed      Telegram Group     


Sunday, 11 November 2018

WebServices Health Check Report in Python


Continuing Converting PFX Certs to Certificate and Key Files using OpenSSL....., As discussing about a requirement to generate a health check report for web-services without much of human intervention. Though there are lots of open source and proprietary tools available which can do this stuff in few clicks but I have tried to write something in python which is capable of doing pretty much same and provide more customization.




WebService_HealthCheck.py:

 
WebService_HealthCheck_QA.config


Config file contains the columns as below -


ID|ServiceName|URL|Request


This python code contains 3 functions, 1 GET REST CALL, 1 POST REST CALL, and 1 FILE WRITE operation, we can add more functions which can parse the response and take action as defined.
While writing this code, I have assumed that every service all is HTTPS type which need a certificate to make a success call to service host server. Though, you can omit this setting if your service is simple HTTP type.

As I said, this baseline code is just a skeleton for your service health check. add more and more functions to automate your boring stuff :-)





Like the below page to get update  
Facebook Page      Facebook Group      Twitter Feed      Google+ Feed      Telegram Group     


Tuesday, 27 March 2018

ML-DL model as a Service - MLaaS



It is not always the case when we have to give or share the ML/DL model or algorithm with Client, sometime we want to allow users to use our model but without sharing the code or without setting up the infrastructure at Client end.

There is a way to achieve this, Convert your model as a Service, Yes, You can do that. You can expose your model as a Rest Service and user can use the method supported by your Service program. Today, we are going to learn the same.
Let's see how -



Tools Required - 
Flask - A python web server
and of course Python :-)


ML/DL Model Creation: 
For this part, I am picking very basic ML problem - IRIS dataset Classification.
Below code will create a Logistic Regression Classification Model and Save the model as a file.
==

Flask Web Server - REST Service
In below code, we are creating a REST service hosted on local system and having endpoint as "\iris" and Posting the array input to predict the IRIS species
==

How to run Flask Server:
    


Call ML Service:  From Command Line:


Call ML Service:  From Postman Client:









Like the below page to get update  
Facebook Page      Facebook Group      Twitter Feed      Google+ Feed      Telegram Group