Category Archives: Programming

Developing with Docker over a mobile phone tethering

A few weeks ago I moved my development to Docker. Today I was preparing my development environment to be able to work from an office with limited access to the Internet.

I was trying to provision containers using my Android phone as an Internet link.

The connection failed initially

To fix it, I edited /etc/resolv.conf and added

After it I had to flush the DNS cache

and restart docker-machine

The connection is slow compared with my normal wifi, but it allows me to work on my own when not at home or the office.

References

Can’t pull image on my ubuntu 13.04 #1470

How to Flush DNS Cache in OS X Yosemite with discoveryutil

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Folding lines in Sublime

In one of my projects I am adding a good amount of logging to my code, with the result of getting a lot of distracting lines that end up hiding what is really going on.

I was searching for a plugin that can fold lines containing a text fragment in my editors, and found Filter Lines for Sublime.

After installing the plugin, I went to Edit | Code Folding | Fold with Regex  and entered ^((?!logger.).)*$  as my expression.

As a result, I went from

Sublime not folded

to

Sublime logger filtered

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

A tool to generate .gitignore files

For some time I have been using gitignore.io to create the .gitignore file used in my projects.

The content in many cases seems to be overkill (because it includes common libraries used by the language or tools selected), but it is better than the option of accidentally adding files to git that later need to be removed.

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Performance problems in Vagrant when using host files into guest

I am working in an application that has to access a good number of resource files (good both in numbers and file sizes). As usual I am working in a Vagrant instance, and everything was going fine for the initial work.

But eventually the number of files passed from just testing to production, and while developing in my host the file access operation was ok (in the order of seconds to load everything), when the same code was running in Vagrant it took more than ten minutes to be ready.

At first I thought it was a memory problem, and increasing it to 6GB helped a bit (nine minutes instead of ten), it still didn’t cut.

I tried creating an instance in AWS, and surprising enough the performance was similar to running in my Mac.

I decided to copy all the files to the Vagrant instance, and then the problem was sorted, performance is on par with the host and AWS. That was it. Looking at the documentation, I noticed a shared directory option that is rsync, but I haven’t tried it, because I wrote a set of scripts that take care of preparing those resources to be deployed (both in Amazon and Vagrant) and dropping them on destination (which is a nice addition to my attempts to automate as much as I can both in development and deployment).

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

More work on Ngramatic

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.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

More work for Ngramatic

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.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Domains and hosting

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.

Tomorrow I will try to deploy Ghost there, and see how it works.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Binding mistake

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:

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:

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather