Tuesday, May 12, 2015

Hapi with Memcached on OpenShift?

Not really? Me too.

I couldn't get catbox-memcached to work. No matter what I tried, all I was getting was a 503 Gateway error. Which means my server wasn't connecting to the memcached server.

Eventually, I follow the adage from Sherlock Holmes - when you have eliminated the impossible, whatever remains, however improbable, must be the truth. In this case, it seemed improbable that the correct password wouldn't work.

So it doesn't accept passwords???

And sure enough, that is the case. The underlying component, memcached, doesn't support passwords - https://github.com/3rd-Eden/node-memcached/issues/219.

This may not be an issue for self-hosting, but in my case, OpenShift only gives me an authenticated option. But there is another component that does support a password protected connection - MemJS. I've made a copy of catbox-memcached, named catbox-memjs, which wraps the memjs cache component. It's available here on https://github.com/darkoverlordofdata/catbox-memjs and on npm.