Plex

First time I heard about Plex was perhaps 2-3 years ago. A friend of mine was traveling from the US to EU was telling how he’s watching (streaming) movies from his home server on his tablet and how perfectly it all works.

Until now I’ve always had some sort of home media server, some storage box that keeps my media.
For the last couple of years it has been an HP MicroServer running FreeBSD with ZFS.

At home I use a RaspberryPi connected to my TV that runs KODI and mounts media share from the FreeBSD box. This works ok. Scripts run periodically to pull subtitles and shares can be mounted wherever.

But there’s a new challenge. I now spend more and more time between two cities and my media being at home sort of sucks as there’s no simple way of accessing it. Yes I do have a VPN but still.
Also accessing media from mobile seems like a great thing to have when on the go.

So I heard about Plex being good at supporting FreeBSD a week ago and I’m giving it a try.
First impression – poorly documented configuration (in case you have several subnets at home it does not work at all by default) but other than that seems quite capable. Will have to try out the premium features.

LFCS

For I while now I wanted to complete the Linux Foundation Certified Sysadmin exam and this week I did it. Yay!

If you’re a linux admin then this will not present too much difficulty to pass it. The LF certification page explains what domains and competencies will be tested and this can be used to prep for exam if needed.

The exam format is really cool, you get a console access to a linux vm (several choices of distros) and you are asked to do various sysadmin tasks. Nothing too complicated but might be something you don’t get to do too often.

I truly enjoyed the tasks and I learned a couple of new arguments to commands while doing them (you are free to use the man pages during the exam).

You get 2 hours to complete the tasks and that still allows you some time for readig man pages if needed.

For my preparation I spent two evenings reviewing the required domains and competencies and I passed the exam with a score of 92%.

Try it, it’s fun and interesting and at the end you get to add something to your resume.

Deploying Ghost blog

Yesterday I started using Ghost and I simply ran
npm start in a Tmux session.

This is obviously not the best way to do it so I have made some improvements now.

After reading a bit of deployment docs, which by the way are very nice, I decided to give pm2 a try.

So if you already have Ghost blog configured then you only need to install pm2 and maybe create some simple start script.

sudo npm install -g pm2  

Then, to launch and daemonize ghost, simply do:

pm2 start index.js  

To check on its status

pm2 show index  

Pretty neat.
The (super complicated) start script for my ghost is now:

#!/bin/sh
NODE_ENV=production pm2 start index.js  
pm2 show index  

Ghost on FreeBSD

I have been thinking for couple of days now that I should give Ghost a try.
Since I am re-starting blogging and all, might as well try different blog engines while I’m at it.

It would be no fun installing it on linux, so I decided to use FreeBSD VM on Digitalocean + a Jail inside of it.

Downloaded and unpacked ghost and then hit a bug.
Nodejs sqlite module would not install.

2695 error FreeBSD 10.1-RELEASE-p10  
2696 error argv "node" "/usr/local/bin/npm" "install" "sqlite3"  
2697 error node v0.12.6  
2698 error npm  v2.12.1  
2699 error code ELIFECYCLE  
2700 error sqlite3@3.0.8 install: `node-pre-gyp install --fallback-to-build`  
2700 error Exit status 1  
2701 error Failed at the sqlite3@3.0.8 install script 'node-pre-gyp install --fallback-to-build'.  
2701 error This is most likely a problem with the sqlite3 package,  
2701 error not with npm itself.  
2701 error Tell the author that this fails on your system:  
2701 error     node-pre-gyp install --fallback-to-build  
2701 error You can get their info via:  
2701 error     npm owner ls sqlite3  
2701 error There is likely additional logging output above.  
2702 verbose exit [ 1, true ]  

Googled a bit and found Ghost forum thread and a page on ghost wiki

The problems there were related but also a bit different and those solutions did not apply fully for me. I found though by reading the debug log that actually I was missing gmake and python in my jail.
I managed to resolve those errors by installing gmake and python and by updating npm modules. But later on discovered that much simpler solution is to install sqlite3 from FreeBSD package.

I have now tested this on a clean jail and at least from my perspective to successfully install ghost on FreeBSD 10.1 you only need to:

sudo pkg install node npm sqlite3  
wget https://ghost.org/zip/ghost-0.6.4.zip  
mkdir superduperblog  
cd superduperblog  
unzip ../ghost-0.6.4.zip  
npm install --production  
npm start  

Super simple.