devops

Consul Service Discovery and leader election

Elect a leader with Consul for your service So I started testing out a service discovery platform called Consul by the company Hashicorp. The system uses the raft consensus protocol, and you may run into issues with leader election when you try to restart each server node. I did, and before you start spending hours googling around, I am going to tell you what I did to elect a leader in my cluster.

fixing php5-fpm logrotate on ubuntu 14.04

I was getting an error about the logrotate invoke-rc.d: initscript php5-fpm, action "reopen-logs" failed. error: error running non-shared post rotate script for /var/log/php5-fpm.log of '/var/log/php5-fpm.log ' There are two issues, the invoke.d does not seem to have a reopen-logs options, and the logrotate program does not like that systemd has some ownership over /var/log. To fix these issues, I call the init.d script that has reopen-logs option, and I call the php5 logrotate with the su option at the end.