Banana Pi: intranet pages on a tiny computer
Putting webpages on an intranet used to be complicated. But now there's a variety of small computers well-suited to this task. So let's have a look at one of them: the Banana Pi.
When creating webpages, one of the most important factors is usually page speed and the number of users you want to support simultaneously. For pages with many users, you may need two or three servers, a separate database, and probably a load balancer to manage it all.
So what kind of hardware would you use when specifying the needs for an internal webpage with a limited number of users and quick ethernet connections?
Here's what we used for one of our customers:
This little box contains a 1GHz dual-core processor, 1 GB RAM and a Gigabit ethernet port. Combined with an 8GB SD card to hold the system software and a 2GB USB stick for user data, this little computer is perfectly suited for small networked tasks such as serving an intranet page. There are quite a few more connectors, like an SATA port, an HDMI port, audio connectors, a microphone and even an IR input, that we're not using for this project.
It runs off a regular micro-USB power adapter and only uses 3W of power, so it's great as an always-on device.
The whole setup costs about £50, so it's not a big investment either.
It gets even better from a user perspective. Since we preload the device to work on the customers internal network, the system knows how to set itself up. All the customer has to do is plug it into their network -- et voilà! The computer automatically configures itself via DHCP and assigns itself a known DNS name on the local network, so the page is immediately available in every browser in the local network. Security is very high because the device is protected by the regular network firewall. No outside connections are needed.
System upgrades are easy, too: We simply send a new SD card to the customer. They pull out the old card and put in the new one. Quick and easy!
From a developer standpoint, the device doesn't differ much from our other, more conventional servers. It runs a variant of the Debian Linux distribution called Raspbian, which offers the same software packages as regular servers. The web server is configured as an NGINX system with our usual Django deployment packages.
Whilst it's not the fastest computer in our arsenal, it's perfectly fine for serving low-load user pages. Load times are between 0.4-0.6 seconds for a complex page and the server can handle about 5 concurrent requests per second. A regular user clicks about once a minute, so as long as there are less than 100 active users at a time the page will be very responsive. Another factor for page loading times is the network transmission. This isn't an issue in this setup since both server and consumer are on the same fast network.
Serving an intranet webpage from such an appliance is only one of the many exciting applications for these great small devices.
Johannes is a freelance Django and mobile developer living in Germany. He's contributed to Wagtail and works with Torchbox frequently. As an amateur cake-eater and trained mathematician, he's happy to work with Pi often.