Tuesday, 22 August 2017

Expire collection data on specified number of seconds using MongoDB - TTL (Time to live)


I was working on some interesting feature of MongoDB know as TTL (Time to live) after understanding and google about the feature. I found that it's a very easy and use full feature of MongoDB for those who don't want to keep the unnecessary data/collection/documents in there MongoDB collection/table, so more like TTL is act like a background Job which executed on specific number of second. It's working based on index's in MongoDB for deleting the record/collection.

For detail understanding please visit: official documentation.

In my case : I need this to be work after every month for every single record so I added date but it's not working and because once on any collection you create a TTL index then I will not update the TTL expiration date value. So it's a bad way to do this also I notice that the TTL field are not Date type so if you are using : expireAfterSeconds   then please try to use number which is Seconds.

db.log_events.createIndex( { "createdAt": 1 }, { expireAfterSeconds: 3600 } )
Javascript best book ever click :)

Thursday, 10 August 2017

Saturday, 19 November 2016

Nginx SSL setup for multiple ports

This blog is related to setup SSL cert over Nginx server if you have .cert & .key file then you are able to setup this SSL If you don't have any please create locally or purchase from SSL provides.

SSL give use a secure socket protection which help to keep our domain / website heathy.

Below is the simple steps .

1) Upload your .cert & .key file on your server like Amazon Ec2 / Digital Ocean using any tool or "scp" ubuntu command.

2) Install Nginx on your server.
 
  • sudo apt-get update
  • sudo apt-get install nginx

3) After successfully installation you need to create a ssl_certs Folder in /etc/nginx/
mkdir /etc/nginx/ssl_certs
please check once if the folder is already exist then don't need to create the folder again .

4) Put your .cert & .key file in /etc/nginx/ssl_certs folder

5) Edit: /etc/nginx/sites-available/default and add your domain as per my given configuration.

6) Restart you nginx server
  • sudo systemctl restart nginx # New version of Ubuntu 16.04
  • sudo service nginx restart # older version of Ubuntu 14.04




Wednesday, 14 September 2016

Piwik database using Ruby script in Rails Framework

Ruby script for connecting Piwik Database in rails


One of my client I have two different application/Framework 1.Piwik: Which is used as a Analytic framework for tracking all the activites of a web sites and you can store your analytic data in your server basic need for using piwik it's free and easy to integrate with any application and it is provide very good support if you are a paid customer but it's available free also .

So why we need to integrate that PIWIK database in Rails ! Actually we had a requirement to show Analytic dashboard of piwik for some of the Account holder so our Admin maually create the client app on Piwik and we populating that piwik token and other stuff via connecting the Piwik database .


Easy way to create dump of mongodb database Raw

Dump from MogoDB server :)



Installing node version in centos 7 ( Digital Ocean )

Below are the some command which is use-full if you Installing node version in centos 7


Showing uploaded File in Iframe using Javascript



Salesforce CRM vs. Zoho: A Comparative Analysis

Introduction: Selecting the right customer relationship management (CRM) software is crucial for businesses seeking to streamline their sal...