A few friends of mine know that I am in love with the Raspberry Pi. Especially, the instant tool set that Raspbian Jessie with Pixel provides is great. It is very easy to start coding. Almost like the old hacking days with XAMPP for PHP, MySQL and HTML. Unfortunately, I could not find any cool and fast tooling for NodeJS and CouchDB 2.0.
Therefore, I started my to create my own local development server. The procedure is described in my last blog article. This blog introduces a ready-made image file, which you can flash on your SD Card. The image contains these softwares pre-installed:
- Raspbian Jessie Lite (SSH enabled / Germany timezone / hostname: localdev)
- Git Client
- CouchDB 2.0
- NodeVersion Manager: Running NodeJS (version 6.9.5 and 7.5.0)
- Node Process Manager pm2
- Nginx Webserver 1.10.3
1. Downloading Image
The image can be download here:
http://files.derhess.de/localdev_webserver_ver_1_0_0.zip (ca. 1.8 GB)
If you have downloaded the file, then please prepare your SD Card. It is very important to use a SD Card bigger than 8GB!!! I created my image file based on a 8GB SD Card. Usually, the sizes of 8GB SD Cards vary by the manufactures. If you have a big enough SD Card, please format it (e.g. with SD Formater). Then flash / burn / copy it on your SD Card. I used the Win32DiskImager for this step, but the cross-platform tool Etcher should do job very well, too.
2. Start Raspberry Pi and adapt it
After successful burning, please stick the SD Card into your Raspberry Pi. Please, connect your Raspberry Pi with a network cable to your router or Ethernet hub. Turn it on and wait until the boot process is over.
Connect via SSH to your Raspberry Pi. I used Putty for accessing my Pi. The hostname is
‘localdev’
The black window is supposed to open. The login is the same as the standard user/password:
user: pi
password: raspberry
Now you should be able to adapt the Pi for your needs. That could be:
- Change the ‘Locale’ via raspi-config command
- Change the ‘timezone’ via raspi-config command
- Change the keyboard via raspi-config command
- ‘Expand the filesystem’ via raspi-config command
- Configure your wifi
3. Understanding the infrastructure:
The NodeJS apps can be hosted within the Pi user’s home folder. Owner of the folder is of course the user pi:
/home/pi/ –> Folder for your NodeJS apps
All static and dynamic files for nginx webserver should be placed within this folder:
/home/nginx/www/ –> Folder for nginx Website
The owner of the ‘www’ folder is the user nginx. Please feel free to change it.
The CouchDB 2.0 database is already verified. There exist already a test user created by me. The login is:
url to the admin interface: http://localdev:5984/_utils/
user: localdev
password: raspberry
That is in the beginning all you have to know. More detailed information about the installed tools is described here. However, from here you can start to install your own tools (e.g. Docker) and extend it based on your needs.
If you are not happy with my image file, then no problem. Please give Coder hosted by Google Creative Lab a try. It looks pretty cool and I hope it will get some further maintain.
If you are in love with fast and easy prototyping tools, then check these apps for your mobile apps:
Happy Coding!
8 Comments
Great tutorial about how to create smaller Image files for your Raspberry Pi: Hardware Hump Day: Cloning your Raspberry Pi
https://www.sparkfun.com/news/2327
If you don’t know how to flash the image file on your Pi, please check this short video tutorial:
https://www.youtube.com/watch?v=PijX8GDco-g
Another nice #linux bash script for shrink the size of your image file
http://sirlagz.net/2013/03/10/script-automatic-rpi-image-downsizer/
Another cool tool for creating customized Raspberry Pi Images is:
PiBakery -The easiest way to setup a Raspberry Pi
http://www.pibakery.org/
There exist another interesting project about custom Raspberry Pi OS. It could be interesting to create a custom Version for NodeJS and CouchDB.
CustomPiOS
https://github.com/guysoft/CustomPiOS
Some nice guideline how to deal with NodeJS / NPM global and local installations
https://codeburst.io/maybe-dont-globally-install-that-node-js-package-f1ea20f94a00
Very interesting approach of PiBakery for rapid prototype a Serverless API Infrastructure with OpenFaaS on Raspberry Pi
https://medium.com/@JockDaRock/serverless-at-the-edge-up-and-running-w-openfaas-docker-on-a-raspberry-pi-multi-node-cluster-e0957f4d8a49
After the first setup, your API Gateway could be design like this with an additional Object Storage Server Minio
https://medium.com/statuscode/integrating-openfaas-and-graphql-experimental-1870bd22f2a
https://blog.alexellis.io/openfaas-storage-for-your-functions/
https://www.thepolyglotdeveloper.com/2017/02/using-raspberry-pi-distributed-object-storage-minio/
https://blog.alexellis.io/hardened-raspberry-pi-nas/
PiShrink is a very nice Shell Helper Script for reduce the size of your image files
https://github.com/Drewsif/PiShrink