-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 #46
Merged
Merged
V2 #46
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
7f35d2b
First push to v2 branch
phil-d-wilson e0dd0ef
Many changes
phil-d-wilson dcf08f4
display rotation & cursor control added
phil-d-wilson ad34707
Added FLAGS option
phil-d-wilson 717aecd
Implemented service discovery and default flags
phil-d-wilson 4fc186e
RPI dockerfile + fixes
phil-d-wilson 87f3a10
Readme and API endpoint changes
phil-d-wilson 97ddb7a
readme tweaks
phil-d-wilson 59f5113
Fixed kiosk bug. Removed sandbox warning dialogue
phil-d-wilson 97e68c3
Fixes and API features
phil-d-wilson 9e8b3b1
readme fixes
phil-d-wilson 1571a09
Latest
phil-d-wilson d0b4140
hub meta
phil-d-wilson ac32efa
Merge pull request #47 from balenablocks/hub
phil-d-wilson feae1c4
logo
phil-d-wilson 72859d6
Update balena.yml
phil-d-wilson 7095a7b
post-review changes
phil-d-wilson 2a3de83
gitignore trim
phil-d-wilson e15db43
Move to node 12
phil-d-wilson c85eedc
meta: add versionist
tmigone 91afc91
Merge pull request #49 from balenablocks/add-versionist
tmigone 8db9048
v1.0.0
balena-ci b7b7455
meta: run versionist to update balena.yml version
tmigone 2c3b819
Merge pull request #50 from balenablocks/balena-yml-version
4676a02
v1.0.1
balena-ci 36fd686
build changes
phil-d-wilson b6dd417
patch: Window size fix and build script bug
phil-d-wilson 466d84e
patch: build script update for manifest
phil-d-wilson a1c82ee
First push to v2 branch
phil-d-wilson 82d2af6
Many changes
phil-d-wilson 2d191bb
display rotation & cursor control added
phil-d-wilson 02fe96c
Added FLAGS option
phil-d-wilson 53267c8
Implemented service discovery and default flags
phil-d-wilson 1bb4fe8
RPI dockerfile + fixes
phil-d-wilson ffb2278
Readme and API endpoint changes
phil-d-wilson 55d5af6
readme tweaks
phil-d-wilson f0f6b87
Fixed kiosk bug. Removed sandbox warning dialogue
phil-d-wilson 83cbe7b
Fixes and API features
phil-d-wilson 27173ae
readme fixes
phil-d-wilson 966f513
Latest
phil-d-wilson 9e6702d
post-review changes
phil-d-wilson c4f2b5d
gitignore trim
phil-d-wilson 864bc18
Move to node 12
phil-d-wilson 47c2315
build changes
phil-d-wilson b466336
patch: Window size fix and build script bug
phil-d-wilson 6778388
patch: build script update for manifest
phil-d-wilson 5120608
Merge branch 'V2' of https://github.com/balenablocks/browser into V2
phil-d-wilson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sha256bca9ad158da383a9af76908776cf6cd8b06359a8a1529c4862fd17fd3f2fc7b3 | ||
Dockerfile.raspberrypi3 | ||
Dockerfile.raspberrypi4-64 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file | ||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
# v1.0.1 | ||
## (2021-03-01) | ||
|
||
* meta: run versionist to update balena.yml version [Tomás Migone] | ||
|
||
# v1.0.0 | ||
## (2021-02-25) | ||
|
||
* meta: add versionist [Tomás Migone] | ||
* logo [Phil Wilson] | ||
* hub meta [Phil Wilson] | ||
* Updated readme to remove DEBUG and add some display troubleshooting items [Phil Wilson] | ||
* audio: add code to make browser block play nicely with the audio block [Tomás Migone] | ||
* typo: wesite -> website [Matthew McGinn] | ||
* readme: some spelling fixups for consistency [Matthew McGinn] | ||
* minor fix to ROTATE_DISPLAY [Phil Wilson] | ||
* A bucket of issues fixed [Phil Wilson] | ||
* Fixes from Chris's testing. Readme. Build script. [Phil] | ||
* change amd base image [Phil Wilson] | ||
* Added amd64 support [Phil Wilson] | ||
* Removed TV control, changed entrypoint [Phil Wilson] | ||
* html fixes [Phil Wilson] | ||
* If no LAUNCH_URL is set, tries to detect local HTTP service, or displays default HTML page. [Phil Wilson] | ||
* Fixed the cursor control [Phil Wilson] | ||
* Made non-kiosk mode the default [Phil Wilson] | ||
* Added value to DISABLE_GPU setting [Phil Wilson] | ||
* Added remaining variables and rationalised the flags. [Phil Wilson] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
ARG NODEJS_VERSION="12" | ||
|
||
FROM balenalib/%%BALENA_MACHINE_NAME%%-node:${NODEJS_VERSION}-run | ||
# install required packages | ||
RUN install_packages \ | ||
chromium-browser \ | ||
rpi-chromium-mods \ | ||
libgles2-mesa \ | ||
lsb-release \ | ||
mesa-vdpau-drivers \ | ||
wget \ | ||
x11-xserver-utils \ | ||
xserver-xorg-input-evdev \ | ||
xserver-xorg-legacy \ | ||
xserver-xorg-video-fbdev \ | ||
xserver-xorg xinit \ | ||
xterm | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# install node dependencies | ||
COPY ./package.json /usr/src/app/package.json | ||
RUN JOBS=MAX npm install --unsafe-perm --production && npm cache clean --force | ||
|
||
COPY ./src /usr/src/app/ | ||
|
||
RUN mkdir -p /etc/chromium/policies | ||
RUN mkdir /etc/chromium/policies/managed | ||
COPY ./policy.json /etc/chromium/policies/managed/my_policy.json | ||
|
||
RUN chmod +x ./*.sh | ||
|
||
ENV UDEV=1 | ||
|
||
# Add chromium user | ||
RUN useradd chromium -m -s /bin/bash -G root || true && \ | ||
groupadd -r -f chromium && id -u chromium || true \ | ||
&& chown -R chromium:chromium /home/chromium || true | ||
|
||
COPY ./public-html /home/chromium | ||
|
||
# udev rule to set specific permissions | ||
RUN echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules | ||
RUN usermod -a -G audio,video,tty chromium | ||
|
||
# # Set up the audio block. This won't have any effect if the audio block is not being used. | ||
RUN curl -skL https://raw.githubusercontent.com/balenablocks/audio/master/scripts/alsa-bridge/debian-setup.sh| sh | ||
ENV PULSE_SERVER=tcp:audio:4317 | ||
|
||
# Start app | ||
CMD ["bash", "/usr/src/app/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
ARG NODEJS_VERSION="12" | ||
|
||
FROM balenalib/%%BALENA_MACHINE_NAME%%-node:${NODEJS_VERSION}-run | ||
# install required packages | ||
RUN install_packages \ | ||
chromium \ | ||
libgles2-mesa \ | ||
lsb-release \ | ||
mesa-vdpau-drivers \ | ||
wget \ | ||
x11-xserver-utils \ | ||
xserver-xorg-input-evdev \ | ||
xserver-xorg-legacy \ | ||
xserver-xorg-video-fbdev \ | ||
xserver-xorg xinit \ | ||
xterm | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# install node dependencies | ||
COPY ./package.json /usr/src/app/package.json | ||
RUN JOBS=MAX npm install --unsafe-perm --production && npm cache clean --force | ||
|
||
COPY ./src /usr/src/app/ | ||
|
||
RUN chmod +x ./*.sh | ||
|
||
ENV UDEV=1 | ||
|
||
RUN mkdir -p /etc/chromium/policies | ||
RUN mkdir -p /etc/chromium/policies/recommended | ||
COPY ./policy.json /etc/chromium/policies/recommended/my_policy.json | ||
|
||
# Add chromium user | ||
RUN useradd chromium -m -s /bin/bash -G root || true && \ | ||
groupadd -r -f chromium && id -u chromium || true \ | ||
&& chown -R chromium:chromium /home/chromium || true | ||
|
||
COPY ./public-html /home/chromium | ||
|
||
# udev rule to set specific permissions | ||
RUN echo 'SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"' > /etc/udev/rules.d/10-vchiq-permissions.rules | ||
RUN usermod -a -G audio,video,tty chromium | ||
|
||
RUN ln -s /usr/bin/chromium /usr/bin/chromium-browser || true | ||
|
||
# Set up the audio block. This won't have any effect if the audio block is not being used. | ||
RUN curl -skL https://raw.githubusercontent.com/balenablocks/audio/master/scripts/alsa-bridge/debian-setup.sh| sh | ||
ENV PULSE_SERVER=tcp:audio:4317 | ||
|
||
# Start app | ||
CMD ["bash", "/usr/src/app/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: browser | ||
description: >- | ||
a hardware accelerated web browser to present internal and external URLs on a | ||
connected display | ||
version: 1.0.1 | ||
type: sw.application | ||
assets: | ||
repository: | ||
type: blob.asset | ||
data: | ||
url: 'https://github.com/balenablocks/browser' | ||
logo: | ||
type: blob.asset | ||
data: | ||
url: 'https://raw.githubusercontent.com/balenablocks/browser/master/logo.png' | ||
data: | ||
defaultDeviceType: raspberrypi3 | ||
supportedDeviceTypes: | ||
- raspberrypi4-64 | ||
- fincm3 | ||
- raspberrypi3 | ||
- raspberrypi3-64 | ||
- raspberrypi400-64 | ||
- intel-nuc | ||
- genericx86-64-ext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,57 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
function build_and_push_image () { | ||
BLOCK_NAME="browser" | ||
|
||
function build_image () { | ||
local DOCKER_REPO=$1 | ||
local BALENA_MACHINE_NAME=$2 | ||
local DOCKER_ARCH=$3 | ||
local DOCKERFILE_DIR=./generic | ||
|
||
echo "Building for machine name $BALENA_MACHINE_NAME, platform $DOCKER_ARCH, pushing to $DOCKER_REPO/$BLOCK_NAME" | ||
|
||
# The RPIs all use the same dockerfile for now | ||
if [[ $BALENA_MACHINE_NAME = raspberry* ]]; then | ||
DOCKERFILE_DIR=./rpi | ||
sed "s/%%BALENA_MACHINE_NAME%%/$BALENA_MACHINE_NAME/g" ./Dockerfile.raspberrypi > ./Dockerfile.$BALENA_MACHINE_NAME | ||
else | ||
sed "s/%%BALENA_MACHINE_NAME%%/$BALENA_MACHINE_NAME/g" ./Dockerfile.template > ./Dockerfile.$BALENA_MACHINE_NAME | ||
fi | ||
|
||
docker buildx build -t $DOCKER_REPO/$BLOCK_NAME:$BALENA_MACHINE_NAME --push --platform $DOCKER_ARCH --file Dockerfile.$BALENA_MACHINE_NAME . | ||
|
||
echo "Building for machine name $BALENA_MACHINE_NAME, platform $DOCKER_ARCH using dockerfile from $DOCKERFILE_DIR, pushing to $DOCKER_REPO/browser" | ||
|
||
sed "s/%%BALENA_MACHINE_NAME%%/$BALENA_MACHINE_NAME/g" $DOCKERFILE_DIR/Dockerfile.template > ./Dockerfile.$BALENA_MACHINE_NAME | ||
docker buildx build -t $DOCKER_REPO/browser:$BALENA_MACHINE_NAME --platform $DOCKER_ARCH --file Dockerfile.$BALENA_MACHINE_NAME . | ||
|
||
echo "Publishing..." | ||
docker push $DOCKER_REPO/browser:$BALENA_MACHINE_NAME | ||
|
||
echo "Cleaning up..." | ||
echo "Cleaning up temporary dockerfiles..." | ||
rm Dockerfile.$BALENA_MACHINE_NAME | ||
} | ||
|
||
function retag_and_push_image () { | ||
function retag_image () { | ||
local DOCKER_REPO=$1 | ||
local BUILT_TAG=$2 | ||
local NEW_TAG=$3 | ||
|
||
echo "Taging $DOCKER_REPO/browser:$BUILT_TAG as $DOCKER_REPO/browser:$NEW_TAG" | ||
docker tag $DOCKER_REPO/browser:$BUILT_TAG $DOCKER_REPO/browser:$NEW_TAG | ||
echo "Taging $DOCKER_REPO/$BLOCK_NAME:$BUILT_TAG as $DOCKER_REPO/$BLOCK_NAME:$NEW_TAG" | ||
docker tag $DOCKER_REPO/$BLOCK_NAME:$BUILT_TAG $DOCKER_REPO/$BLOCK_NAME:$NEW_TAG | ||
|
||
echo "Publishing..." | ||
docker push $DOCKER_REPO/browser:$NEW_TAG | ||
# echo "Publishing..." | ||
docker push $DOCKER_REPO/$BLOCK_NAME:$NEW_TAG | ||
} | ||
|
||
function create_and_push_manifest() { | ||
local DOCKER_REPO=$1 | ||
docker manifest rm $DOCKER_REPO/$BLOCK_NAME:latest || true | ||
docker manifest create $DOCKER_REPO/$BLOCK_NAME:latest --amend $DOCKER_REPO/$BLOCK_NAME:raspberrypi3 --amend $DOCKER_REPO/$BLOCK_NAME:raspberrypi4-64 --amend $DOCKER_REPO/$BLOCK_NAME:genericx86-64-ext | ||
docker manifest annotate --arch arm64 $DOCKER_REPO/$BLOCK_NAME:latest $DOCKER_REPO/$BLOCK_NAME:raspberrypi4-64 | ||
docker manifest annotate --variant v8 $DOCKER_REPO/$BLOCK_NAME:latest $DOCKER_REPO/$BLOCK_NAME:raspberrypi4-64 | ||
docker manifest push $DOCKER_REPO/$BLOCK_NAME:latest | ||
} | ||
|
||
# YOu can pass in a repo (such as a test docker repo) or accept the default | ||
DOCKER_REPO=${1:-balenablocks} | ||
|
||
#RPI4 is built as ARMv7 because the base Raspian image is 32-bit | ||
build_and_push_image $DOCKER_REPO "raspberrypi3" "linux/arm/v7" | ||
|
||
#only need to build once per arch, and retag & push for clones | ||
retag_and_push_image $DOCKER_REPO "raspberrypi3" "raspberrypi4-64" | ||
retag_and_push_image $DOCKER_REPO "raspberrypi3" "raspberrypi3-64" | ||
retag_and_push_image $DOCKER_REPO "raspberrypi3" "fincm3" | ||
build_image $DOCKER_REPO "raspberrypi3" "linux/arm/v7" | ||
#RPI4 is built as ARMv7 because there are currently (jan 2021) no 64-bit chromium sources from RPI | ||
retag_image $DOCKER_REPO "raspberrypi3" "raspberrypi4-64" | ||
|
||
build_image $DOCKER_REPO "genericx86-64-ext" "linux/amd64" | ||
|
||
build_and_push_image $DOCKER_REPO "genericx86-64-ext" "linux/amd64" | ||
create_and_push_manifest $DOCKER_REPO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '2' | ||
|
||
volumes: | ||
settings: # Only required if using PERSISTENT flag (see below) | ||
|
||
services: | ||
|
||
browser: | ||
image: balenablocks/browser | ||
privileged: true # required for UDEV to find plugged in peripherals such as a USB mouse | ||
network_mode: host | ||
volumes: | ||
- 'settings:/data' # Only required if using PERSISTENT flag (see below) |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "browserV2", | ||
"version": "0.0.1", | ||
"description": "balenaBlock that provides a chromium browser wrapped in some balena genius", | ||
"main": "index.js", | ||
"scripts": { | ||
|
||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/balenablocks/browser.git" | ||
}, | ||
"keywords": [ | ||
"balena", | ||
"browser", | ||
"chromium" | ||
], | ||
"author": "Phil Wilson <[email protected]>", | ||
"license": "Apache-2.0", | ||
"jshintConfig": { | ||
"esversion": 8 | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/balenablocks/browser/issues" | ||
}, | ||
"homepage": "https://github.com/balenablocks/browser#readme", | ||
"dependencies": { | ||
"chrome-launcher": "^0.13.4", | ||
"body-parser": "^1.19.0", | ||
"compression": "^1.7.4", | ||
"dateformat": "^3.0.3", | ||
"debug": "^4.1.1", | ||
"express": "^4.17.1", | ||
"bent": "7.3.10", | ||
"set-interval-async": "^1.0.34" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"HomepageLocation": "www.balea.io", | ||
"ExtensionInstallForcelist": [ | ||
"aleakchihdccplidncghkekgioiakgal", | ||
"cfhdojbkjhnklbpkdaibdccddilifddb" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test the integration with the audio block? If not let me know and I can do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tmigone I haven't yet. If you wouldn't mind testing the block in general, and the audio link specifically, that would be much appreciated.