Doing it yourself
Download Jessie Raspbian
Get the latest version of the LITE OS here and write it to a microSD card using the instructions present below:
Once written, attach the microSD card to your Raspberry Pi, boot it up and connect to it using the pi
username and raspberry
password.
Update and clean up
Remove unnecessary packages - it's possible that some of these packages might not be installed. Just remove them from the list of packages to remove and run the command again.
# sudo apt-get remove --purge wolfram-engine triggerhappy cron logrotate dbus dphys-swapfile xserver-common lightdm fake-hwclock
# sudo apt-get autoremove --purge
It is highly recommended to update Raspbian to the latest version before doing anything else.
# sudo apt-get update
# sudo apt-get upgrade
Reboot after all that.
Setup read only mode (optional)
This step is up to you. To reduce data corruption we recommend you setup your file system in read only mode. Instructions can be found under Setup read only mode.
Run raspi-config
Once rebooted, connect to your Pi again and run raspi-config
. We recomend you take the following actions:
- Expand Filesystem
- Advanced Options
- Hostname
And, if you want, the following are also good to be setup:
- Internationalisation options
- Change Locale
- Change Timezone
- Change Wi-fi Country
When asked to reboot, do it.
Install Git
Git is required to clone the software from Github.
# sudo apt-get install git
Install supervisord
Supervisord is required to ensure all software is always running.
# sudo apt-get install supervisor
Install NodeJS v6
NodeJS is required for the web controller. Update your apt-source by running...
# curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
And then install Node by running...
# apt-get install nodejs
# apt-get autoremove --purge
Note on R/O file system: when running NPM to install dependencies it will complain about the /tmp
folder potentially not having enough space for processing. Since this is basically a once-off operation, create a file named .npmrc
with the contents below and put on your home directory. It will tell NPM to store its cache and temporary installation files somewhere else.
tmp = "/storage/tmp"
cache = "/storage/npm-cache"
Clone build-lights from Github
Change to the directory where you want to clone the project - if you have changed your file system to be read only, go to /storage
.
Then run git clone https://github.com/DiUS/build-lights
Configure supervisor
First rename the original supervisor configuration:
# mv /etc/supervisor/supervisord.conf /etc/supervisor/supervisord.conf.bkp
Inside the build-lights project you just cloned there's a directory named supervisor-config/etc/supervisor
. Copy the contents of that directory into /etc/supervisor
.
Note: there are two extra files copied into /etc/supervisor/conf.d
which need their paths adjusted if you have cloned the software into a directory other than /storage
.
Note 2: pay attention to the arguments passed in as well. Replace /storage/etc/build-lights
with whatever path you will store your configuration files.
Install project dependencies
Go to the directory where you cloned the project and then into web-controller
. This is a node project and since node and npm was already setup, run:
# npm install
# npm run dist
The above will install all dependencies and then generate the required files for running the web controller.
Install additional Python software
Some additional Python packages are required. Install them as follows:
# apt-get install python-pip
# pip install -r /path/to/build-lights/light-controller/requirements.txt
Create configuration files
You will need two configuration files: one for the light controller (to tell the process which jobs to monitor) and one for the web controller (to tell the web application what's the current state of the system).
This is the default configuration for web controller:
{
"tools": [
{
"name": "network",
"configuration": {
"hostname": "my hostname",
"connectionType": "ethernet",
"dhcp": true,
"address": "",
"netmask": "",
"gateway": "",
"wireless": {
"ssid": "",
"hidden": false,
"key": ""
}
},
"active": true
},
{
"name": "ci server",
"configuration": {
"tool": "jenkins",
"address": "http://localhost:8080"
},
"active": true
},
{
"name": "led hardware",
"configuration": {
"ledType": "epistar_lpd8806",
"numLeds": "32"
},
"active": true
},
{
"name": "jobs to monitor",
"configuration": {
"pollrate": 3,
"items": []
},
"active": true
},
{
"name": "statistics",
"configuration": {},
"active": false
}
],
"selectedTool": "network",
"lastUpdated": "2016-12-02T07:12:38.663Z"
}
This is the default configuration for the light controller:
{
"light": {
"type": "epistar_lpd8806",
"num_leds": 32
},
"ci_server": {
"type": "jenkins",
"url": "http://localhost:8080",
"pollrate_s": 3
},
"jobs": []
}