in every application now I have at least some logging going on, and if I don’t I am missing it. But having servers distributed around, getting details from the logs is a lot more difficult than when the whole application lived in a single server/directory.

There are services on the Internet now (I friend interviewed with some guys coming out of UCD, just a couple of kilometers from home), and some others like New Relic are going further ahead and giving you profiling details too. But I am not that eager to go with Internet services.

The option then is to deploy my own, or to use an existing package. I tried collecting my own details, but in the end it look too laborious, and I am not getting that much value from the extra effort.

From searching on the Internet one of the candidates is Logstash. It combines logging with ElasticSearch, I tool that I tried briefly and really liked, then I decided to give it a go. One of my colleagues at Ngramatic tried it, but bombed soon after following the tutorial, then we left it aside.

Now, at home, is time to try it. The first step is to make a Vagrant machine for deployment, to follow the tutorial.

Past night I took a break and went early to bed (during the weekend I drink less coffee than usual, and probably that has something to do with my sleepiness). But tonight I fired the machine again after dinner, working into Ngramatic to get a fresh version out.

Right now I am cleaning the code and adding a new set of HTTP controls to fire the processes from a web client. Monitoring and orchestration are more valuable than usual with a mesh architecture, and I am trying to cover as much as I can outside the working day.

Today I continued working in Ngramatic’s code instead of a side project. I know that it might not be the best idea, but I really want to see the product moving, and a quick fix of half an hour end up eating two hours and something.

While I was waiting for scripts to run, I gave a quick shot to deploy Ghost in OVH. The site is still not working, it is complaining about the access rights, and I haven’t really looked at them yet.

Nothing too exciting tonight. I was checking hostings outside AWS, because the prices don’t fly too well with me if it is only for a messing around after working hours.

In the end I picked up a VPS Classic from OVH. For 6.5 euros I get two cores, 2GB of RAM and 25 GB of disk, which should be enough to do some experiments. The contract goes monthly, then I can stop it for the price of three coffees. Not too bad.

Then I was busy with administrivia, a few of my registered domains are close to be renewed, and I am consolidating all those operations with the guys in Blacknight.

Perfect, effectively the problem with Ghost not being forwarded was that the address use by Node to listen is, by default, 127.0.0.1

A quick edit in the config.js file to replace the Production settings with 0.0.0.0 instead did the trick, and now Ghost is running in my Vagrant instance, and accessible from my laptop browser, and it looks good.

Making a post is very simple (I have been using markdown for a year now, to write anything I need formatted). There are no funny questions, nothing strange. Ghost seems to have a very low barrier to entry.

Tomorrow I will look on how to edit the theme, and to load my content generated with WordPress.

Earlier I was configuring a machine with Ubuntu Server to be used as our build/process server. In the last months I was doing everything in Vagrant or AWS, but this one is a physical machine, and I have to do everything from scratch.

Being used to Python Fabric now, I wanted a way to run my scripts remotely. First I needed to enable SSH in the new server and to deploy keys to authenticate when ssh to it. OpenSSH went in as part of the deployment of Ubuntu, so that was easy.

Making the keys was clear enough with the instructions. As a reminder for me (I will probably need to do it again), I will recap the steps here:

In my own laptop, I run:

1

2

3

mkdir-p~/.ssh

chmod700~/.ssh

ssh-keygen-trsa

The last command fire a command line dialog asking for the file name to use for the keys (I used ngramaticbuild), and a passphrase. I left the passphrase empty, to not be asked for it. The end result are two files, one public (extension .pub) and one private key. The private key stays in my laptop, the public file goes to the new server.

Then I ssh to the new server, logged in using username and password, and created a directory:

1

2

3

/etc/ssh/ngramatic

chmod755/etc/ssh/ngramatic

chown ngramatic:ngramatic/etc/ssh/ngramatic

where ngramatic is the account I created in the server earlier.

I opened another terminal in my laptop and copied the public key to the new server

1

scp ngramaticbuild.pub ngramatic@123.123.123.123:/etc/ssh/ngramatic

where 123.123.123.123 is the address of the new server.

Having the files in place, I did an:

1

2

cd/etc/ssh/ngramatic

cat ngramaticbuild.pub>>authorized_keys

And then configured ssh to read the keys when required:

1

sudo nano/etc/ssh/sshd_config

and in the editor I put the line

1

2

3

PasswordAuthentication no

...

AuthorizedKeysFile/etc/ssh/%u/authorized_keys

and saved.

A restart of OpenSSH closes the activity to authenticate with a key file:

1

sudo service ssh restart

I closed my ssh session, opened it again from the directory where i have my private key and I wasn’t asked for a password to login, which is good:

1

ssh-ingramaticbuild ngramatic@123.123.123.123

But if I did a sudo command, I was asked again for the password. Given I run scripts from Fabric, firing dialogs is not an option. The solution was simple, but took me some time to find it. The fix is to change the sudoers configuration:

1

sudo visudo

and add at the bottom of the file:

1

ngramatic ALL=(ALL)NOPASSWRD:ALL

After that my Fabric scripts are running happy, and I should be able to treat a physical server the same as the ones provided by AWS or Vagrant.

OK, in the end my problem with port forwarding was the binding I was using in my test application. Interesting enough, it is a time now since I was using Vagrant and NodeJS every day, and it showed up in my confusion.

I did a little application to test why I wasn’t able to reach my guest server from my host machine. I tried changing the forwarded port number and enabled firewalls, but nothing happened. Initially I assumed that there was a problem between Vagrant and Ubuntu, then I tried with different OSs, different versions of Ubuntu, but there was no improvement.

Here is the code I used, blindly taken from the NodeJS page:

1

2

3

4

5

6

varhttp=require('http');

http.createServer(function(req,res){

res.writeHead(200,{'Content-Type':'text/plain'});

res.end('Hello World\n');

}).listen(1337,'127.0.0.1');

console.log('Server running at http://127.0.0.1:1337/');

Then I tried using Apache as a test application and it worked fine. That removed Vagrant as the problem, but i wasn’t that sure about Ubuntu. I tried with the firewalls again, but no luck. Finally, after reading the same documentation again and again, I noticed the details about binding the NodeJS application. I was using localhost as the server, but I needed to replace it with 0.0.0.0 A second later, my test was passing, I slapped my face (because I read that, and have done it many times before), and I am now writing and heading to bed. It was frustrating, but I am happy in the end. Tomorrow I should be able to deploy Ghost properly, meanwhile, the little test is here: