Use Socket.gethostname

ENV["HOSTNAME"] is not guaranteed