NodeJS, MongoDB and Redis on NTC's C.H.I.P.
Not so long ago I tried setting up on my C.H.I.P. a small stack that included NodeJS, MongoDB and Redis.
The requirements were nothing special, as I just needed a simple portable environment to test a project I’m working on. I thought that C.H.I.P.’s ARMv8 1GHz CPU, 4GB Flash and 512MB RAM would suffice for the task, so I begun to dig in the ARM realm.
At first I remember having given up almost instantly, as nothing came pre-packaged and compiling from source just wouldn’t finish right. I eventually resorted to using other hardware for that project, a cluster of 6 old machines (microservices ftw) powered by AMD Athlon processors - they lacked the SSE2 instruction set, so that had me watching over multi-day compilations (IIRC the total sum of compiling times was somewhat over 48 hours). But that’s a story I might write about in the future.
In the past days I had to set up another test environment for the same project, but that cluster had already been devoted to another cause - this reminds me I need a proper homelab for toying with virtualization… - so I shook the Box-of-Embedded-Boards-that-I-sweared-I’d-have-used-properly-one-day™ three times and the C.H.I.P. surfaced.
Not wanting to mess with the will of the holy BOEBTISIHUPOD™, I picked up the board and started searching.
It seems that things just got easier since a couple of months ago!
NodeSource’s NodeJS repos now include ARMv6 and up builds, MongoDB started issuing official builds with working WiredTiger support, and Redis… Well, it compiles fine but some tests still don’t want to pass. For a temporary sandbox environment, though, I’ll just pretend I never saw those failing tests and that everything will be fine. I can’t tell if such failed tests can indicate a potential failure for the whole Redis instance or if they are minor nuisances. By the looks of it, all the most important tests seem to be ok, but don’t go about running crazy loads on ARM-backed Redis instances until you’ve made all tests pass!
Remember that you are in mostly uncharted waters here…
Installing the language and its tools on ARM processors (v6 and up) is now pretty straightforward.
If you are on a Debian-based build you can rely on NodeSource’s repos:
If you want to install a different version (6.x is the LTS at the moment of writing) you should refer to the downloads page and its package manager section.
Test the installation with this one-liner:
A not-so-recent version is readily available in the repos:
You may obtain v2.6.12 by adding Debian’s unstable (sid) repos, that may even have newer versions for the
armhf arch. Be sure to properly configure APT’s priorities of you’ll find yourself with an hybrid stable-testing-unstable distro.
If the unstable/testing repos are fine to you, you can try to obtain the said version of MongoDB:
If you absolutely need the newest version, things will begin to get ugly. And very, very time consuming - a build can take up to 10 hours, and most probably you will need two or three tries before getting the build flags right along with all the dependencies. Be sure to get your ARM version right as well where needed.
Remember that working on 32-bits platforms is unsupported and introduces significant drawbacks for MongoDB.
Anyhow, start and enable the service:
As I wrote before, Redis should be fairly easy to compile and run:
As stated before some tests could fail, if you are ok with that and your Redis binaries seem to be working (
src/redis-cli), proceed with:
Complete the job by starting and enabling Redis’ service:
If you’re a perfectionist, don’t forget about testing the connection: