I’ve implemented the KeystoneJS as a blog on my professional portfolio site: ChrisTroutner.com. I’ve moved this blog over there and will continue blogging about KeystoneJS, Raspberry Pi, FreedomBox, and other projects.
I could have developed this on the Raspberry Pi, but instead opted to use a virtual server hosted by Digital Ocean. They only cost $5 per month and the ability to save and restore snapshots is even faster than re-flashing the SD card on the R-Pi. Either way, all the setup and configuration was done on the command line using SSH.
So without further ado, here are the steps I needed to take to get KeystoneJS up and running on a Ubuntu 14.04 Droplet:
- Log in as root
- Setup Mongo DB by executing the following code: (adapted from this Digital Ocean tutorial)
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
- echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
- apt-get update && apt-get -y upgrade
- sudo apt-get install -y mongodb-org
Install the following support packages:
- apt-get install make
- apt-get install git
- apt-get install g++
Add a local user. In this case I’m calling him ‘trout’:
- adduser trout
- adduser trout sudo
- This is a great time to shutdown the VM and take a snapshot. (optional)
- Log in as your new user.
- Install NVM (to run older versions of Node and NPM).
- Log out and log back in as your regular user (‘trout’).
Install Node 0.10.36:
- Note: This will give you warnings that node and npm are outdated. Ignore these warnings. 0.10.13 is too old to work and 0.12.7 (latest as of this writing) will break KeystoneJS because it is too new. There may be other versions that work, but these are what I’ve tested.
nvm install 0.10.36
Install the Yeoman Keystone Generator:
- npm install -g generator-keystone
Run the Yeoman Keystone Generator:
- yo keystone
- Follow the on-screen prompts. Just hit if you want to accept all quickly accept all defaults and test if you can even get KeystoneJS running.
Change directory and run KeystoneJS:
- By default KeystoneJS will install into a directory called ‘my-site’.
- cd my-site
- node keystone
- Access your new website view port 3000. If you’re using a Digital Ocean Droplet like me, you can simply type in the IP address is your web browser like this: http://555.555.555.555:3000. If you’re using a Raspberry Pi, use the IP address of your Pi.
These are the steps that I was able to take and get KeystoneJS up and running. I hope it helps other people from having to spend two days figuring them out, like it took me.
James Valleroy wrote the group to announce he had a new Raspberry Pi image. I haven’t tested it, but I thought I’d post it here to make it easier for others to find. Please post in the comments if you are able to successfully load it onto your Raspberry Pi.
Date: Fri, 15 Aug 2014 07:56:02 -0400
To: FreedomBox discussions
Subject: Re: [Freedombox-discuss] Image for Raspberry Pi
I have uploaded a new raspberrypi image here:
Current known issues:
– Doesn’t include XMPP server or client.
– Plinth templates are broken.
I’ll try to upload new images for each platform on a regular basis.
One of the notes that I saw was that XBMC takes control of the video output directly and does not use the XOrg GUI. If Raspbian is set to boot to desktop, it is advantageous to reconfigure it to boot to command prompt so that resources aren’t wasted. This can be done with the following command:
Follow the prompt to reset the Pi boot settings.
I also switched from a VGA monitor to a TV with an HDMI input port. I didn’t want any VGA configuration settings to get in the way of running XBMC. I will play with these alternative setting later, once I confirm that the native HDMI output works properly. That means I had to comment out the line in the /boot/config.txt file that were setting my Pi to VGA mode (see earlier posts).
I’m more in the habit of controlling the Pi over SSH from my laptop, rather than with a keyboard and mouse plugged into it, so keep that mind. At the very least, it explains my preference for command line control.
Once I rebooted the Pi, I logged in over SSH as user pi. I was able to launch XBMC with this command:
The ampersand just tells the OS to run the program in the background. Otherwise it will block your command line interface and you’ll have to open another one. I was excited to see that XBMC took control of the HDMI output and ran flawlessly.
Mounting a Flash Drive
I shut down XBMC and loaded an ISO file onto a USB flash drive, which I plugged into the Raspberry Pi USB port. I rebooted the Pi just to be safe. After a few tries, I was able to mount the USB flash drive with these commands:
sudo mkdir /mnt/usb
sudo mount /dev/sda1 /mnt/usb
I then launched XBMC and it was able to read the ISO file!
Need an MPG2 License
After loading the ISO file into XBMC and hitting play, a small stream of music came out, but no video. Hmm…
After a little bit of digging, I found this XBMC forum thread. It turns out that some part of the DVD ISO file uses the MPG2 encoding format, and I need to buy a license to enable the Raspberry Pi’s FPGA to run it. The thread lead me to the Raspberry Pi Store, where I was able to buy a license for $3.48.
Unfortunately, the license file isn’t an instant download, so I had to wait until I got the license this morning. I have received it, and I’ve also followed the instructions to load it into the /boot/config.txt file. I should be able to play back the DVD ISO file this afternoon!
I’ll report back with results.
In the meantime, a member of the FreedomBox mailing list posted a link to this inspiring YouTube video:
Since I started playing with my Raspberry Pi/FreedomBox, I’ve been talking about it with my friends and family (all non-geeks). They all think the software the Freedombox provides is cool, but not enough for them to shell out $100 for it. However, I’ve also been telling them about how the Raspberry Pi can be converted into a media server, and they have all shown incredible excitement over that.
Let me back up and explain exactly what a media server is, for the sake of this discussion:
What is a Media Server?
In terms of functionality, a media server is a device that contains and serves media, like music and movies. Think of a DVD player that can save your movies and music and play them back for you on-demand.
In terms of hardware, a media server is simply a Raspberry Pi connected to a TV, and most likely, a portable hard drive plugged into one of its USB ports. Your MP3 music files and DVD ISO (like those made with AnyDVD) can be uploaded to the hard drive and the Raspberry Pi can read them, and play them back on the TV. This same hardware setup (minus the TV connection), by the way, is identical to the minimum requirements to run OwnCloud, a personal cloud server. OwnCloud is one of the packages that is targeted for implementation in the FreedomBox project.
Combining a FreedomBox and Media Server
One important objection is that the Raspberry Pi probably does not have the bandwidth to do both. As an embedded computer, running a media server is probably going to push it to the limits of it’s computational power. There are several demonstrations that the Raspberry Pi is quite able to perform as a media center. However, FreedomBox services will probably have to be shut down or throttled during DVD playback. Alternatively, two Raspberry Pi’s could be connected together – one running the media server, the other running the FreedomBox software.
Experimenting with a Media Server
All this research convinced me to spend some time playing around with software and see how hard it would be to get a media server going. I made a backup image of the working Freedombox I had loaded on the Pi and reinstalled NOOBS with Raspbian (see previous posts on how to do all this).
While there is a variety of software that can be used as a media server, the most popular by far is XBMC. XBMC can not be installed with apt-get on the Pi as it is reported as a broken package in Raspbian. However, installation is not much more difficult than that. I found these two helpful pages:
- How to install XBMC with a binary package (easier & faster)
- How to install XBMC from source (in case the above soluation stops working in the future).
Using my SSH remote-admin console, I was able to follow the binary install guide to the point that I should now be able to plug the Pi into a TV and run XBMC. I’ll give it a go this afternoon and report back with my findings.
I also need to verify that the Pi will detect and read my portable hard drive.
I’ve been working with the Freedombox mailing list over the last week to figure out why I’m having such a hard time getting a working build. The odd thing is that I can build the image, but the Raspberry Pi will not boot. They’ve been incredibly helpful and the evidence is mounting that the build is actually broken. Here is the latest email with the evidence. Check the mailing list archives for April and May to get all the gory details.
The good news is that you anyone can still build a working Freedombox with a Raspberry Pi by using Pere’s image from 3-20, which can be found on this ftp server and follow the steps I documented here on the blog.
After reaching out to the mailing list, it was suggested that I use gparted, the graphical implementation of parted, to resize the partition. It was also pointed out that I went rogue in my implementation of PageKite, which probably explains my unsatisfactory results.
I decided to reflash the SD card with Pere’s Freedombox image. After doing that, I used gparted to resize the root partition to take up the rest of the space on the SD card. gparted was refreshingly intuitive to use.
I’m also going to play around a bit more with the Plinth implemented version of PageKite on the Freedombox. I’ll report back with the results.