Keepalived instance not entering FAILED state

When a monitored interface goes down, the instance immediately enters FAILED state and the other instance gets into the MASTER state.

But, if you have a script block to check – say you are monitoring HAProxy – and HAProxy goes down the MASTER will not enter FAILED state, unless you do this:

Set the weight to a negative number (if MASTER priority is 101 and BACKUP priority is 100, the weight could be -2).

This way when HAProxy goes down, the Priority of the master will become 101 -2 = 99, the Backup with a priority of 100 will win the election and enter into MASTER state.

When HAProxy on the master comes back, it’s priority increases by 2 to become 101 again and if you have nopreempt disabled, this instance will enter the MASTER state.

Discourse with Docker on port 80

Discourse can cause you trouble if you have it running(listening) on a non-standard port inside the Docker instance. (the feed, google auth return url have the port and host info in them) (assuming you would like to serve requests from a standard http(s) port).

To make it work smoothly, I had to make it listen on standard port (80 in my case).
This is what I ended up doing:

Nginx(hostip:80) -> Nginx(dockerinsideip:80)

This method also extends to having multiple docker instance for different sites.
This is my nginx config on the host:

server {
    #where discourse sits
    location / {
        #this is also important for discourse to work as expected
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        #my docker instances internal ip

And, I removed http port mappings on my app.yml file.

Web Development using PHP on Mac OSX

I have always been a big fan of PHP, now that I am trying to code an app using PHP, I decided to install a PHP module for the Apache webserver running in OSX.

The Entropy package seemed to be a good option. I downloaded the module for Apache 2 and after installation my Apcahe webserver would not even start (personal web sharing would not turn on in System Prefernces>>Sharing>>Services). I started googling and found this article.

I typed in sudo apachectl configtest in terminal and this is what I got:

Syntax error on line 8 of /private/etc/httpd/users/+entropy-php.conf:
Cannot load /usr/local/php5/ into server: (reason unknown)

I tried reinstalling the Entropy module and that came with an error, I probably missed the error message when I was installing it the first time. I then tried a different package for Apache 1.3 and it worked perfectly, so I am assuming I have Apache 1.3 running.

Anyway everything seems to be fine now and MySQL seems to be working as well.So it is time to code!


Unfortunately, there seems to be no ultimate torrent client on a mac. Azuerues is feature rich, but is resource hungry;Transmission is lightweight but doesnt download everything; I liked the interface of Bitrocket, but it crashed several times that I decided not to use it.

I hoped the beta release of Xtorrent would be a perfect solution.I downloaded a few torrents using Xtorrent, they downloaded pretty quick and I was impressed.But, I was unabled to play an avi file that I had downloaded. I was thinking that maybe it was a codec issue. As Bittorent is a great solution to download files without the files losing integrity, I thought my VLC player was playing up. But when a few other files started having issues, I used Azureus to download the same torrents and it would worked like a charm, the files were playing perfectly on VLC.

Xtorrent (though beta) is not an impressive piece of software, imagine what would have happened if I had used Xtorrent to download a Linux Distro, it would have been a waste of time and bandwidth if the files had lost their integrity. So if you are downloading large files, make sure Xtorrent has nothing to do with them.