Skip to content

Commit

Permalink
Merge pull request #1 from willswire/dev
Browse files Browse the repository at this point in the history
update to v2.0.0
  • Loading branch information
William Walker authored Feb 24, 2019
2 parents aa28f98 + b2572aa commit 6c6fb4f
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 23 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

All entries are made manually. This project adheres to [Semantic Versioning](http://semver.org/).

## 2.0.0 - 2019-2-24
- Introduces support for devices other than amd64 by replacing FROM
arch line with %%BALENA_MACHINE_NAME%% [Will Walker]

## 1.0.1 - 2019-1-28
- Extended stability for x11vnc using -find flag [Will Walker]
- Create function for infinite looping [CJ Lambert & Will Walker]

## 1.0.0 - 2019-1-10
- Initial commit for all code. Basing off of multi-container image used for
timestations. Starting with Debian Buster due to expected release date by
end of semester.
end of semester. [Will Walker]
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The [balena-dash](https://github.com/balena-io-projects/balena-dash) project is great! If you haven't yet had the chance to visit the repo, you certainly should before checking out this one. The main difference between this project and that one, is that **this project utilizes ElectronJS** to display webpages and other slides. Some things to note about this project:

- Performance will be limited on Raspberry Pi devices due to constraints that come with Chromium. Plain and simple: Raspberry Pi GPU + Chromium < WPE performance that the balena-dash project offers.
- Performance will be limited on Raspberry Pi devices due to constraints that come with Chromium. Plain and simple: Raspberry Pi GPU + Chromium < WPE performance that the balena-dash project offers. That being said, the chromium experience offers better support for rending elements which require 'supported browsers'.
- The latest version of ElectronJS (4.0.0+) will require at least Debian Buster to be installed, due to glibc requirements.

You may be asking,*"So why would I choose this project instead of balena-dash?"*
Expand Down Expand Up @@ -30,7 +30,6 @@ What things you need to deploy this code to your device:
git clone https://github.com/willswire/balena-dashboards.git
git remote add balena <get URL by clicking the ? in the top corner of your application dashboard>
git push balena master
```

## Configuration
Expand All @@ -40,10 +39,10 @@ The following `Enviroment Variables` must be set within Application > Device und
| Name | Value |
| ---------------- | ------------------------------------------------------------ |
| `SLIDE_URLS` | `https://www.google.com https://www.apple.com` _[space-separated URLs]_ |
| `TIMEOUT` | `60` _[integer which represents number of seconds]_ |
| `TIMEOUT` | `60,30` _[comma-separated integers which represents number of seconds for each URL]_ |
| `NOVNC_PASSWORD` | `defaultpassword` *[obviously change this to something different]* |

In order to view the device remotely from within your broswer, enable the public device URL within the device summary page. Then, you can simply click the link and login using the password set above.
In order to view the device remotely from within your browser, enable the public device URL within the device summary page. Then, you can simply click the link and login using the password set above.

## Built With

Expand Down
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: '2'
services:
dashboard:
build: ./dashboard
electron:
build: electron
ports:
- "5900"
network_mode: host
privileged: true
restart: alway
restart: always
vnc:
build: ./vnc
depends_on:
- dashboard
build: vnc
ports:
- "80"
network_mode: host
privileged: true
restart: always
3 changes: 2 additions & 1 deletion dashboard/Dockerfile → electron/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM balenalib/amd64-node:buster
FROM balenalib/%%BALENA_MACHINE_NAME%%-node:buster

# Install software packages
RUN install_packages \
# X Dependencies
xorg \
x11vnc \
xprintidle \
# ElectronJS Dependencies
clang \
libnss3-dev \
Expand Down
23 changes: 15 additions & 8 deletions dashboard/app/main.js → electron/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ const {
} = electron;

let mainWindow;
const TIMEOUT = (process.env.TIMEOUT * 1000);
const TIMEOUT = process.env.TIMEOUT.split(',');
console.log("After storing the env variable: " + TIMEOUT);
const SLIDE_URLS = process.env.SLIDE_URLS.split(' ');
var currentSlide = 1;
var currentSlide = 0;
var currentTime = 0;
var currentTimeout = 0;

// Slide changing Function
var slideChanger = function() {
mainWindow.loadURL(SLIDE_URLS[currentSlide % SLIDE_URLS.length]);
currentTimeout = parseInt(TIMEOUT[currentTime % TIMEOUT.length]) * 1000;
currentSlide++;
currentTime++;
setTimeout(slideChanger, currentTimeout);
}

// Main Function
app.on('ready', () => {
Expand All @@ -32,11 +44,6 @@ app.on('ready', () => {
console.log(err);
});

mainWindow.loadURL(SLIDE_URLS[0]);

setInterval(function() {
mainWindow.loadURL(SLIDE_URLS[currentSlide % SLIDE_URLS.length]);
currentSlide++;
}, TIMEOUT);
setTimeout(slideChanger, currentTimeout);

});
2 changes: 1 addition & 1 deletion dashboard/app/package.json → electron/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "balena-dashboards",
"version": "0.0.1",
"version": "1.0.1",
"description": "ElectronJS Balena Application",
"main": "main.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/start.sh → electron/app/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ x11vnc -storepasswd $NOVNC_PASSWORD ~/.x11vnc/passwd

# Start the UI pointing to ElectronJS
startx /usr/src/app/node_modules/electron/dist/electron /usr/src/app &
x11vnc -quiet -noxrecord -noxfixes -noxdamage -forever -localhost -rfbauth ~/.x11vnc/passwd
x11vnc -find -quiet -noxrecord -noxfixes -noxdamage -forever -localhost -rfbauth ~/.x11vnc/passwd
2 changes: 1 addition & 1 deletion vnc/Dockerfile → vnc/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM balenalib/amd64-alpine-python
FROM balenalib/%%BALENA_MACHINE_NAME%%-alpine-python

# Update software packages
RUN install_packages \
Expand Down

0 comments on commit 6c6fb4f

Please sign in to comment.