Saturday, July 21, 2012

Installing coffee-script cli


Today I will be updating my box to the latest nodejs and after doing so, installing the coffee-script command line interface which allows for coffee-script to be run on such things as crontab, init.d, or even nagios (see other post).  I will also be installing nodemon which will act as a daemon for my coffee-script web applications.  Nodemon will watch for changes and restart the application if it finds any, which is pretty neat.

$ wget http://nodejs.org/dist/v0.8.3/node-v0.8.3.tar.gz
$ tar zxvf node-v0.8.3.tar.gz

$ cd node-v0.8.3


$ ./configure

{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'host_arch': 'x64',
                 'node_install_npm': 'true',
                 'node_install_waf': 'true',
                 'node_prefix': '',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'target_arch': 'x64',
                 'v8_no_strict_aliasing': 1,
                 'v8_use_snapshot': 'true'}}
creating  ./config.gypi
creating  ./config.mk



$ make
$ sudo make install
$ sudo npm install -g coffee-script
$ sudo npm install -g nodemon









Saturday, July 14, 2012

Sending custom Nagios notification emails with coffeescript

Lets imagine for a second that you are using Nagios to monitor systems and services.  Nagios can send you notifications upon events, but the default email notification command is kind of boring.

Lets spice it up with coffeescript!


Nagios


define contact{
        contact_name                    mike
        alias                           Mike Kunze
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-with-nodejs
        host_notification_commands      notify-host-by-email
        email                          
}


define command {
    command_name    notify-service-with-nodejs
    command_line    /opt/bin/notify-service.coffee "$HOSTNAME$" "$SERVICEDESC$" "$HOSTADDRESS$" "$NOTIFICATIONTYPE$" "$SERVICESTATE$" "$LONGDATETIME$" "$SERVICEOUTPUT$"
}



CoffeeScript



This script will be executed by nagios and will contain the macros provided by the nagios command.

Saturday, June 16, 2012

Windows 7 Updates (service not running error)

Today, I brought back up an old machine of mine running windows 7.  It had been a good 6 months since I've last used it, so naturally, windows updates was not working.

I managed to find a nice thread on social.technet:  http://social.technet.microsoft.com/Forums/en/w7itprogeneral/thread/6a8889a8-65b2-4012-9cf8-2689f47b21e4


stop Windows Update Service


delete C:\windows\softwaredistribution\*.*


start Windows Update Service


check for updates




Hope this helps if you run into the same issue.

Monday, June 11, 2012

NodeJS and OpenShift, a PortalGNU presentation

Today, I am going to get my platform service configured and ready for development.  For PortalGNU, I will be using Red Hat OpenShift.  

First we select a web cartridge.  In my case, I will select Node.JS.



Give the application a name.


The next screen will include necessary information for setting up git and pub keys.   I installed the openshift toolkit (rhc) so I will continue there.

OpenShift includes shared databases and other features, called Cartridges.  In my case, I want a MongoDB cartridge.

$ rhc app cartridge add -a portal -c mongodb-2.0



RESULT:

MongoDB 2.0 database added.  Please make note of these credentials:

       Root User:  root
   Root Password:  *******

   Database Name:  portal

Connection URL: mongodb://127.0.0.1:27017

You can manage your new MongoDB by also embedding rockmongo-1.1


So at this point, I have mongoDB installed.  Let's check out rockmongo, too.


$ rhc app cartridge add -a portal -c rockmongo-1.1


RESULT:

rockmongo-1.1 added.  Please make note of these MongoDB credentials again:

   RockMongo User    : root
   RockMongo Password: *******

URL: https://portal-portalgnu.rhcloud.com/rockmongo/


Sweet, a web interface.  Now I will create a new database for the Portal CMS.



Cool.  From now on, package.json in my git repository will dictate how this application works.  For now, I have a cool default landing page:






Thursday, March 22, 2012

Creating a content driven continuously tested and integrated source controlled website with NodeJS and Express

Creating a content driven, continuously tested and integrated source controlled website with NodeJS and Express.

The next set of blog entries will be dedicated to bringing online my pet project PortalGNU.com/org

Portal GNU will contain content dedicated to the open source movement.  The website will act as a blueprint for spawning your own personal NodeJS + Express + MongoDB driven website.

Before PortalGNU goes live, my blog will be dedicated to describing the process from github to travis-ci to amazon EC2.

Right now this is a work in progress.  More to come.

Friday, March 16, 2012

Server 8 Beta - Installing Core, Install GUI later

I'm beta testing server 8, which is in public beta (link)

This is the first time I've tried installing just the core, but it seems to make sense now.



It is an extremely quick way to get a box online and exposing RDP without the hassle of navigating a GUI.

To quickly get your hostname, networking, and RDP configured, simply run sysconfig.cmd



You may still use the GUI if you'd prefer.  The new windows 8 interface plays well with the apple trackpad.  I'll warn you though, this will take a while.  In order to later install the GUI tools, you simply open up powershell and issue the following:

Add-WindowsFeature Server-Gui-Shell



Finally you'll reboot.


Friday, February 17, 2012

Get Blogger Posts with NodeJS

Today I wrote a blogger scraper for my new NodeJS website:  http://mikekunze.info

This script connects to my blog's RSS JSON feed and sends its data to a mongolab hosted mongoDB instance.

Pretty nifty.  Now I have content for my website, and still can use blogger's API to create that content.

One of the bonuses with this script is how it will not duplicate entries.  This feature checks title names.  If we want to be more dynamic we would create hashes on the entry content... maybe some day.