It's a mad mad World ...

It might look like "just" a website, but it's a little bit more under the hood. I've been planning on sticking a website on the end of my new company domain name for some months but haven't quite gotten around to finishing it off until now. It's up at https://madpenguin.uk.

Although it's nothing all that special as a website, it sort of looks ok and uses a lots of new bells and whistles to get it's point across, but the fun bit is what it's doing under the hood. The actual webserver is Crossbar.io so the back-end is serving over websockets, nothing fancy as yet, but if you fill in the feedback form at the foot of the page and submit, that's an Autobahn RPC call, not a form post!

Again, nothing particularly spectacular in that, it's more the base it gives you for adding more (I will be adding more!), to get a better idea of what's there but not visible, try the demo button. If it I've not broken it yet (!) that's a real time data website analytics application plugged into a random traffic generator (running on similar infrastructure), so what you're seeing isn't a local Javascript application, it's driven in real-time from back-end data.

In principle it looks something like this;
In this instance I have NGINX running as a reverse proxy in front of Crossbar.io (the message router) but that's purely because it's running on a multi-tenant machine and something needs to de-multiplex the multiple incoming SSL streams. There's a neat trick you can do with NGINX to have it pass through HTTP and websockets on the same port, you just need something like this in the NGINX config;

# WebSocket support (nginx 1.4)
proxy_http_version 1.1;  
proxy_set_header Upgrade $http_upgrade;  
proxy_set_header Connection "upgrade";  

Oh, and of course it's all running inside an LXC container .. wouldn't be complete these days if it wasn't running in a container .. ;-)

Gareth Bult

Linux and Open Source Enthusiast, Programmer, SysOps, DevOps, BeerOps and anything related to Javascript, C, Python or Pizza.

South Wales (UK) http://linux.co.uk

Subscribe to Swapping Apples ...

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!