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

Add swap file adjustment for webapp build #2204

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a4a94af
adjust swapfile if memory is too low
AlvinSchiller Jan 4, 2024
ba3c959
add option for webapp build
AlvinSchiller Jan 4, 2024
d791cd4
update ci tests
AlvinSchiller Jan 4, 2024
9ffa1cc
Update run_install_webapp_local.sh
AlvinSchiller Jan 4, 2024
0f7c5d2
update ENABLE_WEBAPP_BUILD handling
AlvinSchiller Jan 4, 2024
3d36eae
updated logging
AlvinSchiller Jan 4, 2024
3cc5e98
add build webapp test workflow
AlvinSchiller Jan 4, 2024
1c08a3e
fix path
AlvinSchiller Jan 4, 2024
f499106
fix actions
AlvinSchiller Jan 4, 2024
b70bc5c
fix: add shell
AlvinSchiller Jan 4, 2024
c5d97e0
fix trigger path
AlvinSchiller Jan 4, 2024
8073f08
adjust node mem calculation
AlvinSchiller Jan 4, 2024
141b1d9
use shell script for builds
AlvinSchiller Jan 4, 2024
80db8b7
add env CI
AlvinSchiller Jan 4, 2024
44653ee
use new action for release build
AlvinSchiller Jan 4, 2024
c46755d
adjusted min sizes
AlvinSchiller Jan 4, 2024
4951906
remove obsolete code
AlvinSchiller Jan 4, 2024
02fe4b3
update workflow name
AlvinSchiller Jan 4, 2024
2fb017f
move update dependencies entirely to rebuild script. update docs
AlvinSchiller Jan 4, 2024
1394416
move existing build folder to backup. update docs
AlvinSchiller Jan 4, 2024
4d0158a
increase swap with lower step size. minor fixes
AlvinSchiller Jan 4, 2024
c592718
refactor vars and logging. added verbose param.
AlvinSchiller Jan 4, 2024
d820e0b
update logging
AlvinSchiller Jan 4, 2024
709d57d
fix indentation
AlvinSchiller Jan 4, 2024
1059e89
update logging. moved NODEMEM check
AlvinSchiller Jan 4, 2024
a973051
refactor webapp build during installation
AlvinSchiller Jan 4, 2024
214b7d2
Update docs
AlvinSchiller Jan 5, 2024
88a2881
Update messages
AlvinSchiller Jan 5, 2024
29a1d7b
harmonize webapp wording
AlvinSchiller Jan 5, 2024
1ea3557
fix flake8
AlvinSchiller Jan 5, 2024
6cac516
fix flake8
AlvinSchiller Jan 5, 2024
69bc825
update node installation.
AlvinSchiller Jan 6, 2024
d009b4e
update docs
AlvinSchiller Jan 6, 2024
0f79d24
ci add platform linux/armv6 (deactivated)
AlvinSchiller Jan 5, 2024
0b19323
reverted to https://deb.nodesource.com/ installation
AlvinSchiller Jan 6, 2024
72e7d0f
update docs
AlvinSchiller Jan 6, 2024
2d6e6ac
align fin message
AlvinSchiller Jan 6, 2024
0f4652b
Update docs. Remove full URL references to branch
AlvinSchiller Jan 8, 2024
b952957
ignore stderr if node is not installed before
AlvinSchiller Jan 8, 2024
86eebc0
ignore stderr if node is not installed before
AlvinSchiller Jan 8, 2024
cdff8fa
bugfix. removed additional char
AlvinSchiller Jan 8, 2024
4c0c18d
add npm project config
AlvinSchiller Jan 12, 2024
e6109c3
use performance optimized install command
AlvinSchiller Jan 12, 2024
a5f3642
Update docs
AlvinSchiller Jan 12, 2024
4c6f01b
also raise fetch-retry-mintimeout
AlvinSchiller Jan 12, 2024
285b623
update docs
AlvinSchiller Jan 12, 2024
8ab712e
add note for webserver restart
AlvinSchiller Jan 12, 2024
e180ea3
update installation docs. add bullet list
AlvinSchiller Jan 12, 2024
1f33e41
change npm config values
AlvinSchiller Jan 12, 2024
7def653
show "slow hardware message" at installation start
AlvinSchiller Jan 12, 2024
ddc623f
update armv6l warning for webapp rebuild
AlvinSchiller Jan 12, 2024
e91bce6
make script return value more clear
AlvinSchiller Jan 12, 2024
f6e323c
Make local webapp build an optional step
AlvinSchiller Jan 12, 2024
6551669
use prebuilt webapp bundle also for develop
AlvinSchiller Jan 12, 2024
fa98ccc
update docs
AlvinSchiller Jan 12, 2024
bccc95c
Update webapp.md
pabera Jan 13, 2024
1e8952e
Update customize_options.sh (typos)
pabera Jan 13, 2024
f00eb32
Update installation.md
pabera Jan 13, 2024
6b14951
Update system.md
pabera Jan 13, 2024
3d0aeca
Update installation.md
pabera Jan 13, 2024
7e314e7
Update webapp.md
pabera Jan 13, 2024
9edaa5f
Update customize_options.sh
pabera Jan 13, 2024
5e65478
change npm config values
AlvinSchiller Jan 13, 2024
319ed22
update docs
AlvinSchiller Jan 13, 2024
c1743bc
update welcome to match changes in wiki
AlvinSchiller Jan 13, 2024
b22586a
update rebuild message
AlvinSchiller Jan 13, 2024
97a076b
Add doc links
AlvinSchiller Jan 13, 2024
6f8f228
update ignorefiles for build.bak
AlvinSchiller Jan 14, 2024
0edcb78
Update doc and link for constributors
AlvinSchiller Jan 14, 2024
36c65e2
Update CONTRIBUTING.md
pabera Jan 14, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ shared
src/webapp/node_modules
src/webapp/npm-debug.log
src/webapp/build
src/webapp/build.bak
6 changes: 3 additions & 3 deletions .githooks/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# TO ACTIVATE: cp .githooks/post-merge .git/hooks/.
#
# Checks:
# - Changes to web app
# - Changes to Web App
# - Changes to web dependency
# - Changes to python requirements
#
Expand All @@ -20,7 +20,7 @@ warn_npm_dependency() {
echo "************************************************************"
echo "ATTENTION: npm dependencies have changed since last pull!"
echo ""
echo "To update dependencies and rebuilt WebApp run:"
echo "To update dependencies and rebuilt Web App run:"
echo "$ cd src/webapp && ./run_rebuild.sh -u"
echo "************************************************************"
echo -e "\n"
Expand All @@ -31,7 +31,7 @@ warn_webapp() {
echo "************************************************************"
echo "ATTENTION: Web App sources have changed since last pull!"
echo ""
echo "To rebuilt the WebApp run:"
echo "To rebuilt the Web App run:"
echo "$ cd src/webapp && ./run_rebuild.sh"
echo "************************************************************"
echo -e "\n"
Expand Down
25 changes: 25 additions & 0 deletions .github/actions/build-webapp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Web App
description: 'Build Web App with Node'
inputs:
webapp-root-path:
description: 'root path of the Web App sources'
required: false
default: './src/webapp'
outputs:
webapp-root-path:
description: 'used root path of the Web App sources'
value: ${{ inputs.webapp-root-path }}

runs:
using: "composite"
steps:
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: run build
working-directory: ${{ inputs.webapp-root-path }}
shell: bash
env:
CI: false
run: ./run_rebuild.sh -u
28 changes: 8 additions & 20 deletions .github/workflows/bundle_webapp_and_release_v3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bundle Webapp and Release
name: Bundle Web App and Release

on:
push:
Expand All @@ -18,7 +18,7 @@ jobs:
check_abort: ${{ steps.vars.outputs.check_abort }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Output vars
id: vars
Expand Down Expand Up @@ -72,9 +72,6 @@ jobs:
if: ${{ needs.check.outputs.check_abort == 'false' }}
runs-on: ubuntu-latest

env:
WEBAPP_ROOT_PATH: ./src/webapp

outputs:
tag_name: ${{ needs.check.outputs.tag_name }}
release_type: ${{ needs.check.outputs.release_type }}
Expand All @@ -83,7 +80,7 @@ jobs:
webapp_bundle_name_latest: ${{ steps.vars.outputs.webapp_bundle_name_latest }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Output vars
id: vars
Expand All @@ -94,29 +91,20 @@ jobs:
echo "webapp_bundle_name=webapp-build-${COMMIT_SHA:0:10}.tar.gz" >> $GITHUB_OUTPUT
echo "webapp_bundle_name_latest=webapp-build-latest.tar.gz" >> $GITHUB_OUTPUT

- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: npm install
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
run: npm install
- name: npm build
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
env:
CI: false
run: npm run build
- name: Build Web App
id: build-webapp
uses: ./.github/actions/build-webapp

- name: Create Bundle
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
working-directory: ${{ steps.build-webapp.outputs.webapp-root-path }}
run: |
tar -czvf ${{ steps.vars.outputs.webapp_bundle_name }} build

- name: Artifact Upload
uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.webapp_bundle_name }}
path: ${{ env.WEBAPP_ROOT_PATH }}/${{ steps.vars.outputs.webapp_bundle_name }}
path: ${{ steps.build-webapp.outputs.webapp-root-path }}/${{ steps.vars.outputs.webapp_bundle_name }}
retention-days: 5

release:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test_build_webapp_v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test Build Web App v3

on:
schedule:
# run at 18:00 every sunday
- cron: '0 18 * * 0'
push:
branches:
- 'future3/**'
paths:
- '.github/workflows/test_build_webapp_v3.yml'
- '.github/actions/build-webapp/**'
- 'src/webapp/**'
pull_request:
# The branches below must be a subset of the branches above
branches:
- future3/develop
- future3/main
paths:
- '.github/workflows/test_build_webapp_v3.yml'
- '.github/actions/build-webapp/**'
- 'src/webapp/**'

jobs:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build Web App
uses: ./.github/actions/build-webapp
9 changes: 7 additions & 2 deletions .github/workflows/test_docker_debian_codename_sub_v3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Subworkflow Test Install Scripts Debian V3
name: Subworkflow Test Install Scripts Debian v3

on:
workflow_call:
Expand Down Expand Up @@ -46,6 +46,7 @@ jobs:
cache_key: ${{ steps.vars.outputs.cache_key }}
image_file_name: ${{ steps.vars.outputs.image_file_name }}
image_tag_name: ${{ steps.vars.outputs.image_tag_name }}
docker_run_options: ${{ steps.vars.outputs.docker_run_options }}

# create local docker registry to use locally build images
services:
Expand Down Expand Up @@ -83,13 +84,17 @@ jobs:
id: vars
env:
LOCAL_REGISTRY_PORT: ${{ inputs.local_registry_port }}
PLATFORM: ${{ inputs.platform }}
run: |
echo "image_tag_name=${{ steps.pre-vars.outputs.image_tag_name }}" >> $GITHUB_OUTPUT
echo "image_tag_name_local_base=localhost:${{ env.LOCAL_REGISTRY_PORT }}/${{ steps.pre-vars.outputs.image_tag_name }}-base" >> $GITHUB_OUTPUT
echo "image_file_name=${{ steps.pre-vars.outputs.image_file_name }}" >> $GITHUB_OUTPUT
echo "image_file_path=./${{ steps.pre-vars.outputs.image_file_name }}" >> $GITHUB_OUTPUT
echo "cache_scope=${{ steps.pre-vars.outputs.cache_scope }}" >> $GITHUB_OUTPUT
echo "cache_key=${{ steps.pre-vars.outputs.cache_scope }}-${{ github.sha }}#${{ github.run_attempt }}" >> $GITHUB_OUTPUT
if [ "${{ env.PLATFORM }}" == "linux/arm/v6" ] ; then
echo "docker_run_options=-e QEMU_CPU=arm1176" >> $GITHUB_OUTPUT
fi

# Build base image for debian version name. Layers will be cached and image pushes to local registry
- name: Build Image - Base
Expand Down Expand Up @@ -167,7 +172,7 @@ jobs:
uses: tj-actions/docker-run@v2
with:
image: ${{ needs.build.outputs.image_tag_name }}
options: --platform ${{ inputs.platform }} --user ${{ env.TEST_USER_NAME }} --init
options: ${{ needs.build.outputs.docker_run_options }} --platform ${{ inputs.platform }} --user ${{ env.TEST_USER_NAME }} --init
name: ${{ matrix.test_script }}
args: |
./${{ matrix.test_script }}
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/test_docker_debian_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,25 @@ jobs:
debian_codename: 'bookworm'
platform: linux/arm/v7

# # can be activate on test branches, currently failing
# run_bookworm_armv6:
# name: 'bookworm armv6'
# uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
# with:
# debian_codename: 'bookworm'
# platform: linux/arm/v6

run_bullseye_armv7:
name: 'bullseye armv7'
uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
with:
debian_codename: 'bullseye'
platform: linux/arm/v7

# # can be activate on test branches, currently failing
# run_bullseye_armv6:
# name: 'bullseye armv6'
# uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
# with:
# debian_codename: 'bullseye'
# platform: linux/arm/v6
37 changes: 16 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@ as local, temporary scratch areas.

Contributors have played a bigger role over time to keep Phoniebox on the edge of innovation :)

We want to keep it as easy as possible to contribute changes that get things working in your environment.
There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
Our goal is to make it simple for you to contribute changes that improve functionality in your specific environment.
To achieve this, we have a set of guidelines that we kindly request contributors to adhere to.
These guidelines help us maintain a streamlined process and stay on top of incoming contributions.

Development for Version 3 is done on the git branch `future3/develop`. How to move to that branch, see below.
To report bug fixes and improvements, please follow the steps outlined below:
1. For bug fixes and minor improvements, simply open a new issue or pull request (PR).
2. If you intend to port a feature from Version 2.x to future3 or wish to implement a new feature, we recommend reaching out to us beforehand.
- In such cases, please create an issue outlining your plans and intentions.
- We will ensure that there are no ongoing efforts on the same topic.

For bug fixes and improvements just open an issue or PR as described below. If you plan to port a feature from Version 2.X or implement a new feature, it is advisable to contact us first. In this case, also open an issue describing what you are planning to do. We will just check that nobody else is already on the subject. We are looking forward to your work. Check the current [feature list](https://rpi-jukebox-rfid.readthedocs.io/en/latest/featurelist.html) for available features and work in progress.
We eagerly await your contributions! You can review the current [feature list](documentation/developers/status.md) to check for available features and ongoing work.

## Getting Started

Expand All @@ -60,31 +65,21 @@ For bug fixes and improvements just open an issue or PR as described below. If y
Version 2 will continue to live for quite a while.
* Clearly describe the issue including steps to reproduce when it is a bug
* Make sure you fill in the earliest version that you know has the issue
* By default this will get you to the `future3/main` branch. You will move to the `future3/develop` branch, do this:

~~~bash
cd ~/RPi-Jukebox-RFID
git checkout future3/develop
git fetch origin
git reset --hard origin/future3/develop
git pull
~~~

The preferred way of code contributions are [pull requests (follow this link for a small howto)](https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github).
And, ideally pull requests use the "running code" on the `future3/develop` branch of your Phoniebox.
And ideally pull requests use the "running code" of your Phoniebox.
Alternatively, feel free to post tweaks, suggestions and snippets in the ["issues" section](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues).

## Making Changes

* Create a fork of this repository
* Create a topic branch from where you want to base your work.
* This is usually the master branch or the develop branch.
* Only target release branches if you are certain your fix must be on that
* This is usually the `future3/develop` branch.
* Only target the `future3/main` branch if you are certain your fix must be on that
branch.
* To quickly create a topic branch based on master, run `git checkout -b
fix/master/my_contribution master`. Please avoid working directly on the
`master` branch.
* Make commits of logical and atomic units.
* Check for unnecessary whitespace with `git diff --check` before committing.
* See also the [documentation for developers](documentation/developers/README.md)

## Making Trivial Changes

Expand Down Expand Up @@ -168,8 +163,8 @@ The original contributor will be notified of the revert.

## Guidelines

* Phoniebox runs on Raspian **Buster**. Therefore, all Python code should work at least with **Python 3.7**.
* For GPIO all code should work with **RPi.GPIO**. gpiozero is currently not intended to use.
* Phoniebox runs on Raspberry Pi OS.
* Minimum python version is currently **Python 3.9**.

## Additional Resources

Expand Down
2 changes: 1 addition & 1 deletion ci/installation/run_install_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=true
# n - setup rfid reader
# y - setup samba
# y - setup webapp
# - - install node (forced WebApp Download)
# - - build webapp (skipped due to forced webapp Download)
# n - setup kiosk mode
# n - reboot

Expand Down
2 changes: 1 addition & 1 deletion ci/installation/run_install_faststartup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}"
# n - setup rfid reader
# n - setup samba
# n - setup webapp
# - - install node (only with webapp = y)
# - - build webapp (only with webapp = y)
# - - setup kiosk mode (only with webapp = y)
# n - reboot

Expand Down
2 changes: 1 addition & 1 deletion ci/installation/run_install_libzmq_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export BUILD_LIBZMQ_WITH_DRAFTS_ON_DEVICE=true
# n - setup rfid reader
# n - setup samba
# n - setup webapp
# - - install node (only with webapp = y)
# - - build webapp (only with webapp = y)
# - - setup kiosk mode (only with webapp = y)
# n - reboot

Expand Down
4 changes: 2 additions & 2 deletions ci/installation/run_install_webapp_download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Used e.g. for tests on Docker

# Objective:
# Test for the WebApp (download) and dependent features path.
# Test for the Web App (download) and dependent features path.

SOURCE="${BASH_SOURCE[0]}"
SCRIPT_DIR="$(dirname "$SOURCE")"
Expand All @@ -22,7 +22,7 @@ LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}"
# n - setup rfid reader
# n - setup samba
# y - setup webapp
# n - install node
# n - build webapp
# y - setup kiosk mode
# n - reboot

