Friday, June 24, 2016

How to specify a Node version on a project basis

Hi

Today we will learn, how to manage different node version on project basis.
Suppose we have 2 different project which uses different node version. One is using node 5.0 and another is using 6.0. How we manage that.

This is kind of possible with nvm in that if we create a .nvmrc file inside a project and specify a version number, we can cd into the project directory and type nvm use. nvm will then read the contents of the .nvmrc file and use whatever version of Node we specify.

cd into project1 directory.
touch .nvmrc # creates the file
echo \5.0 >> .nvmrc # appends the version to the file

now run command

nvm use 5.0 or nvm use current

it will show

Now using node v5.0.0 (npm v3.3.6)

now cd into project2 directory.
touch .nvmrc # creates the file
echo \6.0 >> .nvmrc # appends the version to the file

now run command

nvm use 6.0 or nvm use current

it will show

Now using node v6.0.0 (npm v3.8.6)

This is how we can manage different version of node for different project.

Thanks

Friday, June 17, 2016

Server Monitoring Command for Laravel

Hi

Today we will learn server monitoring command for laravel.

Server Monitoring is a package that will periodically monitor the health of our server and website. It provides healthy/alarm status notifications for Disk Usage, an HTTP Ping function to monitor the health of external services, and a validation/expiration monitor for SSL Certificates.

This package works by setting up a config file and then having a monitor:run artisan command set on a schedule. When it runs it will alert us via email, Pushover, Slack, or logged to the filesystem.

It currently supports the following monitors:

Disk Usage Monitors
Disk usage monitors check the percentage of the storage space that is used on the given partition, and alert if the percentage exceeds the configurable alarm percentage.

HTTP Ping Monitors
HTTP Ping monitors perform a simple page request and alert if the HTTP status code is not 200. They can optionally check that a certain phrase is included in the source of the page.

SSL Certificate Monitors
SSL Certificate monitors pull the SSL certificate for the configured URL and make sure it is valid for that URL. Wildcard and multi-domain certificates are supported.

The monitor will alert if the certificate is invalid or expired, and will also alert when the expiration date is approaching. The days on which to alert prior to expiration is also configurable.

You can find out more about this package on Github.

Friday, June 10, 2016

Laravel 5.3: Rollback one migration

Hi
A new feature has been added to Laravel 5.3 that will allow us to back out a single migration:
php artisan migrate:rollback --step=1
This is great for when we migrate and it runs through a batch but we want to back out just the last one instead the whole batch.
project/folder$ php artisan migrate
Nothing to migrate.

project/folder$ php artisan migrate:rollback --step=1
Roller back : 2016_06_10_500_last_created_table
 Thanks