Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antonfisher/rpi-jenkins-light
Raspberry Pi Jenkins Light on NodeJs
https://github.com/antonfisher/rpi-jenkins-light
jenkins nodejs raspberry-pi
Last synced: 7 days ago
JSON representation
Raspberry Pi Jenkins Light on NodeJs
- Host: GitHub
- URL: https://github.com/antonfisher/rpi-jenkins-light
- Owner: antonfisher
- License: mit
- Created: 2015-12-15T06:20:47.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-10T07:19:01.000Z (almost 7 years ago)
- Last Synced: 2025-02-02T01:32:18.760Z (12 days ago)
- Topics: jenkins, nodejs, raspberry-pi
- Language: JavaScript
- Homepage: http://antonfisher.com/posts/2016/01/05/make-raspberry-pi-jenkins-traffic-light/
- Size: 634 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Raspberry Pi Jenkins Light
[![build](https://travis-ci.org/antonfisher/rpi-jenkins-light.svg)](https://travis-ci.org/antonfisher/rpi-jenkins-light)
[![npm](https://img.shields.io/npm/dt/rpi-jenkins-light.svg?maxAge=86400)](https://www.npmjs.com/package/rpi-jenkins-light)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![GitHub license](https://img.shields.io/github/license/antonfisher/rpi-jenkins-light.svg)](https://github.com/antonfisher/rpi-jenkins-light/blob/master/LICENSE)
![status](https://img.shields.io/badge/status-beta-lightgray.svg)![Demo](https://raw.githubusercontent.com/antonfisher/rpi-jenkins-light/docs/images/traffic-light-demo.gif)
__Note:__ this package was tested on Raspberry Pi 2.
Read [article about this project](http://antonfisher.com/posts/2016/01/05/make-raspberry-pi-jenkins-traffic-light/).
## Installation
* SSH to _Raspberry Pi_
* `$ sudo su` (need for install _Node.js_)
* Install NodeJs 5.x
* Add repository `$ curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -`
* Run `$ apt-get install nodejs`
* From _GitHub_ sources:
* Clone repository: `$ git clone https://github.com/antonfisher/rpi-jenkins-light.git`
* `$ cd rpi-jenkins-light`
* Install dependencies: `$ npm install`
* From _NPM_:
* `$ npm install rpi-jenkins-light`.## Configure
Edit `$ vim configs/config.js` file:``` javascript
module.exports = {
rpi: { // Raspberry Pi sub-config
gpio: { // GPIO [General Purpose Input Output] config
color: {
red: 15, // pin # for red color
yellow: 11, // pin # for yellow color
green: 7 // pin # for green color
},
outputLevel: {
on: true, // 3v3 // led turn on output level
off: false // 0v // led turn off output level
}
}
},
jenkins: { // Jenkins sub-config
interval: 5 * 1000, // requests interval
host: '10.0.0.1',
port: '8080',
view: 'JenkinsLight', // http://localhost:8080/view/%VIEW_NAME%/
demoMode: true // demo turn on red-yellow-green lights
}
};
```### Demo mode
To run light in demo mode set property: `demoMode: true` in `jenkins` section in `configs/config.js`.### Connect LEDs to Raspberry Pi
Example config works with this configuration:
![LEDs connections](https://raw.githubusercontent.com/antonfisher/rpi-jenkins-light/docs/images/schema-simple.png)### Pins map
![Pins](https://raw.githubusercontent.com/antonfisher/rpi-jenkins-light/docs/images/rpi-pins-schema.png)[More about Pi's pins...](http://elinux.org/RPi_Low-level_peripherals)
### Final version
![Under hood 1](https://raw.githubusercontent.com/antonfisher/rpi-jenkins-light/docs/images/mounted-board.jpg)![Under hood 2](https://raw.githubusercontent.com/antonfisher/rpi-jenkins-light/docs/images/light-before-close.jpg)
## Configure Jenkins
* Open _Jenkins_ main page
* Create new list view called `JenkinsLight`
* Add monitored tasks to this view.The colors indicate (by priority):
* Blinks yellow -- at least one build is running
* Red -- at least one build is failed
* Green -- all builds are OK.![Jenkins View](https://raw.githubusercontent.com/antonfisher/rpi-jenkins-light/docs/images/create-jenkins-view.png)
## Run
* `$ sudo su` (need for GPIO module)
* From _GitHub_ sources:
* `$ node run.js`
* From _NPM_:
* `$ node ./node_modules/rpi-jenkins-light/run.js`.## Autorun application after reboot
```bash
sudo su #need for global modules
npm install pm2 -g
pm2 startup
pm2 start run.js -o "/dev/null" -e "/dev/null" #run w/o logging
# pm2 start run.js #run w/ logging
pm2 save
```## Advanced
Disable ext4 journal:
```bash
sudo -i
echo u > /proc/sysrq-trigger
echo s > /proc/sysrq-trigger
tune2fs -O ^has_journal /dev/mmcblk0p2
e2fsck -fy /dev/mmcblk0p2
echo s > /proc/sysrq-trigger
echo b > /proc/sysrq-trigger
```## Tests
* Use _NodeJs v5.x_
* `$ npm install --dev`
* `$ npm test`.## Release History
* 1.1.0 Tests and improvements
* configuration examples
* test with jenkins mock
* 1.0.0 Initial release.## ToDo
- [x] add link to article
- [ ] npm global module## License
Copyright (c) 2015 Anton FisherMIT License. Free use and change.