Expand Down
4 changes: 2 additions & 2 deletions ci/installation/run_install_webapp_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Used e.g. for tests on Docker

# Objective:
# Test for the WebApp (build locally) and dependent features path.
# Test for the Web App (build locally) and dependent features path.

SOURCE="${BASH_SOURCE[0]}"
SCRIPT_DIR="$(dirname "$SOURCE")"
Expand All @@ -23,7 +23,7 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=false
# n - setup rfid reader
# n - setup samba
# y - setup webapp
# y - install node
# y - build webapp
# y - setup kiosk mode
# n - reboot

Expand Down
8 changes: 4 additions & 4 deletions documentation/builders/autohotspot.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Auto-Hotspot function allows the Jukebox to switch between its
connection between a known WiFi and an automatically generated hotspot
so that you can still access via SSH or Webapp.
so that you can still access via SSH or Web App.

> [!IMPORTANT]
> Please configure the WiFi connection to your home access point before enabling these feature!
Expand All @@ -17,10 +17,10 @@ hotspot named `Phoniebox_Hotspot`. You will be able to connect to this
hotspot using the given password in the installation or the default
password: `PlayItLoud!`

### Webapp
### Web App

After connecting to the `Phoniebox_Hotspot` you are able to connect to
the webapp accessing the website [10.0.0.5](http://10.0.0.5/).
the Web App accessing the website [10.0.0.5](http://10.0.0.5/).

### ssh

Expand Down Expand Up @@ -69,7 +69,7 @@ ieee80211d=1

## Disabling automatism

Auto-Hotspot can be enabled or disabled using the Webapp.
Auto-Hotspot can be enabled or disabled using the Web App.

> [!IMPORTANT]
> Disabling or enabling will keep the last state.
Expand Down
Loading