Skip to content
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 47 commits into from
Apr 6, 2021
Merged

V2 #46

Show file tree
Hide file tree
Changes from 12 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 Dec 16, 2020
e0dd0ef
Many changes
phil-d-wilson Dec 17, 2020
dcf08f4
display rotation & cursor control added
phil-d-wilson Dec 17, 2020
ad34707
Added FLAGS option
phil-d-wilson Dec 17, 2020
717aecd
Implemented service discovery and default flags
phil-d-wilson Dec 21, 2020
4fc186e
RPI dockerfile + fixes
phil-d-wilson Jan 4, 2021
87f3a10
Readme and API endpoint changes
phil-d-wilson Jan 4, 2021
97ddb7a
readme tweaks
phil-d-wilson Jan 5, 2021
59f5113
Fixed kiosk bug. Removed sandbox warning dialogue
phil-d-wilson Jan 5, 2021
97e68c3
Fixes and API features
phil-d-wilson Jan 10, 2021
9e8b3b1
readme fixes
phil-d-wilson Jan 11, 2021
1571a09
Latest
phil-d-wilson Jan 28, 2021
d0b4140
hub meta
phil-d-wilson Jan 29, 2021
ac32efa
Merge pull request #47 from balenablocks/hub
phil-d-wilson Jan 29, 2021
feae1c4
logo
phil-d-wilson Feb 1, 2021
72859d6
Update balena.yml
phil-d-wilson Feb 2, 2021
7095a7b
post-review changes
phil-d-wilson Feb 2, 2021
2a3de83
gitignore trim
phil-d-wilson Feb 2, 2021
e15db43
Move to node 12
phil-d-wilson Feb 5, 2021
c85eedc
meta: add versionist
tmigone Feb 25, 2021
91afc91
Merge pull request #49 from balenablocks/add-versionist
tmigone Feb 25, 2021
8db9048
v1.0.0
balena-ci Feb 25, 2021
b7b7455
meta: run versionist to update balena.yml version
tmigone Mar 1, 2021
2c3b819
Merge pull request #50 from balenablocks/balena-yml-version
Mar 1, 2021
4676a02
v1.0.1
balena-ci Mar 1, 2021
36fd686
build changes
phil-d-wilson Mar 23, 2021
b6dd417
patch: Window size fix and build script bug
phil-d-wilson Apr 2, 2021
466d84e
patch: build script update for manifest
phil-d-wilson Apr 5, 2021
a1c82ee
First push to v2 branch
phil-d-wilson Dec 16, 2020
82d2af6
Many changes
phil-d-wilson Dec 17, 2020
2d191bb
display rotation & cursor control added
phil-d-wilson Dec 17, 2020
02fe96c
Added FLAGS option
phil-d-wilson Dec 17, 2020
53267c8
Implemented service discovery and default flags
phil-d-wilson Dec 21, 2020
1bb4fe8
RPI dockerfile + fixes
phil-d-wilson Jan 4, 2021
ffb2278
Readme and API endpoint changes
phil-d-wilson Jan 4, 2021
55d5af6
readme tweaks
phil-d-wilson Jan 5, 2021
f0f6b87
Fixed kiosk bug. Removed sandbox warning dialogue
phil-d-wilson Jan 5, 2021
83cbe7b
Fixes and API features
phil-d-wilson Jan 10, 2021
27173ae
readme fixes
phil-d-wilson Jan 11, 2021
966f513
Latest
phil-d-wilson Jan 28, 2021
9e6702d
post-review changes
phil-d-wilson Feb 2, 2021
c4f2b5d
gitignore trim
phil-d-wilson Feb 2, 2021
864bc18
Move to node 12
phil-d-wilson Feb 5, 2021
47c2315
build changes
phil-d-wilson Mar 23, 2021
b466336
patch: Window size fix and build script bug
phil-d-wilson Apr 2, 2021
6778388
patch: build script update for manifest
phil-d-wilson Apr 5, 2021
5120608
Merge branch 'V2' of https://github.com/balenablocks/browser into V2
phil-d-wilson Apr 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sha256bca9ad158da383a9af76908776cf6cd8b06359a8a1529c4862fd17fd3f2fc7b3
Dockerfile.raspberrypi3
Dockerfile.raspberrypi4-64
=
.gitignore
Dockerfile.raspberrypi3
phil-d-wilson marked this conversation as resolved.
Show resolved Hide resolved
51 changes: 51 additions & 0 deletions Dockerfile.raspberrypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ARG NODEJS_VERSION="13"

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"]
52 changes: 52 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ARG NODEJS_VERSION="13"

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 /etc/chromium/policies
RUN mkdir /etc/chromium/policies/managed
COPY ./policy.json /etc/chromium/policies/managed/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
Copy link
Contributor

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.

Copy link
Contributor Author

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.


# Start app
CMD ["bash", "/usr/src/app/start.sh"]
17 changes: 8 additions & 9 deletions build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ function build_and_push_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/browser"

# 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

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..."
Expand All @@ -39,10 +39,9 @@ function retag_and_push_image () {
# 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
build_and_push_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_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"
Expand Down
42 changes: 0 additions & 42 deletions generic/Dockerfile.template

This file was deleted.

37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"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"
}
}

7 changes: 7 additions & 0 deletions policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"HomepageLocation": "www.chromium.org",
"ExtensionInstallForcelist": [
"aleakchihdccplidncghkekgioiakgal;https://clients2.google.com/service/update2/crx",
"cfhdojbkjhnklbpkdaibdccddilifddb"
]
}
7 changes: 4 additions & 3 deletions public-html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<header class="my-auto bg-primary text-white">
<div class="container text-center ">
<h1>balenalabs-browser</h1>
<p class="lead">A primitive block for browsing HTML</p>
<p class="lead">A balena block for browsing HTML</p>
</div>
</header>

Expand All @@ -44,8 +44,9 @@ <h1>balenalabs-browser</h1>
<h2>Choosing what to display</h2>
<p class="lead">You have a few options for choosing what to display here:</p>
<ul>
<li>You can create a service on this device serving HTTP over port 80, and it'll display here automatically! **</li>
<li>You can create a service on this device serving HTTP over port 80 or 8080, or HTTPS over 443, and it'll display here automatically! **</li>
<li>You can set a Device Variable called <code>LAUNCH_URL</code></li>
<li>You can use the API on port 5011 to set the URL (see project readme for details)</li>
</ul>
<blockquote>** The balenalabs-browser service will need <code>network_mode: host</code> set.</blockquote>
</div>
Expand All @@ -56,7 +57,7 @@ <h2>Choosing what to display</h2>
<footer class="py-5 bg-dark">
<div class="container">
<p class="m-0 text-center text-white">
Copyright 2020 Balena |
Copyright 2021 Balena |
All Rights Reserved</p>
</div>
<!-- /.container -->
Expand Down
Loading