From a4a94af765b166ad392ef681c4b65108044ee2ec Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 02:15:57 +0100 Subject: [PATCH 01/70] adjust swapfile if memory is too low --- src/webapp/run_rebuild.sh | 101 ++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 32 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 870813d78..2baf6ebd8 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -32,39 +32,76 @@ SOURCE=${BASH_SOURCE[0]} SCRIPT_DIR="$(dirname "$SOURCE")" cd "$SCRIPT_DIR" || exit 1 -# Need to check free space and limit Node memory usage -# for PIs with little memory -MemTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}') -MemFree=$(grep MemFree /proc/meminfo | awk '{print $2}') -SwapFree=$(grep SwapFree /proc/meminfo | awk '{print $2}') -TotalFree=$((SwapFree + MemFree)) - -MemTotal=$((MemTotal / 1024)) -MemFree=$((MemFree / 1024)) -SwapFree=$((SwapFree / 1024)) -TotalFree=$((TotalFree / 1024)) - -echo "Total phys memory: ${MemTotal} MB" -echo "Free phys memory : ${MemFree} MB" -echo "Free swap memory : ${SwapFree} MB" -echo "Free total memory: ${TotalFree} MB" - - -if [[ -z $NODEMEM ]]; then - # Keep a buffer of minimum 20 MB - if [[ $TotalFree -gt 1044 ]]; then - NODEMEM=1024 - elif [[ $TotalFree -gt 532 ]]; then - NODEMEM=512 - elif [[ $TotalFree -gt 276 ]]; then - NODEMEM=256 - else - echo "ERROR: Not enough memory available on system. Please increase swap size to give at least 276 MByte free memory." - echo "Current free memory = $TotalFree MB" - echo "Hint: if only a little memory is missing, stopping spocon, mpd, and jukebox-daemon might give you enough space" - exit 1 +change_swap() { + local new_swap_size="$1" + sudo dphys-swapfile swapoff || return 1 + sudo sed -i "s|.*CONF_SWAPSIZE=.*|CONF_SWAPSIZE=${new_swap_size}|g" /etc/dphys-swapfile || return 1 + sudo sed -i "s|^\s*CONF_SWAPFACTOR=|#CONF_SWAPFACTOR=|g" /etc/dphys-swapfile || return 1 + sudo dphys-swapfile setup || return 1 + sudo dphys-swapfile swapon || return 1 +} + +RECURSION_BREAKER=false +calc_nodemem() { + + # Need to check free space and limit Node memory usage + # for PIs with little memory + MemTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}') + MemFree=$(grep MemFree /proc/meminfo | awk '{print $2}') + SwapFree=$(grep SwapFree /proc/meminfo | awk '{print $2}') + TotalFree=$((SwapFree + MemFree)) + + MemTotal=$((MemTotal / 1024)) + MemFree=$((MemFree / 1024)) + SwapFree=$((SwapFree / 1024)) + TotalFree=$((TotalFree / 1024)) + + echo "Total phys memory: ${MemTotal} MB" + echo "Free phys memory : ${MemFree} MB" + echo "Free swap memory : ${SwapFree} MB" + echo "Free total memory: ${TotalFree} MB" + echo "" + + if [[ -z $NODEMEM ]]; then + # Keep a buffer of minimum 20 MB + if [[ $TotalFree -gt 1044 ]]; then + NODEMEM=1024 + elif [[ $TotalFree -gt 532 ]]; then + NODEMEM=512 + elif [[ $TotalFree -gt 276 ]]; then + NODEMEM=256 + else + if [ "$RECURSION_BREAKER" == true ]; then + return 1; + fi + + local new_swap_size=532 + echo "ERROR: Not enough memory available on system." + echo "Current free memory = $TotalFree MB" + echo "Swap file will be increased to ${new_swap_size} MB" + + local filesystem_left=$((new_swap_size + 512)) + local filesystem_free=$(df -BM -P / | tail -n 1 | awk '{print $4}') + filesystem_free=${filesystem_free//M} + if [ "${filesystem_free}" -le "${filesystem_left}" ]; then + echo "ERROR: Not enough space available on filesystem. At least ${filesystem_left} MB free memory are needed." + echo "Current free space = $filesystem_free MB" + echo "Hint: if only a little memory is missing, stopping spocon, mpd, and jukebox-daemon might give you enough space" + exit 1 + else + if ! change_swap $new_swap_size ; then + echo "ERROR: failed to change swap file" + exit 1 + fi + fi + + RECURSION_BREAKER=true + calc_nodemem || return 1 + fi fi -fi +} + +calc_nodemem if [[ $NODEMEM -gt $TotalFree ]]; then echo "ERROR: Requested node memory setting is larger than available free memory: $NODEMEM MB > $TotalFree MB" From ba3c9596f6301aa64a5b3a49d7104df073243e53 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 02:17:03 +0100 Subject: [PATCH 02/70] add option for webapp build --- installation/includes/01_default_config.sh | 1 + installation/routines/customize_options.sh | 31 +++++++++++++------ installation/routines/setup_jukebox_webapp.sh | 9 ++++-- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/installation/includes/01_default_config.sh b/installation/includes/01_default_config.sh index fa1bafb61..32f391cbb 100644 --- a/installation/includes/01_default_config.sh +++ b/installation/includes/01_default_config.sh @@ -31,3 +31,4 @@ GIT_USE_SSH=${GIT_USE_SSH:-"true"} ENABLE_WEBAPP_PROD_DOWNLOAD=${ENABLE_WEBAPP_PROD_DOWNLOAD:-"release-only"} # Install Node during setup for Web App building. This is only needed for development builds ENABLE_INSTALL_NODE=${ENABLE_INSTALL_NODE:-"false"} +ENABLE_WEBAPP_BUILD=true diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index 7409a6e07..8cdba9b79 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -305,16 +305,28 @@ Do you want to install Node? [Y/n]" read -r response case "$response" in [nN][oO]|[nN]) - ENABLE_INSTALL_NODE=false - ENABLE_WEBAPP_PROD_DOWNLOAD=true - ;; + ENABLE_INSTALL_NODE=false + ENABLE_WEBAPP_PROD_DOWNLOAD=true + ;; *) - # This message will be displayed at the end of the installation process - local tmp_fin_message="ATTENTION: You need to build the web app locally with - $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u - This must be done after reboot, due to memory restrictions. - Read the documentation regarding local Web App builds!" - FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" + print_c "Building the webapp takes some time. +This can be done now or manually later on. + +Do you want to build the webapp now? [Y/n]" + read -r response + case "$response" in + [nN][oO]|[nN]) + ENABLE_WEBAPP_BUILD=false + # This message will be displayed at the end of the installation process + local tmp_fin_message="ATTENTION: You need to build the web app locally with + $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u + This must be done after reboot, due to memory restrictions. + Read the documentation regarding local Web App builds!" + FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" + ;; + *) + ;; + esac ;; esac fi @@ -323,6 +335,7 @@ Do you want to install Node? [Y/n]" log "ENABLE_INSTALL_NODE=${ENABLE_INSTALL_NODE}" if [ "$ENABLE_INSTALL_NODE" != true ]; then log "ENABLE_WEBAPP_PROD_DOWNLOAD=${ENABLE_WEBAPP_PROD_DOWNLOAD}" + log "ENABLE_WEBAPP_BUILD=${ENABLE_WEBAPP_BUILD}" fi } diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index 2884f18cb..601c2daf7 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -102,6 +102,9 @@ _jukebox_webapp_check() { fi if [[ $ENABLE_INSTALL_NODE == true ]] ; then verify_apt_packages nodejs + if [[ $ENABLE_WEBAPP_BUILD == true ]] ; then + verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" + fi fi verify_apt_packages nginx @@ -116,9 +119,9 @@ _run_setup_jukebox_webapp() { fi if [[ $ENABLE_INSTALL_NODE == true ]] ; then _jukebox_webapp_install_node - # Local Web App build during installation does not work at the moment - # Needs to be done after reboot! There will be a message at the end of the installation process - # _jukebox_webapp_build + if [[ $ENABLE_WEBAPP_BUILD == true ]] ; then + _jukebox_webapp_build + fi fi _jukebox_webapp_register_as_system_service_with_nginx _jukebox_webapp_check From d791cd4c309caa3169d443c890c8f3f07ef736ac Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 02:17:19 +0100 Subject: [PATCH 03/70] update ci tests --- ci/installation/run_install_common.sh | 1 + ci/installation/run_install_faststartup.sh | 1 + ci/installation/run_install_libzmq_local.sh | 1 + ci/installation/run_install_webapp_download.sh | 1 + ci/installation/run_install_webapp_local.sh | 2 ++ 5 files changed, 6 insertions(+) diff --git a/ci/installation/run_install_common.sh b/ci/installation/run_install_common.sh index 3d4c59778..d5cce5321 100644 --- a/ci/installation/run_install_common.sh +++ b/ci/installation/run_install_common.sh @@ -25,6 +25,7 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=true # y - setup samba # y - setup webapp # - - install node (forced WebApp Download) +# - - build webapp (only with install node = y) # n - setup kiosk mode # n - reboot diff --git a/ci/installation/run_install_faststartup.sh b/ci/installation/run_install_faststartup.sh index 249d78ffc..8155b7b02 100644 --- a/ci/installation/run_install_faststartup.sh +++ b/ci/installation/run_install_faststartup.sh @@ -23,6 +23,7 @@ LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}" # n - setup samba # n - setup webapp # - - install node (only with webapp = y) +# - - build webapp (only with install node = y) # - - setup kiosk mode (only with webapp = y) # n - reboot diff --git a/ci/installation/run_install_libzmq_local.sh b/ci/installation/run_install_libzmq_local.sh index aa3726b2f..2ffed83bd 100644 --- a/ci/installation/run_install_libzmq_local.sh +++ b/ci/installation/run_install_libzmq_local.sh @@ -24,6 +24,7 @@ export BUILD_LIBZMQ_WITH_DRAFTS_ON_DEVICE=true # n - setup samba # n - setup webapp # - - install node (only with webapp = y) +# - - build webapp (only with install node = y) # - - setup kiosk mode (only with webapp = y) # n - reboot diff --git a/ci/installation/run_install_webapp_download.sh b/ci/installation/run_install_webapp_download.sh index 698e057b9..bdef5a047 100644 --- a/ci/installation/run_install_webapp_download.sh +++ b/ci/installation/run_install_webapp_download.sh @@ -23,6 +23,7 @@ LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}" # n - setup samba # y - setup webapp # n - install node +# - - build webapp (only with install node = y) # y - setup kiosk mode # n - reboot diff --git a/ci/installation/run_install_webapp_local.sh b/ci/installation/run_install_webapp_local.sh index 917f985af..5683e9c30 100644 --- a/ci/installation/run_install_webapp_local.sh +++ b/ci/installation/run_install_webapp_local.sh @@ -24,6 +24,7 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=false # n - setup samba # y - setup webapp # y - install node +# n - build webapp # y - setup kiosk mode # n - reboot @@ -37,6 +38,7 @@ n n y y +n y n ' From 9ffa1cc4ea5d868f167751cd4881b0f4496197c5 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 02:23:44 +0100 Subject: [PATCH 04/70] Update run_install_webapp_local.sh --- ci/installation/run_install_webapp_local.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/installation/run_install_webapp_local.sh b/ci/installation/run_install_webapp_local.sh index 5683e9c30..98c85a832 100644 --- a/ci/installation/run_install_webapp_local.sh +++ b/ci/installation/run_install_webapp_local.sh @@ -24,7 +24,7 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=false # n - setup samba # y - setup webapp # y - install node -# n - build webapp +# y - build webapp # y - setup kiosk mode # n - reboot @@ -38,7 +38,7 @@ n n y y -n +y y n ' From 0f7c5d278b99893be83f0fe8694f5ae59ddae8f8 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 08:33:36 +0100 Subject: [PATCH 05/70] update ENABLE_WEBAPP_BUILD handling --- installation/includes/01_default_config.sh | 2 +- installation/routines/customize_options.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/installation/includes/01_default_config.sh b/installation/includes/01_default_config.sh index 32f391cbb..b5d49c3a4 100644 --- a/installation/includes/01_default_config.sh +++ b/installation/includes/01_default_config.sh @@ -31,4 +31,4 @@ GIT_USE_SSH=${GIT_USE_SSH:-"true"} ENABLE_WEBAPP_PROD_DOWNLOAD=${ENABLE_WEBAPP_PROD_DOWNLOAD:-"release-only"} # Install Node during setup for Web App building. This is only needed for development builds ENABLE_INSTALL_NODE=${ENABLE_INSTALL_NODE:-"false"} -ENABLE_WEBAPP_BUILD=true +ENABLE_WEBAPP_BUILD=false diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index 8cdba9b79..d771611cd 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -309,8 +309,9 @@ Do you want to install Node? [Y/n]" ENABLE_WEBAPP_PROD_DOWNLOAD=true ;; *) - print_c "Building the webapp takes some time. -This can be done now or manually later on. + print_c " +Building the webapp locally takes some time. +This can be done now or manually after the installation. Do you want to build the webapp now? [Y/n]" read -r response @@ -320,11 +321,11 @@ Do you want to build the webapp now? [Y/n]" # This message will be displayed at the end of the installation process local tmp_fin_message="ATTENTION: You need to build the web app locally with $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u - This must be done after reboot, due to memory restrictions. Read the documentation regarding local Web App builds!" FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" ;; *) + ENABLE_WEBAPP_BUILD=true ;; esac ;; From 3d36eae2c4f93bc5162b5031d290896f5f4ebb74 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 09:11:27 +0100 Subject: [PATCH 06/70] updated logging --- installation/routines/customize_options.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index d771611cd..b492e8a64 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -334,10 +334,8 @@ Do you want to build the webapp now? [Y/n]" fi log "ENABLE_INSTALL_NODE=${ENABLE_INSTALL_NODE}" - if [ "$ENABLE_INSTALL_NODE" != true ]; then - log "ENABLE_WEBAPP_PROD_DOWNLOAD=${ENABLE_WEBAPP_PROD_DOWNLOAD}" - log "ENABLE_WEBAPP_BUILD=${ENABLE_WEBAPP_BUILD}" - fi + log "ENABLE_WEBAPP_BUILD=${ENABLE_WEBAPP_BUILD}" + log "ENABLE_WEBAPP_PROD_DOWNLOAD=${ENABLE_WEBAPP_PROD_DOWNLOAD}" } _run_customize_options() { From 3cc5e98220b012181ef025ce38af6a2f94cafd31 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 12:54:36 +0100 Subject: [PATCH 07/70] add build webapp test workflow --- .github/actions/build_webapp_action.yml | 23 +++++++++++++ .github/workflows/test_build_webapp_v3.yml | 33 +++++++++++++++++++ .../test_docker_debian_codename_sub_v3.yml | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/actions/build_webapp_action.yml create mode 100644 .github/workflows/test_build_webapp_v3.yml diff --git a/.github/actions/build_webapp_action.yml b/.github/actions/build_webapp_action.yml new file mode 100644 index 000000000..a05c2c636 --- /dev/null +++ b/.github/actions/build_webapp_action.yml @@ -0,0 +1,23 @@ +name: Build Webapp +description: 'Build Webapp with Node' +inputs: + webapp-root-path: + description: 'root path of the webapp sources' + required: false + default: './src/webapp' + +runs: + using: "composite" + steps: + - name: Setup Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + - name: npm install + working-directory: ${{ inputs.webapp-root-path }} + run: npm install + - name: npm build + working-directory: ${{ inputs.webapp-root-path }} + env: + CI: false + run: npm run build \ No newline at end of file diff --git a/.github/workflows/test_build_webapp_v3.yml b/.github/workflows/test_build_webapp_v3.yml new file mode 100644 index 000000000..6c8bda46a --- /dev/null +++ b/.github/workflows/test_build_webapp_v3.yml @@ -0,0 +1,33 @@ +name: Test build Webapp 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_action.yml' + - '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_action.yml' + - 'src/webapp/**' + +jobs: + + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build WebApp + uses: .github/actions/build_webapp_action.yml \ No newline at end of file diff --git a/.github/workflows/test_docker_debian_codename_sub_v3.yml b/.github/workflows/test_docker_debian_codename_sub_v3.yml index dde60cb2a..2cd62dbe0 100644 --- a/.github/workflows/test_docker_debian_codename_sub_v3.yml +++ b/.github/workflows/test_docker_debian_codename_sub_v3.yml @@ -1,4 +1,4 @@ -name: Subworkflow Test Install Scripts Debian V3 +name: Subworkflow Test Install Scripts Debian v3 on: workflow_call: From 1c08a3eea9309907c0b20f7bf80d904daf7c5b9a Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:03:06 +0100 Subject: [PATCH 08/70] fix path --- .github/workflows/test_build_webapp_v3.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_webapp_v3.yml b/.github/workflows/test_build_webapp_v3.yml index 6c8bda46a..0dc37ef9f 100644 --- a/.github/workflows/test_build_webapp_v3.yml +++ b/.github/workflows/test_build_webapp_v3.yml @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build WebApp - uses: .github/actions/build_webapp_action.yml \ No newline at end of file + uses: ./.github/actions/build_webapp_action.yml \ No newline at end of file From f4991061b645901a4b2c445a38462f78ed0d8cea Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:06:20 +0100 Subject: [PATCH 09/70] fix actions --- .../{build_webapp_action.yml => build-webapp/action.yml} | 0 .github/workflows/test_build_webapp_v3.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/actions/{build_webapp_action.yml => build-webapp/action.yml} (100%) diff --git a/.github/actions/build_webapp_action.yml b/.github/actions/build-webapp/action.yml similarity index 100% rename from .github/actions/build_webapp_action.yml rename to .github/actions/build-webapp/action.yml diff --git a/.github/workflows/test_build_webapp_v3.yml b/.github/workflows/test_build_webapp_v3.yml index 0dc37ef9f..85e15a208 100644 --- a/.github/workflows/test_build_webapp_v3.yml +++ b/.github/workflows/test_build_webapp_v3.yml @@ -30,4 +30,4 @@ jobs: - uses: actions/checkout@v4 - name: Build WebApp - uses: ./.github/actions/build_webapp_action.yml \ No newline at end of file + uses: ./.github/actions/build-webapp \ No newline at end of file From b70bc5c8ddd5d06513b4637da9289bf444d8557e Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:08:49 +0100 Subject: [PATCH 10/70] fix: add shell --- .github/actions/build-webapp/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/build-webapp/action.yml b/.github/actions/build-webapp/action.yml index a05c2c636..a92510f3e 100644 --- a/.github/actions/build-webapp/action.yml +++ b/.github/actions/build-webapp/action.yml @@ -15,9 +15,11 @@ runs: node-version: 20.x - name: npm install working-directory: ${{ inputs.webapp-root-path }} + shell: bash run: npm install - name: npm build working-directory: ${{ inputs.webapp-root-path }} env: CI: false + shell: bash run: npm run build \ No newline at end of file From c5d97e08ae8716bae6cf22e7571ab7d6e1214f3d Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 13:09:54 +0100 Subject: [PATCH 11/70] fix trigger path --- .github/workflows/test_build_webapp_v3.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_build_webapp_v3.yml b/.github/workflows/test_build_webapp_v3.yml index 85e15a208..2c02eb30b 100644 --- a/.github/workflows/test_build_webapp_v3.yml +++ b/.github/workflows/test_build_webapp_v3.yml @@ -9,7 +9,7 @@ on: - 'future3/**' paths: - '.github/workflows/test_build_webapp_v3.yml' - - '.github/actions/build_webapp_action.yml' + - '.github/actions/build-webapp/**' - 'src/webapp/**' pull_request: # The branches below must be a subset of the branches above @@ -18,7 +18,7 @@ on: - future3/main paths: - '.github/workflows/test_build_webapp_v3.yml' - - '.github/actions/build_webapp_action.yml' + - '.github/actions/build-webapp/**' - 'src/webapp/**' jobs: From 8073f08bb1ef2763e9b32a97d1de08076d78bfec Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:00:13 +0100 Subject: [PATCH 12/70] adjust node mem calculation leave enough memory for the system. increase swap with min size --- src/webapp/run_rebuild.sh | 58 +++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 2baf6ebd8..e17e33ec9 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -41,61 +41,65 @@ change_swap() { sudo dphys-swapfile swapon || return 1 } -RECURSION_BREAKER=false +#RECURSION_BREAKER=false calc_nodemem() { - + # keep a buffer for the kernel etc. + local mem_buffer=512 # Need to check free space and limit Node memory usage # for PIs with little memory MemTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}') MemFree=$(grep MemFree /proc/meminfo | awk '{print $2}') + SwapTotal=$(grep SwapTotal /proc/meminfo | awk '{print $2}') SwapFree=$(grep SwapFree /proc/meminfo | awk '{print $2}') TotalFree=$((SwapFree + MemFree)) MemTotal=$((MemTotal / 1024)) MemFree=$((MemFree / 1024)) + SwapTotal=$((SwapTotal / 1024)) SwapFree=$((SwapFree / 1024)) TotalFree=$((TotalFree / 1024)) - - echo "Total phys memory: ${MemTotal} MB" - echo "Free phys memory : ${MemFree} MB" - echo "Free swap memory : ${SwapFree} MB" - echo "Free total memory: ${TotalFree} MB" + FreeToUse=$((TotalFree - mem_buffer)) + + echo "Total phys memory : ${MemTotal} MB" + echo "Free phys memory : ${MemFree} MB" + echo "Total swap memory : ${SwapTotal} MB" + echo "Free swap memory : ${SwapFree} MB" + echo "Free total memory : ${TotalFree} MB" + echo "Keep as buffer : ${mem_buffer} MB" + echo "Free usable memory: ${FreeToUse} MB" echo "" if [[ -z $NODEMEM ]]; then - # Keep a buffer of minimum 20 MB - if [[ $TotalFree -gt 1044 ]]; then - NODEMEM=1024 - elif [[ $TotalFree -gt 532 ]]; then - NODEMEM=512 - elif [[ $TotalFree -gt 276 ]]; then - NODEMEM=256 + # mininum memory used for node + local mem_min=256 + if [[ $FreeToUse -gt $mem_min ]]; then + NODEMEM=$FreeToUse else - if [ "$RECURSION_BREAKER" == true ]; then - return 1; - fi + #if [ "$RECURSION_BREAKER" == true ]; then + # return 1; + #fi - local new_swap_size=532 - echo "ERROR: Not enough memory available on system." - echo "Current free memory = $TotalFree MB" - echo "Swap file will be increased to ${new_swap_size} MB" + local new_swap_size=$((SwapTotal + mem_min)) + echo "WARN: Not enough memory left on system for node (min. $mem_min MB)." + echo "Trying to adjust swap size ..." + # keep a buffer on the filesystem local filesystem_left=$((new_swap_size + 512)) local filesystem_free=$(df -BM -P / | tail -n 1 | awk '{print $4}') filesystem_free=${filesystem_free//M} - if [ "${filesystem_free}" -le "${filesystem_left}" ]; then + if [ "${filesystem_free}" -lt "${filesystem_left}" ]; then echo "ERROR: Not enough space available on filesystem. At least ${filesystem_left} MB free memory are needed." echo "Current free space = $filesystem_free MB" - echo "Hint: if only a little memory is missing, stopping spocon, mpd, and jukebox-daemon might give you enough space" exit 1 else + echo "Swap will be increased to ${new_swap_size} MB" if ! change_swap $new_swap_size ; then - echo "ERROR: failed to change swap file" + echo "ERROR: failed to change swap size" exit 1 fi fi - RECURSION_BREAKER=true + #RECURSION_BREAKER=true calc_nodemem || return 1 fi fi @@ -103,8 +107,8 @@ calc_nodemem() { calc_nodemem -if [[ $NODEMEM -gt $TotalFree ]]; then - echo "ERROR: Requested node memory setting is larger than available free memory: $NODEMEM MB > $TotalFree MB" +if [[ $NODEMEM -gt $FreeToUse ]]; then + echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FreeToUse MB" exit 1 fi From 141b1d9f0914e715e0d7dac815471ecd467947be Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:01:29 +0100 Subject: [PATCH 13/70] use shell script for builds --- .github/actions/build-webapp/action.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/actions/build-webapp/action.yml b/.github/actions/build-webapp/action.yml index a92510f3e..50238c259 100644 --- a/.github/actions/build-webapp/action.yml +++ b/.github/actions/build-webapp/action.yml @@ -13,13 +13,7 @@ runs: uses: actions/setup-node@v3 with: node-version: 20.x - - name: npm install + - name: run build working-directory: ${{ inputs.webapp-root-path }} shell: bash - run: npm install - - name: npm build - working-directory: ${{ inputs.webapp-root-path }} - env: - CI: false - shell: bash - run: npm run build \ No newline at end of file + run: ./run_rebuild.sh -u \ No newline at end of file From 80db8b77352a812d9ad5eb5b50a3eabc05464174 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:05:08 +0100 Subject: [PATCH 14/70] add env CI --- .github/actions/build-webapp/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/build-webapp/action.yml b/.github/actions/build-webapp/action.yml index 50238c259..0e8485c65 100644 --- a/.github/actions/build-webapp/action.yml +++ b/.github/actions/build-webapp/action.yml @@ -16,4 +16,6 @@ runs: - name: run build working-directory: ${{ inputs.webapp-root-path }} shell: bash + env: + CI: false run: ./run_rebuild.sh -u \ No newline at end of file From 44653ee1f1d88b2bb68ac0e22994ec966d160e1f Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:12:48 +0100 Subject: [PATCH 15/70] use new action for release build --- .github/actions/build-webapp/action.yml | 4 +++ .../bundle_webapp_and_release_v3.yml | 26 +++++-------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/actions/build-webapp/action.yml b/.github/actions/build-webapp/action.yml index 0e8485c65..e0479c198 100644 --- a/.github/actions/build-webapp/action.yml +++ b/.github/actions/build-webapp/action.yml @@ -5,6 +5,10 @@ inputs: description: 'root path of the webapp sources' required: false default: './src/webapp' +outputs: + webapp-root-path: + description: 'used root path of the webapp sources' + value: ${{ inputs.webapp-root-path }} runs: using: "composite" diff --git a/.github/workflows/bundle_webapp_and_release_v3.yml b/.github/workflows/bundle_webapp_and_release_v3.yml index 548f2b47a..d889f71e9 100644 --- a/.github/workflows/bundle_webapp_and_release_v3.yml +++ b/.github/workflows/bundle_webapp_and_release_v3.yml @@ -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 @@ -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 }} @@ -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 @@ -94,21 +91,12 @@ 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 WebApp + 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 @@ -116,7 +104,7 @@ jobs: 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: From c46755da7ee249e258a16325a13a9356cda5481a Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:40:12 +0100 Subject: [PATCH 16/70] adjusted min sizes --- src/webapp/run_rebuild.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index e17e33ec9..a0d702c1a 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -44,7 +44,7 @@ change_swap() { #RECURSION_BREAKER=false calc_nodemem() { # keep a buffer for the kernel etc. - local mem_buffer=512 + local mem_buffer=256 # Need to check free space and limit Node memory usage # for PIs with little memory MemTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}') @@ -71,7 +71,7 @@ calc_nodemem() { if [[ -z $NODEMEM ]]; then # mininum memory used for node - local mem_min=256 + local mem_min=512 if [[ $FreeToUse -gt $mem_min ]]; then NODEMEM=$FreeToUse else From 4951906eaf96015ac867f575a6357b1bb81b3665 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 14:43:32 +0100 Subject: [PATCH 17/70] remove obsolete code --- src/webapp/run_rebuild.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index a0d702c1a..0214c8fc4 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -41,7 +41,6 @@ change_swap() { sudo dphys-swapfile swapon || return 1 } -#RECURSION_BREAKER=false calc_nodemem() { # keep a buffer for the kernel etc. local mem_buffer=256 @@ -75,10 +74,6 @@ calc_nodemem() { if [[ $FreeToUse -gt $mem_min ]]; then NODEMEM=$FreeToUse else - #if [ "$RECURSION_BREAKER" == true ]; then - # return 1; - #fi - local new_swap_size=$((SwapTotal + mem_min)) echo "WARN: Not enough memory left on system for node (min. $mem_min MB)." echo "Trying to adjust swap size ..." @@ -99,7 +94,6 @@ calc_nodemem() { fi fi - #RECURSION_BREAKER=true calc_nodemem || return 1 fi fi From 02fe4b34677d64e24f4ba53ae38c33663feb61e8 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:06:50 +0100 Subject: [PATCH 18/70] update workflow name --- .github/workflows/test_build_webapp_v3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_build_webapp_v3.yml b/.github/workflows/test_build_webapp_v3.yml index 2c02eb30b..939df3bde 100644 --- a/.github/workflows/test_build_webapp_v3.yml +++ b/.github/workflows/test_build_webapp_v3.yml @@ -1,4 +1,4 @@ -name: Test build Webapp v3 +name: Test Build Webapp v3 on: schedule: From 2fb017fe7548293849bed1fea24bcbaf17e9b5fa Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:48:35 +0100 Subject: [PATCH 19/70] move update dependencies entirely to rebuild script. update docs --- installation/routines/setup_jukebox_webapp.sh | 3 +-- src/webapp/run_rebuild.sh | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index 601c2daf7..a056d38f9 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -47,10 +47,9 @@ _jukebox_webapp_install_node() { _jukebox_webapp_build() { print_lc " Building web application" cd "${INSTALLATION_PATH}/src/webapp" || exit_on_error - npm ci --prefer-offline --no-audit --production rm -rf build # The build wrapper script checks available memory on system and sets Node options accordingly - ./run_rebuild.sh + ./run_rebuild.sh -u } _jukebox_webapp_download() { diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 0214c8fc4..d405cceec 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -3,8 +3,8 @@ usage() { echo -e "\nRebuild the Web App\n" echo "${BASH_SOURCE[0]} [-u] [-m SIZE]" - echo " -u : Update NPM dependencies before rebuild (only necessary if package.json changed)" - echo " -m SIZE : Set Node memory limit in MB (if omitted limit is deduced automatically)" + echo " -u : Update NPM dependencies before rebuild (only necessary on first build or if package.json changed" + echo " -m SIZE : Set Node memory limit in MB (if omitted limit is deduced automatically and swap might be adjusted)" echo -e "\n\n" } @@ -117,10 +117,10 @@ if [[ $(uname -m) == armv6l ]]; then release installation instead." fi -# In rare cases you will need to update the npm dependencies -# This is the case when the file package.json changed if [[ $UPDATE_DEPENDENCIES == true ]]; then - npm install + npm install + # TODO this was used in the install script (not activated for some time). Is one of the options prefered? + # npm ci --prefer-offline --no-audit --production fi # Rebuild Web App From 1394416cb07fac33c45144a53a379f74dd4b0ca2 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 15:54:36 +0100 Subject: [PATCH 20/70] move existing build folder to backup. update docs --- installation/routines/setup_jukebox_webapp.sh | 4 ---- src/webapp/run_rebuild.sh | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index a056d38f9..88b640367 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -42,13 +42,9 @@ _jukebox_webapp_install_node() { fi } -# TODO: Avoid building the app locally -# Instead implement a Github Action that prebuilds on commititung a git tag _jukebox_webapp_build() { print_lc " Building web application" cd "${INSTALLATION_PATH}/src/webapp" || exit_on_error - rm -rf build - # The build wrapper script checks available memory on system and sets Node options accordingly ./run_rebuild.sh -u } diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index d405cceec..1cb09db9c 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -124,4 +124,6 @@ if [[ $UPDATE_DEPENDENCIES == true ]]; then fi # Rebuild Web App +rm -rf build.bak +mv -f build build.bak npm run build From 4d0158a534c9c66150412696d0112e6179963882 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:20:18 +0100 Subject: [PATCH 21/70] increase swap with lower step size. minor fixes --- src/webapp/run_rebuild.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 1cb09db9c..75fac706d 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -74,16 +74,17 @@ calc_nodemem() { if [[ $FreeToUse -gt $mem_min ]]; then NODEMEM=$FreeToUse else - local new_swap_size=$((SwapTotal + mem_min)) + local add_swap_size=$((mem_min / 2)) + local new_swap_size=$((SwapTotal + add_swap_size)) echo "WARN: Not enough memory left on system for node (min. $mem_min MB)." echo "Trying to adjust swap size ..." # keep a buffer on the filesystem - local filesystem_left=$((new_swap_size + 512)) + local filesystem_needed=$((add_swap_size + 512)) local filesystem_free=$(df -BM -P / | tail -n 1 | awk '{print $4}') filesystem_free=${filesystem_free//M} - if [ "${filesystem_free}" -lt "${filesystem_left}" ]; then - echo "ERROR: Not enough space available on filesystem. At least ${filesystem_left} MB free memory are needed." + if [ "${filesystem_free}" -lt "${filesystem_needed}" ]; then + echo "ERROR: Not enough space available on filesystem. At least ${filesystem_needed} MB free memory are needed." echo "Current free space = $filesystem_free MB" exit 1 else @@ -125,5 +126,5 @@ fi # Rebuild Web App rm -rf build.bak -mv -f build build.bak +mv -f build build.bak 2>/dev/null npm run build From c5927187b88e57453ddc1454440dfc82996753e3 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 23:35:19 +0100 Subject: [PATCH 22/70] refactor vars and logging. added verbose param. --- src/webapp/run_rebuild.sh | 86 +++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 75fac706d..cdf161637 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -5,12 +5,14 @@ usage() { echo "${BASH_SOURCE[0]} [-u] [-m SIZE]" echo " -u : Update NPM dependencies before rebuild (only necessary on first build or if package.json changed" echo " -m SIZE : Set Node memory limit in MB (if omitted limit is deduced automatically and swap might be adjusted)" + echo " -v : Increase verbosity" echo -e "\n\n" } UPDATE_DEPENDENCIES=false +VERBOSE=false -while getopts ":uhm:" opt; do +while getopts ":uhvm:" opt; do case ${opt} in u) UPDATE_DEPENDENCIES=true @@ -18,6 +20,9 @@ while getopts ":uhm:" opt; do m) NODEMEM="${OPTARG}" ;; + v) + VERBOSE=true + ;; h) usage ;; @@ -41,54 +46,65 @@ change_swap() { sudo dphys-swapfile swapon || return 1 } +# Need to check free space and limit Node memory usage for PIs with little memory. +# Adjust swap if needed to have minimum memory available calc_nodemem() { # keep a buffer for the kernel etc. local mem_buffer=256 - # Need to check free space and limit Node memory usage - # for PIs with little memory - MemTotal=$(grep MemTotal /proc/meminfo | awk '{print $2}') - MemFree=$(grep MemFree /proc/meminfo | awk '{print $2}') - SwapTotal=$(grep SwapTotal /proc/meminfo | awk '{print $2}') - SwapFree=$(grep SwapFree /proc/meminfo | awk '{print $2}') - TotalFree=$((SwapFree + MemFree)) - - MemTotal=$((MemTotal / 1024)) - MemFree=$((MemFree / 1024)) - SwapTotal=$((SwapTotal / 1024)) - SwapFree=$((SwapFree / 1024)) - TotalFree=$((TotalFree / 1024)) - FreeToUse=$((TotalFree - mem_buffer)) - - echo "Total phys memory : ${MemTotal} MB" - echo "Free phys memory : ${MemFree} MB" - echo "Total swap memory : ${SwapTotal} MB" - echo "Free swap memory : ${SwapFree} MB" - echo "Free total memory : ${TotalFree} MB" - echo "Keep as buffer : ${mem_buffer} MB" - echo "Free usable memory: ${FreeToUse} MB" - echo "" + + local mem_total=$(grep MemTotal /proc/meminfo | awk '{print $2}') + local mem_free=$(grep MemFree /proc/meminfo | awk '{print $2}') + local swap_total=$(grep SwapTotal /proc/meminfo | awk '{print $2}') + local swap_free=$(grep SwapFree /proc/meminfo | awk '{print $2}') + local total_free=$((swap_free + mem_free)) + + mem_total=$((mem_total / 1024)) + mem_free=$((mem_free / 1024)) + swap_total=$((swap_total / 1024)) + swap_free=$((swap_free / 1024)) + total_free=$((total_free / 1024)) + + FREE_TO_USE=$((total_free - mem_buffer)) + + if [ "$VERBOSE" == true ]; then + echo "Total phys memory : ${mem_total} MB" + echo "Free phys memory : ${mem_free} MB" + echo "Total swap memory : ${swap_total} MB" + echo "Free swap memory : ${swap_free} MB" + echo "Free total memory : ${total_free} MB" + echo "Keep as buffer : ${mem_buffer} MB" + fi + echo -e "Free usable memory: ${FREE_TO_USE} MB\n" if [[ -z $NODEMEM ]]; then # mininum memory used for node local mem_min=512 - if [[ $FreeToUse -gt $mem_min ]]; then - NODEMEM=$FreeToUse + if [[ $FREE_TO_USE -gt $mem_min ]]; then + NODEMEM=$FREE_TO_USE else - local add_swap_size=$((mem_min / 2)) - local new_swap_size=$((SwapTotal + add_swap_size)) echo "WARN: Not enough memory left on system for node (min. $mem_min MB)." echo "Trying to adjust swap size ..." + local add_swap_size=$((mem_min / 2)) + local new_swap_size=$((swap_total + add_swap_size)) + # keep a buffer on the filesystem local filesystem_needed=$((add_swap_size + 512)) local filesystem_free=$(df -BM -P / | tail -n 1 | awk '{print $4}') filesystem_free=${filesystem_free//M} + + if [ "$VERBOSE" == true ]; then + echo "New swap size = $new_swap_size MB" + echo "Additional filesystem space needed = $filesystem_needed MB" + echo "Current free filesystem space = $filesystem_free MB" + fi + if [ "${filesystem_free}" -lt "${filesystem_needed}" ]; then echo "ERROR: Not enough space available on filesystem. At least ${filesystem_needed} MB free memory are needed." - echo "Current free space = $filesystem_free MB" + echo "Current free filesystem space = $filesystem_free MB" exit 1 else - echo "Swap will be increased to ${new_swap_size} MB" + echo "Swap size will be increased to ${new_swap_size} MB" if ! change_swap $new_swap_size ; then echo "ERROR: failed to change swap size" exit 1 @@ -102,8 +118,8 @@ calc_nodemem() { calc_nodemem -if [[ $NODEMEM -gt $FreeToUse ]]; then - echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FreeToUse MB" +if [[ $NODEMEM -gt $FREE_TO_USE ]]; then + echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FREE_TO_USE MB" exit 1 fi @@ -119,12 +135,14 @@ if [[ $(uname -m) == armv6l ]]; then fi if [[ $UPDATE_DEPENDENCIES == true ]]; then - npm install + npm install # TODO this was used in the install script (not activated for some time). Is one of the options prefered? # npm ci --prefer-offline --no-audit --production fi # Rebuild Web App rm -rf build.bak -mv -f build build.bak 2>/dev/null +if [ -d "build" ]; then + mv -f build build.bak +fi npm run build From d820e0b7d03f28247b866ee72100deb04f29d38d Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 23:45:14 +0100 Subject: [PATCH 23/70] update logging --- src/webapp/run_rebuild.sh | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index cdf161637..517a56fda 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -42,7 +42,7 @@ change_swap() { sudo dphys-swapfile swapoff || return 1 sudo sed -i "s|.*CONF_SWAPSIZE=.*|CONF_SWAPSIZE=${new_swap_size}|g" /etc/dphys-swapfile || return 1 sudo sed -i "s|^\s*CONF_SWAPFACTOR=|#CONF_SWAPFACTOR=|g" /etc/dphys-swapfile || return 1 - sudo dphys-swapfile setup || return 1 + sudo dphys-swapfile setup 1&>/dev/null || return 1 sudo dphys-swapfile swapon || return 1 } @@ -73,8 +73,9 @@ calc_nodemem() { echo "Free swap memory : ${swap_free} MB" echo "Free total memory : ${total_free} MB" echo "Keep as buffer : ${mem_buffer} MB" + echo -e "Free usable memory (incl. buffer): ${FREE_TO_USE} MB\n" fi - echo -e "Free usable memory: ${FREE_TO_USE} MB\n" + if [[ -z $NODEMEM ]]; then # mininum memory used for node @@ -82,8 +83,8 @@ calc_nodemem() { if [[ $FREE_TO_USE -gt $mem_min ]]; then NODEMEM=$FREE_TO_USE else - echo "WARN: Not enough memory left on system for node (min. $mem_min MB)." - echo "Trying to adjust swap size ..." + echo "WARN: Not enough memory left on system for build (usable ${FREE_TO_USE} MB, min. ${mem_min} MB)." + echo " Trying to adjust swap size ..." local add_swap_size=$((mem_min / 2)) local new_swap_size=$((swap_total + add_swap_size)) @@ -94,21 +95,17 @@ calc_nodemem() { filesystem_free=${filesystem_free//M} if [ "$VERBOSE" == true ]; then - echo "New swap size = $new_swap_size MB" - echo "Additional filesystem space needed = $filesystem_needed MB" - echo "Current free filesystem space = $filesystem_free MB" + echo " New swap size = $new_swap_size MB" + echo " Additional filesystem space needed = $filesystem_needed MB" + echo " Current free filesystem space = $filesystem_free MB" fi if [ "${filesystem_free}" -lt "${filesystem_needed}" ]; then - echo "ERROR: Not enough space available on filesystem. At least ${filesystem_needed} MB free memory are needed." - echo "Current free filesystem space = $filesystem_free MB" + echo "ERROR: Not enough space available on filesystem for swap (free ${filesystem_free} MB, min. ${filesystem_needed} MB). Abort!" + exit 1 + elif ! change_swap $new_swap_size ; then + echo "ERROR: failed to change swap size. Abort!" exit 1 - else - echo "Swap size will be increased to ${new_swap_size} MB" - if ! change_swap $new_swap_size ; then - echo "ERROR: failed to change swap size" - exit 1 - fi fi calc_nodemem || return 1 @@ -119,7 +116,7 @@ calc_nodemem() { calc_nodemem if [[ $NODEMEM -gt $FREE_TO_USE ]]; then - echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FREE_TO_USE MB" + echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FREE_TO_USE MB. Abort!" exit 1 fi From 709d57da145e99ee75382dcde3a3e7f833b7e1ec Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Thu, 4 Jan 2024 23:58:22 +0100 Subject: [PATCH 24/70] fix indentation --- src/webapp/run_rebuild.sh | 127 +++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 517a56fda..2ec05bd09 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -1,35 +1,35 @@ #!/usr/bin/env bash usage() { - echo -e "\nRebuild the Web App\n" - echo "${BASH_SOURCE[0]} [-u] [-m SIZE]" - echo " -u : Update NPM dependencies before rebuild (only necessary on first build or if package.json changed" - echo " -m SIZE : Set Node memory limit in MB (if omitted limit is deduced automatically and swap might be adjusted)" - echo " -v : Increase verbosity" - echo -e "\n\n" + echo -e "\nRebuild the Web App\n" + echo "${BASH_SOURCE[0]} [-u] [-m SIZE]" + echo " -u : Update NPM dependencies before rebuild (only necessary on first build or if package.json changed" + echo " -m SIZE : Set Node memory limit in MB (if omitted limit is deduced automatically and swap might be adjusted)" + echo " -v : Increase verbosity" + echo -e "\n\n" } UPDATE_DEPENDENCIES=false VERBOSE=false while getopts ":uhvm:" opt; do - case ${opt} in - u) - UPDATE_DEPENDENCIES=true - ;; - m) - NODEMEM="${OPTARG}" - ;; - v) - VERBOSE=true - ;; - h) - usage - ;; - \?) - usage - ;; - esac + case ${opt} in + u) + UPDATE_DEPENDENCIES=true + ;; + m) + NODEMEM="${OPTARG}" + ;; + v) + VERBOSE=true + ;; + h) + usage + ;; + \?) + usage + ;; + esac done # Change working directory to location of script @@ -76,48 +76,47 @@ calc_nodemem() { echo -e "Free usable memory (incl. buffer): ${FREE_TO_USE} MB\n" fi - - if [[ -z $NODEMEM ]]; then - # mininum memory used for node - local mem_min=512 - if [[ $FREE_TO_USE -gt $mem_min ]]; then - NODEMEM=$FREE_TO_USE - else - echo "WARN: Not enough memory left on system for build (usable ${FREE_TO_USE} MB, min. ${mem_min} MB)." - echo " Trying to adjust swap size ..." - - local add_swap_size=$((mem_min / 2)) - local new_swap_size=$((swap_total + add_swap_size)) - - # keep a buffer on the filesystem - local filesystem_needed=$((add_swap_size + 512)) - local filesystem_free=$(df -BM -P / | tail -n 1 | awk '{print $4}') - filesystem_free=${filesystem_free//M} - - if [ "$VERBOSE" == true ]; then - echo " New swap size = $new_swap_size MB" - echo " Additional filesystem space needed = $filesystem_needed MB" - echo " Current free filesystem space = $filesystem_free MB" + if [[ -z $NODEMEM ]]; then + # mininum memory used for node + local mem_min=512 + if [[ $FREE_TO_USE -gt $mem_min ]]; then + NODEMEM=$FREE_TO_USE + else + echo "WARN: Not enough memory left on system for build (usable ${FREE_TO_USE} MB, min. ${mem_min} MB)." + echo " Trying to adjust swap size ..." + + local add_swap_size=$((mem_min / 2)) + local new_swap_size=$((swap_total + add_swap_size)) + + # keep a buffer on the filesystem + local filesystem_needed=$((add_swap_size + 512)) + local filesystem_free=$(df -BM -P / | tail -n 1 | awk '{print $4}') + filesystem_free=${filesystem_free//M} + + if [ "$VERBOSE" == true ]; then + echo " New swap size = $new_swap_size MB" + echo " Additional filesystem space needed = $filesystem_needed MB" + echo " Current free filesystem space = $filesystem_free MB" + fi + + if [ "${filesystem_free}" -lt "${filesystem_needed}" ]; then + echo "ERROR: Not enough space available on filesystem for swap (free ${filesystem_free} MB, min. ${filesystem_needed} MB). Abort!" + exit 1 + elif ! change_swap $new_swap_size ; then + echo "ERROR: failed to change swap size. Abort!" + exit 1 + fi + + calc_nodemem || return 1 fi - - if [ "${filesystem_free}" -lt "${filesystem_needed}" ]; then - echo "ERROR: Not enough space available on filesystem for swap (free ${filesystem_free} MB, min. ${filesystem_needed} MB). Abort!" - exit 1 - elif ! change_swap $new_swap_size ; then - echo "ERROR: failed to change swap size. Abort!" - exit 1 - fi - - calc_nodemem || return 1 fi - fi } calc_nodemem if [[ $NODEMEM -gt $FREE_TO_USE ]]; then - echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FREE_TO_USE MB. Abort!" - exit 1 + echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FREE_TO_USE MB. Abort!" + exit 1 fi export NODE_OPTIONS=--max-old-space-size=${NODEMEM} @@ -126,15 +125,15 @@ echo "Setting Node Options:" env | grep NODE if [[ $(uname -m) == armv6l ]]; then - echo " You are running on a hardware with less resources. Building - the webapp might fail. If so, try to install the stable - release installation instead." + echo " You are running on a hardware with less resources. Building + the webapp might fail. If so, try to install the stable + release installation instead." fi if [[ $UPDATE_DEPENDENCIES == true ]]; then - npm install - # TODO this was used in the install script (not activated for some time). Is one of the options prefered? - # npm ci --prefer-offline --no-audit --production + npm install + # TODO this was used in the install script (not activated for some time). Is one of the options prefered? + # npm ci --prefer-offline --no-audit --production fi # Rebuild Web App From 1059e896c5119cd95fd308d9866fc37de6dd393a Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 00:15:01 +0100 Subject: [PATCH 25/70] update logging. moved NODEMEM check --- src/webapp/run_rebuild.sh | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 2ec05bd09..c7de12317 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -49,6 +49,7 @@ change_swap() { # Need to check free space and limit Node memory usage for PIs with little memory. # Adjust swap if needed to have minimum memory available calc_nodemem() { + echo "calculate usable memory" # keep a buffer for the kernel etc. local mem_buffer=256 @@ -64,26 +65,26 @@ calc_nodemem() { swap_free=$((swap_free / 1024)) total_free=$((total_free / 1024)) - FREE_TO_USE=$((total_free - mem_buffer)) + local free_to_use=$((total_free - mem_buffer)) if [ "$VERBOSE" == true ]; then - echo "Total phys memory : ${mem_total} MB" - echo "Free phys memory : ${mem_free} MB" - echo "Total swap memory : ${swap_total} MB" - echo "Free swap memory : ${swap_free} MB" - echo "Free total memory : ${total_free} MB" - echo "Keep as buffer : ${mem_buffer} MB" - echo -e "Free usable memory (incl. buffer): ${FREE_TO_USE} MB\n" + echo " Total phys memory : ${mem_total} MB" + echo " Free phys memory : ${mem_free} MB" + echo " Total swap memory : ${swap_total} MB" + echo " Free swap memory : ${swap_free} MB" + echo " Free total memory : ${total_free} MB" + echo " Keep as buffer : ${mem_buffer} MB" + echo -e " Free usable memory: ${free_to_use} MB\n" fi if [[ -z $NODEMEM ]]; then # mininum memory used for node local mem_min=512 - if [[ $FREE_TO_USE -gt $mem_min ]]; then - NODEMEM=$FREE_TO_USE + if [[ $free_to_use -gt $mem_min ]]; then + NODEMEM=$free_to_use else - echo "WARN: Not enough memory left on system for build (usable ${FREE_TO_USE} MB, min. ${mem_min} MB)." - echo " Trying to adjust swap size ..." + echo " WARN: Not enough memory left on system for node (usable ${free_to_use} MB, min. ${mem_min} MB)." + echo " Trying to adjust swap size ..." local add_swap_size=$((mem_min / 2)) local new_swap_size=$((swap_total + add_swap_size)) @@ -94,31 +95,30 @@ calc_nodemem() { filesystem_free=${filesystem_free//M} if [ "$VERBOSE" == true ]; then - echo " New swap size = $new_swap_size MB" - echo " Additional filesystem space needed = $filesystem_needed MB" - echo " Current free filesystem space = $filesystem_free MB" + echo " New swap size = $new_swap_size MB" + echo " Additional filesystem space needed = $filesystem_needed MB" + echo " Current free filesystem space = $filesystem_free MB" fi if [ "${filesystem_free}" -lt "${filesystem_needed}" ]; then - echo "ERROR: Not enough space available on filesystem for swap (free ${filesystem_free} MB, min. ${filesystem_needed} MB). Abort!" + echo " ERROR: Not enough space available on filesystem for swap (free ${filesystem_free} MB, min. ${filesystem_needed} MB). Abort!" exit 1 elif ! change_swap $new_swap_size ; then - echo "ERROR: failed to change swap size. Abort!" + echo " ERROR: failed to change swap size. Abort!" exit 1 fi calc_nodemem || return 1 fi + + elif [[ $NODEMEM -gt $free_to_use ]]; then + echo " ERROR: Requested node memory setting is larger than usable free memory: ${NODEMEM} MB > ${free_to_use} MB (free ${total_free} MB - buffer ${mem_buffer} MB). Abort!" + exit 1 fi } calc_nodemem -if [[ $NODEMEM -gt $FREE_TO_USE ]]; then - echo "ERROR: Requested node memory setting is larger than usable free memory: $NODEMEM MB > $FREE_TO_USE MB. Abort!" - exit 1 -fi - export NODE_OPTIONS=--max-old-space-size=${NODEMEM} echo "Setting Node Options:" From a97305182404e0627a38eec42a593dd9451958b4 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 00:56:40 +0100 Subject: [PATCH 26/70] refactor webapp build during installation removed unneccessay vars (only use ENABLE_WEBAPP_PROD_DOWNLOAD). trimmed webapp build option. updated messages. harmonized var access and queries --- ci/installation/run_install_common.sh | 3 +- ci/installation/run_install_faststartup.sh | 3 +- ci/installation/run_install_libzmq_local.sh | 3 +- .../run_install_webapp_download.sh | 3 +- ci/installation/run_install_webapp_local.sh | 2 - installation/includes/01_default_config.sh | 5 +- installation/routines/customize_options.sh | 46 ++++++------------- installation/routines/setup_jukebox_webapp.sh | 20 +++----- 8 files changed, 27 insertions(+), 58 deletions(-) diff --git a/ci/installation/run_install_common.sh b/ci/installation/run_install_common.sh index d5cce5321..51f7abb6f 100644 --- a/ci/installation/run_install_common.sh +++ b/ci/installation/run_install_common.sh @@ -24,8 +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 (only with install node = y) +# - - build webapp (skipped due to forced WebApp Download) # n - setup kiosk mode # n - reboot diff --git a/ci/installation/run_install_faststartup.sh b/ci/installation/run_install_faststartup.sh index 8155b7b02..134aeca71 100644 --- a/ci/installation/run_install_faststartup.sh +++ b/ci/installation/run_install_faststartup.sh @@ -22,8 +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 install node = y) +# - - build webapp (only with webapp = y) # - - setup kiosk mode (only with webapp = y) # n - reboot diff --git a/ci/installation/run_install_libzmq_local.sh b/ci/installation/run_install_libzmq_local.sh index 2ffed83bd..335cb24a1 100644 --- a/ci/installation/run_install_libzmq_local.sh +++ b/ci/installation/run_install_libzmq_local.sh @@ -23,8 +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 install node = y) +# - - build webapp (only with webapp = y) # - - setup kiosk mode (only with webapp = y) # n - reboot diff --git a/ci/installation/run_install_webapp_download.sh b/ci/installation/run_install_webapp_download.sh index bdef5a047..8e884b2ef 100644 --- a/ci/installation/run_install_webapp_download.sh +++ b/ci/installation/run_install_webapp_download.sh @@ -22,8 +22,7 @@ LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}" # n - setup rfid reader # n - setup samba # y - setup webapp -# n - install node -# - - build webapp (only with install node = y) +# n - build webapp # y - setup kiosk mode # n - reboot diff --git a/ci/installation/run_install_webapp_local.sh b/ci/installation/run_install_webapp_local.sh index 98c85a832..6a01e4f89 100644 --- a/ci/installation/run_install_webapp_local.sh +++ b/ci/installation/run_install_webapp_local.sh @@ -23,7 +23,6 @@ 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 @@ -39,6 +38,5 @@ n y y y -y n ' diff --git a/installation/includes/01_default_config.sh b/installation/includes/01_default_config.sh index b5d49c3a4..ec7b67b66 100644 --- a/installation/includes/01_default_config.sh +++ b/installation/includes/01_default_config.sh @@ -26,9 +26,6 @@ GIT_USE_SSH=${GIT_USE_SSH:-"true"} # For non-production builds, the Wep App must be build locally # Valid values # - release-only: download in release branch only -# - true: force download even in non-release branch, +# - true: force download even in non-release branch # - false: never download ENABLE_WEBAPP_PROD_DOWNLOAD=${ENABLE_WEBAPP_PROD_DOWNLOAD:-"release-only"} -# Install Node during setup for Web App building. This is only needed for development builds -ENABLE_INSTALL_NODE=${ENABLE_INSTALL_NODE:-"false"} -ENABLE_WEBAPP_BUILD=false diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index b492e8a64..513395912 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -283,58 +283,42 @@ Disable Pi's on-chip audio (headphone / jack output)? [y/N]" _option_webapp_devel_build() { # Let's detect if we are on the official release branch if [[ "$GIT_BRANCH" != "${GIT_BRANCH_RELEASE}" || "$GIT_USER" != "$GIT_UPSTREAM_USER" || "$CI_RUNNING" == "true" ]]; then - ENABLE_INSTALL_NODE=true # Unless ENABLE_WEBAPP_PROD_DOWNLOAD is forced to true by user override, do not download a potentially stale build if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == "release-only" ]]; then ENABLE_WEBAPP_PROD_DOWNLOAD=false fi - if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == false ]]; then + if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" != true && "$ENABLE_WEBAPP_PROD_DOWNLOAD" != "release-only" ]]; then clear_c - print_c "--------------------- WEBAPP NODE --------------------- + print_c "--------------------- WEBAPP BUILD ---------------------- You are installing from an unofficial branch. Therefore a prebuilt web app is not available and -you will have to build it locally. +it needs to be build locally. This requires Node to be installed. -You can choose to decline the Node installation and -the lastest prebuilt version from the main repository -will be installed. This can lead to incompatibilities. +You can choose to decline and the lastest prebuilt +version from the main repository will be installed. +This can lead to incompatibilities. -Do you want to install Node? [Y/n]" +Do you want to build the webapp? [Y/n]" read -r response case "$response" in [nN][oO]|[nN]) - ENABLE_INSTALL_NODE=false ENABLE_WEBAPP_PROD_DOWNLOAD=true ;; *) - print_c " -Building the webapp locally takes some time. -This can be done now or manually after the installation. - -Do you want to build the webapp now? [Y/n]" - read -r response - case "$response" in - [nN][oO]|[nN]) - ENABLE_WEBAPP_BUILD=false - # This message will be displayed at the end of the installation process - local tmp_fin_message="ATTENTION: You need to build the web app locally with - $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u - Read the documentation regarding local Web App builds!" - FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" - ;; - *) - ENABLE_WEBAPP_BUILD=true - ;; - esac - ;; + # This message will be displayed at the end of the installation process + local tmp_fin_message="ATTENTION: You have installed from an unofficial branch. + If you make changes to the web app sources + you need to rebuild it locally with + $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u + Read the documentation regarding local web app builds!" + FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" + ;; esac fi fi - log "ENABLE_INSTALL_NODE=${ENABLE_INSTALL_NODE}" - log "ENABLE_WEBAPP_BUILD=${ENABLE_WEBAPP_BUILD}" log "ENABLE_WEBAPP_PROD_DOWNLOAD=${ENABLE_WEBAPP_PROD_DOWNLOAD}" } diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index 88b640367..e28e463b3 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -62,7 +62,7 @@ _jukebox_webapp_download() { if validate_url ${download_url_commit} ; then log " DOWNLOAD_URL ${download_url_commit}" download_from_url ${download_url_commit} ${tar_filename} - elif [[ $ENABLE_WEBAPP_PROD_DOWNLOAD == true ]] && validate_url ${download_url_latest} ; then + elif [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == true ]] && validate_url ${download_url_latest} ; then log " DOWNLOAD_URL ${download_url_latest}" download_from_url ${download_url_latest} ${tar_filename} else @@ -92,14 +92,11 @@ _jukebox_webapp_register_as_system_service_with_nginx() { _jukebox_webapp_check() { print_verify_installation - if [[ $ENABLE_WEBAPP_PROD_DOWNLOAD == true || $ENABLE_WEBAPP_PROD_DOWNLOAD == release-only ]] ; then + if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == true || "$ENABLE_WEBAPP_PROD_DOWNLOAD" == "release-only" ]] ; then verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" - fi - if [[ $ENABLE_INSTALL_NODE == true ]] ; then + else verify_apt_packages nodejs - if [[ $ENABLE_WEBAPP_BUILD == true ]] ; then - verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" - fi + verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" fi verify_apt_packages nginx @@ -109,14 +106,11 @@ _jukebox_webapp_check() { } _run_setup_jukebox_webapp() { - if [[ $ENABLE_WEBAPP_PROD_DOWNLOAD == true || $ENABLE_WEBAPP_PROD_DOWNLOAD == release-only ]] ; then + if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == true || "$ENABLE_WEBAPP_PROD_DOWNLOAD" == "release-only" ]] ; then _jukebox_webapp_download - fi - if [[ $ENABLE_INSTALL_NODE == true ]] ; then + else _jukebox_webapp_install_node - if [[ $ENABLE_WEBAPP_BUILD == true ]] ; then - _jukebox_webapp_build - fi + _jukebox_webapp_build fi _jukebox_webapp_register_as_system_service_with_nginx _jukebox_webapp_check From 214b7d28c8193127a9481fadae0067421a64fe7f Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:32:51 +0100 Subject: [PATCH 27/70] Update docs --- documentation/developers/developer-issues.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/developers/developer-issues.md b/documentation/developers/developer-issues.md index bcb4d491a..a275073d4 100644 --- a/documentation/developers/developer-issues.md +++ b/documentation/developers/developer-issues.md @@ -52,11 +52,11 @@ $ ./run_rebuild.sh #### Changing Swap Size -This will set the swapsize to 1024 MB (and will deactivate swapfactor). Change accordingly if you have a SD Card with small capacity. +This will set the swapsize to 512 MB (and will deactivate swapfactor). Change accordingly if you have a SD Card with small capacity. ```bash sudo dphys-swapfile swapoff -sudo sed -i "s|.*CONF_SWAPSIZE=.*|CONF_SWAPSIZE=1024|g" /etc/dphys-swapfile +sudo sed -i "s|.*CONF_SWAPSIZE=.*|CONF_SWAPSIZE=512|g" /etc/dphys-swapfile sudo sed -i "s|^\s*CONF_SWAPFACTOR=|#CONF_SWAPFACTOR=|g" /etc/dphys-swapfile sudo dphys-swapfile setup sudo dphys-swapfile swapon From 88a2881db44ee06131239583ace802eec3cef637 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 08:43:44 +0100 Subject: [PATCH 28/70] Update messages --- installation/routines/customize_options.sh | 2 +- src/webapp/run_rebuild.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index 513395912..5225673bc 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -296,7 +296,7 @@ Therefore a prebuilt web app is not available and it needs to be build locally. This requires Node to be installed. -You can choose to decline and the lastest prebuilt +If you choose to decline the lastest prebuilt version from the main repository will be installed. This can lead to incompatibilities. diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index c7de12317..752990cb6 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -125,7 +125,7 @@ echo "Setting Node Options:" env | grep NODE if [[ $(uname -m) == armv6l ]]; then - echo " You are running on a hardware with less resources. Building + echo " You are running a hardware with limited resources. Building the webapp might fail. If so, try to install the stable release installation instead." fi From 29a1d7b235ad40c4bac8684d2d9e89815d853176 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 09:06:47 +0100 Subject: [PATCH 29/70] harmonize webapp wording --- .githooks/post-merge | 6 +++--- .github/actions/build-webapp/action.yml | 8 ++++---- .../workflows/bundle_webapp_and_release_v3.yml | 4 ++-- .github/workflows/test_build_webapp_v3.yml | 4 ++-- ci/installation/run_install_common.sh | 2 +- ci/installation/run_install_webapp_download.sh | 2 +- ci/installation/run_install_webapp_local.sh | 2 +- documentation/builders/autohotspot.md | 8 ++++---- documentation/builders/concepts.md | 2 +- documentation/developers/developer-issues.md | 2 +- .../developers/development-environment.md | 10 +++++----- documentation/developers/docker.md | 2 +- installation/includes/05_finish.sh | 2 +- installation/routines/customize_options.sh | 16 ++++++++-------- installation/routines/setup_jukebox_webapp.sh | 8 ++++---- src/jukebox/components/playermpd/__init__.py | 6 +++--- src/webapp/public/index.html | 2 +- src/webapp/run_rebuild.sh | 2 +- 18 files changed, 44 insertions(+), 44 deletions(-) diff --git a/.githooks/post-merge b/.githooks/post-merge index 3b838c87c..6fc6e4f54 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -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 # @@ -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" @@ -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" diff --git a/.github/actions/build-webapp/action.yml b/.github/actions/build-webapp/action.yml index e0479c198..9f192105f 100644 --- a/.github/actions/build-webapp/action.yml +++ b/.github/actions/build-webapp/action.yml @@ -1,13 +1,13 @@ -name: Build Webapp -description: 'Build Webapp with Node' +name: Build Web App +description: 'Build Web App with Node' inputs: webapp-root-path: - description: 'root path of the webapp sources' + description: 'root path of the Web App sources' required: false default: './src/webapp' outputs: webapp-root-path: - description: 'used root path of the webapp sources' + description: 'used root path of the Web App sources' value: ${{ inputs.webapp-root-path }} runs: diff --git a/.github/workflows/bundle_webapp_and_release_v3.yml b/.github/workflows/bundle_webapp_and_release_v3.yml index d889f71e9..13bffe472 100644 --- a/.github/workflows/bundle_webapp_and_release_v3.yml +++ b/.github/workflows/bundle_webapp_and_release_v3.yml @@ -1,4 +1,4 @@ -name: Bundle Webapp and Release +name: Bundle Web App and Release on: push: @@ -91,7 +91,7 @@ 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: Build WebApp + - name: Build Web App id: build-webapp uses: ./.github/actions/build-webapp diff --git a/.github/workflows/test_build_webapp_v3.yml b/.github/workflows/test_build_webapp_v3.yml index 939df3bde..426d01f04 100644 --- a/.github/workflows/test_build_webapp_v3.yml +++ b/.github/workflows/test_build_webapp_v3.yml @@ -1,4 +1,4 @@ -name: Test Build Webapp v3 +name: Test Build Web App v3 on: schedule: @@ -29,5 +29,5 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Build WebApp + - name: Build Web App uses: ./.github/actions/build-webapp \ No newline at end of file diff --git a/ci/installation/run_install_common.sh b/ci/installation/run_install_common.sh index 51f7abb6f..b8c641580 100644 --- a/ci/installation/run_install_common.sh +++ b/ci/installation/run_install_common.sh @@ -24,7 +24,7 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=true # n - setup rfid reader # y - setup samba # y - setup webapp -# - - build webapp (skipped due to forced WebApp Download) +# - - build webapp (skipped due to forced webapp Download) # n - setup kiosk mode # n - reboot diff --git a/ci/installation/run_install_webapp_download.sh b/ci/installation/run_install_webapp_download.sh index 8e884b2ef..ded27ec54 100644 --- a/ci/installation/run_install_webapp_download.sh +++ b/ci/installation/run_install_webapp_download.sh @@ -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")" diff --git a/ci/installation/run_install_webapp_local.sh b/ci/installation/run_install_webapp_local.sh index 6a01e4f89..7af16df3a 100644 --- a/ci/installation/run_install_webapp_local.sh +++ b/ci/installation/run_install_webapp_local.sh @@ -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")" diff --git a/documentation/builders/autohotspot.md b/documentation/builders/autohotspot.md index 69e6f4d6a..ecf996f81 100644 --- a/documentation/builders/autohotspot.md +++ b/documentation/builders/autohotspot.md @@ -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! @@ -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 @@ -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. diff --git a/documentation/builders/concepts.md b/documentation/builders/concepts.md index 37c13db89..0a4305cfe 100644 --- a/documentation/builders/concepts.md +++ b/documentation/builders/concepts.md @@ -12,7 +12,7 @@ The core app is centered around a plugin concept. This serves three purposes: ## Remote Procedure Call Server (RPC) -The Remote Procedure Call (RPC) server allows remotely triggering actions (e.g., from the Webapp) within the Jukebox core application. Only Python functions registered by the plugin interface can be called. This simplifies external APIs and lets us focus on the relevant user functions. +The Remote Procedure Call (RPC) server allows remotely triggering actions (e.g., from the Web App) within the Jukebox core application. Only Python functions registered by the plugin interface can be called. This simplifies external APIs and lets us focus on the relevant user functions. Why should you care? Because we use the same protocol when triggering actions from other inputs like a card swipe, a GPIO button press, etc. How that works is described in [RPC Commands](rpc-commands.md). diff --git a/documentation/developers/developer-issues.md b/documentation/developers/developer-issues.md index a275073d4..999e70a17 100644 --- a/documentation/developers/developer-issues.md +++ b/documentation/developers/developer-issues.md @@ -1,6 +1,6 @@ # Developer Issues -## Building the Webapp on the PI +## Building the Web App on the PI ### JavaScript heap out of memory diff --git a/documentation/developers/development-environment.md b/documentation/developers/development-environment.md index 249f6263c..8a665fafe 100644 --- a/documentation/developers/development-environment.md +++ b/documentation/developers/development-environment.md @@ -1,6 +1,6 @@ # Development Environment -You have 3 development options. Each option has its pros and cons. To interact with GPIO or other hardware, it's required to develop directly on a Raspberry Pi. For general development of Python code (Jukebox) or JavaScript (Webapp), we recommend Docker. Developing on your local machine (Linux, Mac, Windows) works as well and requires all dependencies to be installed locally. +You have 3 development options. Each option has its pros and cons. To interact with GPIO or other hardware, it's required to develop directly on a Raspberry Pi. For general development of Python code (Jukebox) or JavaScript (Web App), we recommend Docker. Developing on your local machine (Linux, Mac, Windows) works as well and requires all dependencies to be installed locally. - [Development Environment](#development-environment) - [Develop in Docker](#develop-in-docker) @@ -25,7 +25,7 @@ We recommend to use at least a Pi 3 or Pi Zero 2 for development. This hardware 2. Boot up your Raspberry Pi. 3. [Install](../builders/installation.md) the Jukebox software as if you were building a Phoniebox. You can install from your own fork and feature branch you wish which can be changed later as well. The original repository will be set as `upstream`. 4. Once the installation has successfully ran, reboot your Pi. -5. Due to some resource constraints, the Webapp does not build the latest changes and instead consumes the latest official release. To change that, you need to install NodeJS and build the Webapp locally. +5. Due to some resource constraints, the Web App does not build the latest changes and instead consumes the latest official release. To change that, you need to install NodeJS and build the Web App locally. 6. Install NodeJS using the existing installer ``` bash @@ -35,15 +35,15 @@ We recommend to use at least a Pi 3 or Pi Zero 2 for development. This hardware ``` 7. To free up RAM, reboot your Pi. -8. Build the Webapp using the existing build command. If the build fails, you might have forgotten to reboot. +8. Build the Web App using the existing build command. If the build fails, you might have forgotten to reboot. ``` bash cd ~/RPi-Jukebox-RFID/src/webapp; \ ./run_rebuild.sh -u ``` -9. The Webapp should now be updated. -10. To continuously update Webapp, pull the latest changes from your repository and rerun the command above. +9. The Web App should now be updated. +10. To continuously update Web App, pull the latest changes from your repository and rerun the command above. ## Develop on local machine diff --git a/documentation/developers/docker.md b/documentation/developers/docker.md index d7242750e..404ea15ca 100644 --- a/documentation/developers/docker.md +++ b/documentation/developers/docker.md @@ -146,7 +146,7 @@ Read these threads for details: [thread 1](https://unix.stackexchange.com/questi The Dockerfile is defined to start all Phoniebox related services. -Open in your browser to see the web application. +Open in your browser to see the Web App. While the `webapp` container does not require a reload while working on it (hot-reload is enabled), you will have to restart your `jukebox` diff --git a/installation/includes/05_finish.sh b/installation/includes/05_finish.sh index 22ba6ae80..c48fc31d2 100644 --- a/installation/includes/05_finish.sh +++ b/installation/includes/05_finish.sh @@ -11,7 +11,7 @@ ${FIN_MESSAGE} In order to start, you need to reboot your Raspberry Pi. Your SSH connection will disconnect. -After the reboot, you can access the WebApp in your browser at +After the reboot, you can access the Web App in your browser at http://${local_hostname}.local or http://${CURRENT_IP_ADDRESS} Don't forget to upload files. " diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index 5225673bc..5eb90e56b 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -189,12 +189,12 @@ Do you want to install Samba? [Y/n]" _option_webapp() { # ENABLE_WEBAPP clear_c - print_c "------------------------ WEBAPP ------------------------- + print_c "------------------------ WEB APP ------------------------ This is only required if you want to use a graphical interface to manage your Phoniebox! -Would you like to install the web application? [Y/n]" +Would you like to install the Web App? [Y/n]" read -r response case "$response" in [nN][oO]|[nN]) @@ -213,7 +213,7 @@ _option_kiosk_mode() { print_c "----------------------- KIOSK MODE ---------------------- If you have a screen attached to your RPi, -this will launch the web application right after boot. +this will launch the Web App right after boot. It will only install the necessary xserver dependencies and not the entire RPi desktop environment. @@ -289,10 +289,10 @@ _option_webapp_devel_build() { fi if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" != true && "$ENABLE_WEBAPP_PROD_DOWNLOAD" != "release-only" ]]; then clear_c - print_c "--------------------- WEBAPP BUILD ---------------------- + print_c "--------------------- WEB APP BUILD --------------------- You are installing from an unofficial branch. -Therefore a prebuilt web app is not available and +Therefore a prebuilt Web App is not available and it needs to be build locally. This requires Node to be installed. @@ -300,7 +300,7 @@ If you choose to decline the lastest prebuilt version from the main repository will be installed. This can lead to incompatibilities. -Do you want to build the webapp? [Y/n]" +Do you want to build the Web App? [Y/n]" read -r response case "$response" in [nN][oO]|[nN]) @@ -309,10 +309,10 @@ Do you want to build the webapp? [Y/n]" *) # This message will be displayed at the end of the installation process local tmp_fin_message="ATTENTION: You have installed from an unofficial branch. - If you make changes to the web app sources + If you make changes to the Web App sources you need to rebuild it locally with $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u - Read the documentation regarding local web app builds!" + Read the documentation regarding local Web App builds!" FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" ;; esac diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index e28e463b3..7f2a839c8 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -43,13 +43,13 @@ _jukebox_webapp_install_node() { } _jukebox_webapp_build() { - print_lc " Building web application" + print_lc " Building Web App" cd "${INSTALLATION_PATH}/src/webapp" || exit_on_error ./run_rebuild.sh -u } _jukebox_webapp_download() { - print_lc " Downloading web application" + print_lc " Downloading Web App" local jukebox_version=$(python "${INSTALLATION_PATH}/src/jukebox/jukebox/version.py") local git_head_hash=$(git -C "${INSTALLATION_PATH}" rev-parse --verify --quiet HEAD) local git_head_hash_short=${git_head_hash:0:10} @@ -66,7 +66,7 @@ _jukebox_webapp_download() { log " DOWNLOAD_URL ${download_url_latest}" download_from_url ${download_url_latest} ${tar_filename} else - exit_on_error "No prebuild webapp bundle found!" + exit_on_error "No prebuild Web App bundle found!" fi tar -xzf ${tar_filename} rm -f ${tar_filename} @@ -118,6 +118,6 @@ _run_setup_jukebox_webapp() { setup_jukebox_webapp() { if [ "$ENABLE_WEBAPP" == true ] ; then - run_with_log_frame _run_setup_jukebox_webapp "Install web application" + run_with_log_frame _run_setup_jukebox_webapp "Install Web App" fi } diff --git a/src/jukebox/components/playermpd/__init__.py b/src/jukebox/components/playermpd/__init__.py index e854ee5ee..c9563b3f3 100644 --- a/src/jukebox/components/playermpd/__init__.py +++ b/src/jukebox/components/playermpd/__init__.py @@ -56,7 +56,7 @@ """ # noqa: E501 # Warum ist "Second Swipe" im Player und nicht im RFID Reader? # Second swipe ist abhängig vom Player State - nicht vom RFID state. -# Beispiel: RFID triggered Folder1, Webapp triggered Folder2, RFID Folder1: Dann muss das 2. Mal Folder1 auch als "first swipe" +# Beispiel: RFID triggered Folder1, Web App triggered Folder2, RFID Folder1: Dann muss das 2. Mal Folder1 auch als "first swipe" # gewertet werden. Wenn der RFID das basierend auf IDs macht, kann der nicht unterscheiden und glaubt es ist 2. Swipe. # Beispiel 2: Jemand hat RFID Reader (oder 1x RFID und 1x Barcode Scanner oder so) angeschlossen. Liest zuerst Karte mit # Reader 1 und dann mit Reader 2: Reader 2 weiß nicht, was bei Reader 1 passiert ist und denkt es ist 1. swipe. @@ -68,7 +68,7 @@ # # In der aktuellen Implementierung weiß der Player (der second "swipe" dekodiert) überhaupt nichts vom RFID. # Im Prinzip gibt es zwei "Play" Funktionen: (1) play always from start und (2) play with toggle action. -# Die Webapp ruft immer (1) auf und die RFID immer (2). Jetzt kann man sogar für einige Karten sagen +# Die Web App ruft immer (1) auf und die RFID immer (2). Jetzt kann man sogar für einige Karten sagen # immer (1) - also kein Second Swipe und für andere (2). # Sollte der Reader das Swcond swipe dekodieren, muss aber der Reader den Status des Player kennen. # Das ist allerdings ein Problem. In Version 2 ist das nicht aufgefallen, @@ -76,7 +76,7 @@ # # Beispiel: Second swipe bei anderen Funktionen, hier: WiFi on/off. # Was die Karte Action tut ist ein Toggle. Der Toggle hängt vom Wifi State ab, den der RFID Kartenleser nicht kennt. -# Den kann der Leser auch nicht tracken. Der State kann ja auch über die WebApp oder Kommandozeile geändert werden. +# Den kann der Leser auch nicht tracken. Der State kann ja auch über die Web App oder Kommandozeile geändert werden. # Toggle (und 2nd Swipe generell) ist immer vom Status des Zielsystems abhängig und kann damit nur vom Zielsystem geändert # werden. Bei Wifi also braucht man 3 Funktionen: on / off / toggle. Toggle ist dann first swipe / second swipe diff --git a/src/webapp/public/index.html b/src/webapp/public/index.html index 71ea85188..30c055a5e 100644 --- a/src/webapp/public/index.html +++ b/src/webapp/public/index.html @@ -7,7 +7,7 @@ diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 752990cb6..6f2a5d732 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -126,7 +126,7 @@ env | grep NODE if [[ $(uname -m) == armv6l ]]; then echo " You are running a hardware with limited resources. Building - the webapp might fail. If so, try to install the stable + the Web App might fail. If so, try to install the stable release installation instead." fi From 1ea35572ea9c3e036d6507fcbd89ecf2e5a69c3c Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 09:17:56 +0100 Subject: [PATCH 30/70] fix flake8 --- src/jukebox/components/playermpd/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jukebox/components/playermpd/__init__.py b/src/jukebox/components/playermpd/__init__.py index c9563b3f3..c0185116e 100644 --- a/src/jukebox/components/playermpd/__init__.py +++ b/src/jukebox/components/playermpd/__init__.py @@ -56,8 +56,9 @@ """ # noqa: E501 # Warum ist "Second Swipe" im Player und nicht im RFID Reader? # Second swipe ist abhängig vom Player State - nicht vom RFID state. -# Beispiel: RFID triggered Folder1, Web App triggered Folder2, RFID Folder1: Dann muss das 2. Mal Folder1 auch als "first swipe" -# gewertet werden. Wenn der RFID das basierend auf IDs macht, kann der nicht unterscheiden und glaubt es ist 2. Swipe. +# Beispiel: RFID triggered Folder1, Web App triggered Folder2, RFID Folder1: +# Dann muss das 2. Mal Folder1 auch als "first swipe" gewertet werden. +# Wenn der RFID das basierend auf IDs macht, kann der nicht unterscheiden und glaubt es ist 2. Swipe. # Beispiel 2: Jemand hat RFID Reader (oder 1x RFID und 1x Barcode Scanner oder so) angeschlossen. Liest zuerst Karte mit # Reader 1 und dann mit Reader 2: Reader 2 weiß nicht, was bei Reader 1 passiert ist und denkt es ist 1. swipe. # Beispiel 3: RFID trigered Folder1, Playlist läuft durch und hat schon gestoppt, dann wird die Karte wieder vorgehalten. From 6cac516e2d763f10ab99c1ce81ebc9fe4c2ddf2f Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 09:19:59 +0100 Subject: [PATCH 31/70] fix flake8 --- src/jukebox/components/playermpd/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jukebox/components/playermpd/__init__.py b/src/jukebox/components/playermpd/__init__.py index c0185116e..e87bc93fc 100644 --- a/src/jukebox/components/playermpd/__init__.py +++ b/src/jukebox/components/playermpd/__init__.py @@ -56,8 +56,8 @@ """ # noqa: E501 # Warum ist "Second Swipe" im Player und nicht im RFID Reader? # Second swipe ist abhängig vom Player State - nicht vom RFID state. -# Beispiel: RFID triggered Folder1, Web App triggered Folder2, RFID Folder1: -# Dann muss das 2. Mal Folder1 auch als "first swipe" gewertet werden. +# Beispiel: RFID triggered Folder1, Web App triggered Folder2, RFID Folder1: +# Dann muss das 2. Mal Folder1 auch als "first swipe" gewertet werden. # Wenn der RFID das basierend auf IDs macht, kann der nicht unterscheiden und glaubt es ist 2. Swipe. # Beispiel 2: Jemand hat RFID Reader (oder 1x RFID und 1x Barcode Scanner oder so) angeschlossen. Liest zuerst Karte mit # Reader 1 und dann mit Reader 2: Reader 2 weiß nicht, was bei Reader 1 passiert ist und denkt es ist 1. swipe. From 69bc825462888dcb53d045887ad5a83b5dc5dc79 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sat, 6 Jan 2024 14:43:07 +0100 Subject: [PATCH 32/70] update node installation. update node version for armv6. use recommended setup from nodesource. removed update version on new installation run. --- installation/routines/setup_jukebox_webapp.sh | 92 ++++++++++++------- 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index 7f2a839c8..794911bb0 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -3,43 +3,62 @@ # Constants WEBAPP_NGINX_SITE_DEFAULT_CONF="/etc/nginx/sites-available/default" -# For ARMv7+ +# Node major version used. +# If changed also update in .github\actions\build-webapp\action.yml NODE_MAJOR=20 -# For ARMv6 -# To update version, follow these links -# https://github.com/sdesalas/node-pi-zero -# https://github.com/nodejs/unofficial-builds/ -NODE_SOURCE_EXPERIMENTAL="https://raw.githubusercontent.com/sdesalas/node-pi-zero/master/install-node-v16.3.0.sh" +# Node version for ARMv6 (unofficial builds) +NODE_ARMv6_VERSION=v20.10.0 _jukebox_webapp_install_node() { - sudo apt-get -y update - - if which node > /dev/null; then - print_lc " Found existing NodeJS. Hence, updating NodeJS" - sudo npm cache clean -f - sudo npm install --silent -g n - sudo n --quiet latest - sudo npm update --silent -g - else print_lc " Install NodeJS" - # Zero and older versions of Pi with ARMv6 only - # support experimental NodeJS - if [[ $(uname -m) == "armv6l" ]]; then - wget -O - ${NODE_SOURCE_EXPERIMENTAL} | sudo bash - sudo apt-get -qq -y install nodejs - sudo npm install --silent -g npm + local node_installed=$(node -v) + local arch=$(uname -m) + if [[ "$arch" == "armv6l" ]]; then + if [ "$node_installed" == "$NODE_ARMv6_VERSION" ]; then + print_lc " Skipping. NodeJS already installed" + else + # For ARMv6 unofficial build + # https://github.com/nodejs/unofficial-builds/ + local node_tmp_dir="${HOME_PATH}/node" + local node_install_dir=/usr/local/lib/nodejs + local node_filename="node-${NODE_ARMv6_VERSION}-linux-${arch}" + local node_tar_filename="${node_filename}.tar.gz" + node_download_url="https://unofficial-builds.nodejs.org/download/release/${NODE_ARMv6_VERSION}/${node_tar_filename}" + + mkdir -p "${node_tmp_dir}" && cd "${node_tmp_dir}" || exit_on_error + download_from_url ${node_download_url} ${node_tar_filename} + tar -xzf ${node_tar_filename} + rm -rf ${node_tar_filename} + + # see https://github.com/nodejs/help/wiki/Installation + # Remove existing symlinks + sudo unlink /usr/bin/node + sudo unlink /usr/bin/npm + sudo unlink /usr/bin/npx + + # Clear existing nodejs and copy new files + sudo rm -rf "${node_install_dir}" + sudo mv "${node_filename}" "${node_install_dir}" + + sudo ln -s "${node_install_dir}/bin/node" /usr/bin/node + sudo ln -s "${node_install_dir}/bin/npm" /usr/bin/npm + sudo ln -s "${node_install_dir}/bin/npx" /usr/bin/npx + + cd "${HOME_PATH}" || exit_on_error + rm -rf "${node_tmp_dir}" + fi else - # install NodeJS and npm as recommended in - # https://github.com/nodesource/distributions - sudo apt-get install -y ca-certificates curl gnupg - sudo mkdir -p /etc/apt/keyrings - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list - sudo apt-get update - sudo apt-get install -y nodejs + if [[ "$node_installed" == "v${NODE_MAJOR}."* ]]; then + print_lc " Skipping. NodeJS already installed" + else + sudo apt-get remove -y nodejs + # install NodeJS as recommended in + # https://github.com/nodesource/distributions + curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | sudo bash - &&\ + sudo apt-get install -y nodejs + fi fi - fi } _jukebox_webapp_build() { @@ -75,7 +94,7 @@ _jukebox_webapp_download() { _jukebox_webapp_register_as_system_service_with_nginx() { print_lc " Install and configure nginx" - sudo apt-get -qq -y update + sudo apt-get -y update sudo apt-get -y purge apache2 sudo apt-get -y install nginx @@ -95,7 +114,16 @@ _jukebox_webapp_check() { if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == true || "$ENABLE_WEBAPP_PROD_DOWNLOAD" == "release-only" ]] ; then verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" else - verify_apt_packages nodejs + local arch=$(uname -m) + if [[ "$arch" == "armv6l" ]]; then + local node_installed=$(node -v) + log " Verify 'node' is installed" + test ! "${node_installed}" == "${NODE_ARMv6_VERSION}" && exit_on_error "ERROR: 'node' not in expected version: '${node_installed}' instead of '${NODE_ARMv6_VERSION}'!" + log " CHECK" + else + verify_apt_packages nodejs + fi + verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" fi From d009b4e2b87527307506f1c5b35d82f0c017f9f5 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sat, 6 Jan 2024 15:14:03 +0100 Subject: [PATCH 33/70] update docs --- documentation/builders/installation.md | 3 ++- documentation/developers/development-environment.md | 9 ++++----- resources/default-settings/gpio.example.yaml | 1 - resources/html/404.html | 1 - resources/html/runbuildui.html | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index 945368480..20ae01e2b 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -97,7 +97,8 @@ cd; GIT_USER='MiczFlor' GIT_BRANCH='future3/develop' bash <(wget -qO- https://ra This will switch directly to the specified feature branch during installation. > [!NOTE] -> For all branches *except* the current Release future3/main, you will need to build the Web App locally on the Pi. This is not part of the installation process due to memory limitation issues. See [Developer steps to install](../developers/development-environment.md#steps-to-install) +> For all branches *except* the current Release future3/main, the Web App needs to be build locally on the Pi. This is part of the installation process. +> If you make changes to the Web App sources you need to rebuild it. See [Developer steps to install](../developers/development-environment.md#steps-to-install) If you suspect an error you can monitor the installation-process with diff --git a/documentation/developers/development-environment.md b/documentation/developers/development-environment.md index 8a665fafe..efbf17ec1 100644 --- a/documentation/developers/development-environment.md +++ b/documentation/developers/development-environment.md @@ -25,13 +25,12 @@ We recommend to use at least a Pi 3 or Pi Zero 2 for development. This hardware 2. Boot up your Raspberry Pi. 3. [Install](../builders/installation.md) the Jukebox software as if you were building a Phoniebox. You can install from your own fork and feature branch you wish which can be changed later as well. The original repository will be set as `upstream`. 4. Once the installation has successfully ran, reboot your Pi. -5. Due to some resource constraints, the Web App does not build the latest changes and instead consumes the latest official release. To change that, you need to install NodeJS and build the Web App locally. -6. Install NodeJS using the existing installer +5. Due to some resource constraints, the Web App does not build the latest changes and instead consumes the latest official release. To change that, you need to install NodeJS and build the Web App locally. +6. Install NodeJS using the recommended nodesource setup (https://github.com/nodesource/distributions) ``` bash - cd ~/RPi-Jukebox-RFID/installation/routines; \ - source setup_jukebox_webapp.sh; \ - _jukebox_webapp_install_node + curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash - &&\ + sudo apt-get install -y nodejs ``` 7. To free up RAM, reboot your Pi. diff --git a/resources/default-settings/gpio.example.yaml b/resources/default-settings/gpio.example.yaml index f19b83c87..8f3d389b8 100644 --- a/resources/default-settings/gpio.example.yaml +++ b/resources/default-settings/gpio.example.yaml @@ -1,6 +1,5 @@ # Provides a few selected examples of GPIO configuration # Check out the documentation for many more configuration recipes -# https://rpi-jukebox-rfid.readthedocs.io/en/latest/index.html pin_factory: type: rpigpio.RPiGPIOFactory output_devices: diff --git a/resources/html/404.html b/resources/html/404.html index 1a60d2415..89c9905a9 100755 --- a/resources/html/404.html +++ b/resources/html/404.html @@ -15,7 +15,6 @@

Ups! Requested file not found.

Why not try again from the top-level of

diff --git a/resources/html/runbuildui.html b/resources/html/runbuildui.html index 04f92c704..ebbb1bafa 100755 --- a/resources/html/runbuildui.html +++ b/resources/html/runbuildui.html @@ -16,7 +16,7 @@

Ups! Looks like your Web UI has not been build!

  • ./run_rebuild.sh -u
  • Reload this page
  • -

    In case of trouble when building the Web UI, consult the documentation! +

    In case of trouble when building the Web UI, consult the official documentation! From 0f79d244a5ed4c2bd0be48562af054ff5bbdd466 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 5 Jan 2024 19:44:00 +0100 Subject: [PATCH 34/70] ci add platform linux/armv6 (deactivated) --- .../test_docker_debian_codename_sub_v3.yml | 7 ++++++- .github/workflows/test_docker_debian_v3.yml | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_docker_debian_codename_sub_v3.yml b/.github/workflows/test_docker_debian_codename_sub_v3.yml index 2cd62dbe0..a9ec217dc 100644 --- a/.github/workflows/test_docker_debian_codename_sub_v3.yml +++ b/.github/workflows/test_docker_debian_codename_sub_v3.yml @@ -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: @@ -83,6 +84,7 @@ 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 @@ -90,6 +92,9 @@ jobs: 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 @@ -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 }} diff --git a/.github/workflows/test_docker_debian_v3.yml b/.github/workflows/test_docker_debian_v3.yml index 06718afba..673745db9 100644 --- a/.github/workflows/test_docker_debian_v3.yml +++ b/.github/workflows/test_docker_debian_v3.yml @@ -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 From 0b193231affffeb0b8df23a0f404664ba4e52e2f Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sat, 6 Jan 2024 15:35:08 +0100 Subject: [PATCH 35/70] reverted to https://deb.nodesource.com/ installation --- installation/routines/setup_jukebox_webapp.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index 794911bb0..0d27d1af3 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -52,11 +52,14 @@ _jukebox_webapp_install_node() { if [[ "$node_installed" == "v${NODE_MAJOR}."* ]]; then print_lc " Skipping. NodeJS already installed" else - sudo apt-get remove -y nodejs + sudo apt-get -y remove nodejs # install NodeJS as recommended in - # https://github.com/nodesource/distributions - curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | sudo bash - &&\ - sudo apt-get install -y nodejs + # https://deb.nodesource.com/ + sudo apt-get -y update && sudo apt-get -y install ca-certificates curl gnupg + sudo mkdir -p /etc/apt/keyrings + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list + sudo apt-get -y update && sudo apt-get -y install nodejs fi fi } From 72e7d0fc0e91a97c0f502812b9f24744d27de159 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sat, 6 Jan 2024 22:25:14 +0100 Subject: [PATCH 36/70] update docs --- .../developers/development-environment.md | 24 ++++++++++--------- resources/default-settings/gpio.example.yaml | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/documentation/developers/development-environment.md b/documentation/developers/development-environment.md index efbf17ec1..44b74d3b5 100644 --- a/documentation/developers/development-environment.md +++ b/documentation/developers/development-environment.md @@ -22,27 +22,29 @@ The full setup is running on the RPi and you access files via SSH. Pretty easy t We recommend to use at least a Pi 3 or Pi Zero 2 for development. This hardware won\'t be needed in production, but it can be slow while developing. 1. Install the latest Pi OS on a SD card. -2. Boot up your Raspberry Pi. -3. [Install](../builders/installation.md) the Jukebox software as if you were building a Phoniebox. You can install from your own fork and feature branch you wish which can be changed later as well. The original repository will be set as `upstream`. -4. Once the installation has successfully ran, reboot your Pi. -5. Due to some resource constraints, the Web App does not build the latest changes and instead consumes the latest official release. To change that, you need to install NodeJS and build the Web App locally. -6. Install NodeJS using the recommended nodesource setup (https://github.com/nodesource/distributions) +1. Boot up your Raspberry Pi. +1. [Install](../builders/installation.md) the Jukebox software as if you were building a Phoniebox. You can install from your own fork and feature branch you wish which can be changed later as well. The original repository will be set as `upstream`. +1. Once the installation has successfully ran, reboot your Pi. +1. Due to some resource constraints, the Web App does not build the latest changes and instead consumes the latest official release. To change that, you need to install NodeJS and build the Web App locally. +1. Install NodeJS using the recommended setup (https://deb.nodesource.com/) ``` bash - curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash - &&\ - sudo apt-get install -y nodejs + sudo apt-get -y update && sudo apt-get -y install ca-certificates curl gnupg + sudo mkdir -p /etc/apt/keyrings + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list + sudo apt-get -y update && sudo apt-get -y install nodejs ``` -7. To free up RAM, reboot your Pi. -8. Build the Web App using the existing build command. If the build fails, you might have forgotten to reboot. +1. Build the Web App using the existing build command. If the build fails, a reboot might help. ``` bash cd ~/RPi-Jukebox-RFID/src/webapp; \ ./run_rebuild.sh -u ``` -9. The Web App should now be updated. -10. To continuously update Web App, pull the latest changes from your repository and rerun the command above. +1. The Web App should now be updated. +1. To continuously update Web App, pull the latest changes from your repository and rerun the command above. ## Develop on local machine diff --git a/resources/default-settings/gpio.example.yaml b/resources/default-settings/gpio.example.yaml index 8f3d389b8..c30f5b8cc 100644 --- a/resources/default-settings/gpio.example.yaml +++ b/resources/default-settings/gpio.example.yaml @@ -1,5 +1,6 @@ # Provides a few selected examples of GPIO configuration # Check out the documentation for many more configuration recipes +# https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/future3/main/documentation/builders/gpio.md pin_factory: type: rpigpio.RPiGPIOFactory output_devices: From 2d6e6acca1fdd2d7eb98674148b052ed25403f35 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 7 Jan 2024 00:58:24 +0100 Subject: [PATCH 37/70] align fin message --- installation/routines/customize_options.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index 5eb90e56b..a198517e8 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -308,7 +308,7 @@ Do you want to build the Web App? [Y/n]" ;; *) # This message will be displayed at the end of the installation process - local tmp_fin_message="ATTENTION: You have installed from an unofficial branch. + local tmp_fin_message="ATTENTION: You have installed from an unofficial branch. If you make changes to the Web App sources you need to rebuild it locally with $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u From 0f4652b72d68d417b64ed330a28d225a9c9fabb8 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Mon, 8 Jan 2024 11:03:54 +0100 Subject: [PATCH 38/70] Update docs. Remove full URL references to branch --- documentation/builders/installation.md | 4 ++-- documentation/developers/docker.md | 2 +- documentation/developers/status.md | 2 +- resources/default-settings/gpio.example.yaml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index 20ae01e2b..c6eb8f2ad 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -97,8 +97,8 @@ cd; GIT_USER='MiczFlor' GIT_BRANCH='future3/develop' bash <(wget -qO- https://ra This will switch directly to the specified feature branch during installation. > [!NOTE] -> For all branches *except* the current Release future3/main, the Web App needs to be build locally on the Pi. This is part of the installation process. -> If you make changes to the Web App sources you need to rebuild it. See [Developer steps to install](../developers/development-environment.md#steps-to-install) +> For all branches *except* the current Release `future3/main`, the Web App needs to be build locally on the Pi. This is part of the installation process. +> If you make changes to the Web App sources you need to rebuild it manually. See [Developer steps to install](../developers/development-environment.md#steps-to-install) If you suspect an error you can monitor the installation-process with diff --git a/documentation/developers/docker.md b/documentation/developers/docker.md index 404ea15ca..70ac718e1 100644 --- a/documentation/developers/docker.md +++ b/documentation/developers/docker.md @@ -30,7 +30,7 @@ need to adapt some of those commands to your needs. $ cp ./resources/default-settings/jukebox.default.yaml ./shared/settings/jukebox.yaml ``` - * Override/Merge the values from the following [Override file](https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/future3/develop/docker/config/jukebox.overrides.yaml) in your `jukebox.yaml`. + * Override/Merge the values from the following [Override file](../../docker/config/jukebox.overrides.yaml) in your `jukebox.yaml`. * **\[Currently required\]** Update all relative paths (`../..`) in to `/home/pi/RPi-Jukebox-RFID`. 4. Change directory into the `./shared/audiofolders` diff --git a/documentation/developers/status.md b/documentation/developers/status.md index 2fb92897f..7058842e5 100644 --- a/documentation/developers/status.md +++ b/documentation/developers/status.md @@ -6,7 +6,7 @@ There are a few things that are specifically not integrated yet: playing streams In the following is the currently implemented feature list in more detail. It also shows some of the shortcomings. However, the list is _not complete in terms of planned features_, but probably _reflects more of where work is currently being put into_. -**For new contributors:** If you want to port a feature from version 2.X or implement a new feature, contact us. Open an issue or join us in the chat room. You may pick topics marked as open below, but also any other topic missing in the list below. As mentioned, that list is not complete in terms of open features. Check the [Contribution guide](https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/future3/main/CONTRIBUTING.md). +**For new contributors:** If you want to port a feature from version 2.X or implement a new feature, contact us. Open an issue or join us in the chat room. You may pick topics marked as open below, but also any other topic missing in the list below. As mentioned, that list is not complete in terms of open features. Check the [Contribution guide](../../CONTRIBUTING.md). Topics marked _in progress_ are already in the process of implementation by community members. diff --git a/resources/default-settings/gpio.example.yaml b/resources/default-settings/gpio.example.yaml index c30f5b8cc..59793210f 100644 --- a/resources/default-settings/gpio.example.yaml +++ b/resources/default-settings/gpio.example.yaml @@ -1,6 +1,6 @@ # Provides a few selected examples of GPIO configuration # Check out the documentation for many more configuration recipes -# https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/future3/main/documentation/builders/gpio.md +# documentation/builders/gpio.md pin_factory: type: rpigpio.RPiGPIOFactory output_devices: From b95295700e80e25b06cf8bdc3a88aa5b605a8517 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:35:03 +0100 Subject: [PATCH 39/70] ignore stderr if node is not installed before --- installation/routines/setup_jukebox_webapp.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index 0d27d1af3..c8f0aee4d 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -12,10 +12,10 @@ NODE_ARMv6_VERSION=v20.10.0 _jukebox_webapp_install_node() { print_lc " Install NodeJS" - local node_installed=$(node -v) + local node_version_installed=$(node -v 2>/dev/null) local arch=$(uname -m) if [[ "$arch" == "armv6l" ]]; then - if [ "$node_installed" == "$NODE_ARMv6_VERSION" ]; then + if [ "$node_version_installed" == "$NODE_ARMv6_VERSION" ]; then print_lc " Skipping. NodeJS already installed" else # For ARMv6 unofficial build @@ -49,7 +49,7 @@ _jukebox_webapp_install_node() { rm -rf "${node_tmp_dir}" fi else - if [[ "$node_installed" == "v${NODE_MAJOR}."* ]]; then + if [[ "$node_version_installed" == "v${NODE_MAJOR}."* ]]; then print_lc " Skipping. NodeJS already installed" else sudo apt-get -y remove nodejs @@ -119,9 +119,9 @@ _jukebox_webapp_check() { else local arch=$(uname -m) if [[ "$arch" == "armv6l" ]]; then - local node_installed=$(node -v) + local node_version_installed=$(node -v 2>/dev/null)) log " Verify 'node' is installed" - test ! "${node_installed}" == "${NODE_ARMv6_VERSION}" && exit_on_error "ERROR: 'node' not in expected version: '${node_installed}' instead of '${NODE_ARMv6_VERSION}'!" + test ! "${node_version_installed}" == "${NODE_ARMv6_VERSION}" && exit_on_error "ERROR: 'node' not in expected version: '${node_version_installed}' instead of '${NODE_ARMv6_VERSION}'!" log " CHECK" else verify_apt_packages nodejs From 86eebc0efa3c52c90221d3430a5234bda5a3f381 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:36:30 +0100 Subject: [PATCH 40/70] ignore stderr if node is not installed before --- installation/routines/setup_jukebox_webapp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index c8f0aee4d..cce5d9455 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -33,9 +33,9 @@ _jukebox_webapp_install_node() { # see https://github.com/nodejs/help/wiki/Installation # Remove existing symlinks - sudo unlink /usr/bin/node - sudo unlink /usr/bin/npm - sudo unlink /usr/bin/npx + sudo unlink /usr/bin/node 2>/dev/null + sudo unlink /usr/bin/npm 2>/dev/null + sudo unlink /usr/bin/npx 2>/dev/null # Clear existing nodejs and copy new files sudo rm -rf "${node_install_dir}" From cdff8fa7c61f976c22abfa20b21d89d52bad7c25 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:45:04 +0100 Subject: [PATCH 41/70] bugfix. removed additional char --- installation/routines/setup_jukebox_webapp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index cce5d9455..9d29cbeb2 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -119,7 +119,7 @@ _jukebox_webapp_check() { else local arch=$(uname -m) if [[ "$arch" == "armv6l" ]]; then - local node_version_installed=$(node -v 2>/dev/null)) + local node_version_installed=$(node -v 2>/dev/null) log " Verify 'node' is installed" test ! "${node_version_installed}" == "${NODE_ARMv6_VERSION}" && exit_on_error "ERROR: 'node' not in expected version: '${node_version_installed}' instead of '${NODE_ARMv6_VERSION}'!" log " CHECK" From 4c0c18d4ed7a65f464e37de51c739e14b44ba4e3 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 08:01:04 +0100 Subject: [PATCH 42/70] add npm project config better network handling especially for armv6l devices --- src/webapp/.npmrc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/webapp/.npmrc diff --git a/src/webapp/.npmrc b/src/webapp/.npmrc new file mode 100644 index 000000000..013ffc27f --- /dev/null +++ b/src/webapp/.npmrc @@ -0,0 +1,2 @@ +fetch-retries=5 +fetch-retry-maxtimeout=120000 From e6109c33ef705041b392644145931e8422ddf911 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 09:43:40 +0100 Subject: [PATCH 43/70] use performance optimized install command update warning for armv6l devices --- src/webapp/run_rebuild.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 6f2a5d732..7233f7d64 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -125,20 +125,25 @@ echo "Setting Node Options:" env | grep NODE if [[ $(uname -m) == armv6l ]]; then - echo " You are running a hardware with limited resources. Building - the Web App might fail. If so, try to install the stable - release installation instead." + echo " +----------------------------------------------------------- +| You are running a hardware with limited resources. | +| Building the Web App takes significantly more time | +| and might fail. | +| Its recommended to use an official release installation | +| which already bundles the webapp. | +----------------------------------------------------------- +" fi if [[ $UPDATE_DEPENDENCIES == true ]]; then - npm install - # TODO this was used in the install script (not activated for some time). Is one of the options prefered? - # npm ci --prefer-offline --no-audit --production + npm install --prefer-offline --no-audit fi +build_output_folder="build" # Rebuild Web App -rm -rf build.bak -if [ -d "build" ]; then - mv -f build build.bak +rm -rf "${build_output_folder}.bak" +if [ -d "${build_output_folder}" ]; then + mv -f "${build_output_folder}" "${build_output_folder}.bak" fi npm run build From a5f36427966b4ad19286a560d4be6ad68cd13833 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 11:46:12 +0100 Subject: [PATCH 44/70] Update docs Update installation steps. split for version. add tip from installation- Add webapp doc for developers. update docs and link to new webapp doc. eliminate duplications. merged developer-issues into new webapp doc --- documentation/builders/installation.md | 39 ++++-- documentation/builders/update.md | 2 +- documentation/developers/README.md | 1 + documentation/developers/developer-issues.md | 86 ------------ .../developers/development-environment.md | 31 +---- documentation/developers/webapp.md | 126 ++++++++++++++++++ 6 files changed, 163 insertions(+), 122 deletions(-) delete mode 100644 documentation/developers/developer-issues.md create mode 100644 documentation/developers/webapp.md diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index c6eb8f2ad..7d1c2bf3f 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -79,31 +79,52 @@ You will need a terminal, like PuTTY for Windows or the Terminal app for Mac to ## Install Phoniebox software -Run the following command in your SSH terminal and follow the instructions +Run a following command in your SSH terminal and follow the instructions. +After successful installation, continue with [configuring your Phoniebox](configuration.md). + +> [!TIP] +> Depending on your hardware, this installation might last +around 60 minutes (usually it's faster). It updates OS +packages, installs Phoniebox dependencies and registers +settings. Be patient and don't let your computer go to +sleep. It might disconnect your SSH connection causing +the interruption of the installation process. +Consider starting the installation in a terminal +multiplexer like 'screen' or 'tmux' to avoid this. + +### Stable Release +This will install the latest **stable release** from the branch *future3/main*. ```bash cd; bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/main/installation/install-jukebox.sh) ``` -This will get the latest **stable release** from the branch *future3/main*. -To install directly from a specific branch and/or a different repository -specify the variables like this: + +### Pre-Release +This will install the latest **pre-release** from the branch *future3/develop*. ```bash -cd; GIT_USER='MiczFlor' GIT_BRANCH='future3/develop' bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/develop/installation/install-jukebox.sh) +cd; GIT_BRANCH='future3/develop' bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/develop/installation/install-jukebox.sh) ``` -This will switch directly to the specified feature branch during installation. +### Development +To install directly from a specific branch and/or a different repository specify the variables like this. Make sure you also update the URL accordingly to the branch and fork used. +> [!IMPORTANT] +>A fork repository must be named '*RPi-Jukebox-RFID*' like the official repository + +```bash +cd; GIT_USER='MiczFlor' GIT_BRANCH='future3/develop' bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/develop/installation/install-jukebox.sh) +``` > [!NOTE] > For all branches *except* the current Release `future3/main`, the Web App needs to be build locally on the Pi. This is part of the installation process. -> If you make changes to the Web App sources you need to rebuild it manually. See [Developer steps to install](../developers/development-environment.md#steps-to-install) +> If you make changes to the Web App sources you need to rebuild it manually. See the developers [Web App](../developers/webapp.md) documentation. -If you suspect an error you can monitor the installation-process with +### Logs +If you suspect an error you can monitor the installation process with ```bash cd; tail -f INSTALL-.log ``` -After successful installation, continue with [configuring your Phoniebox](configuration.md). diff --git a/documentation/builders/update.md b/documentation/builders/update.md index f6dab2c91..94baf0a93 100644 --- a/documentation/builders/update.md +++ b/documentation/builders/update.md @@ -29,7 +29,7 @@ $ git pull $ diff shared/settings/jukebox.yaml resources/default-settings/jukebox.default.yaml $ cd src/webapp -$ ./run_rebuild.sh +$ ./run_rebuild.sh -u ``` ## Migration Path from Version 2 diff --git a/documentation/developers/README.md b/documentation/developers/README.md index 64fee44c1..cfa389713 100644 --- a/documentation/developers/README.md +++ b/documentation/developers/README.md @@ -8,6 +8,7 @@ ## Reference * [Jukebox Apps](./coreapps.md) +* [Web App](./webapp.md) * [RFID Readers](./rfid) * [Feature Status](./status.md) * [Known Issues](./known-issues.md) diff --git a/documentation/developers/developer-issues.md b/documentation/developers/developer-issues.md deleted file mode 100644 index 999e70a17..000000000 --- a/documentation/developers/developer-issues.md +++ /dev/null @@ -1,86 +0,0 @@ -# Developer Issues - -## Building the Web App on the PI - -### JavaScript heap out of memory - -While (re-) building the Web App, you get the following output: - -``` {.bash emphasize-lines="12"} -pi@MusicPi:~/RPi-Jukebox-RFID/src/webapp $ npm run build - -> webapp@0.1.0 build -> react-scripts build - -Creating an optimized production build... - -[...] - -<--- JS stacktrace ---> - -FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory -``` - -#### Reason - -Not enough memory for Node - -#### Solution - -Prior to building set the node memory environment variable. - -1. Make sure the value is less than the total available space on the - system, or you may run into the next issue. (Not always though!) - Check memory availability with `free -mt`. -2. We also experience trouble, when the space is set too small a - value. 512 always works, 256 sometimes does, sometimes does not. - If your free memory is small, consider increasing the swap size of - your system! - -``` bash -export NODE_OPTIONS=--max-old-space-size=512 -npm run build -``` - -Alternatively, use the provided script, which sets the variable for you -(provided your swap size is large enough): - -``` bash -$ cd src/webapp -$ ./run_rebuild.sh -``` - -#### Changing Swap Size - -This will set the swapsize to 512 MB (and will deactivate swapfactor). Change accordingly if you have a SD Card with small capacity. - -```bash -sudo dphys-swapfile swapoff -sudo sed -i "s|.*CONF_SWAPSIZE=.*|CONF_SWAPSIZE=512|g" /etc/dphys-swapfile -sudo sed -i "s|^\s*CONF_SWAPFACTOR=|#CONF_SWAPFACTOR=|g" /etc/dphys-swapfile -sudo dphys-swapfile setup -sudo dphys-swapfile swapon -``` - -### Process exited too early // kill -9 - -``` {.bash emphasize-lines="8,9"} -pi@MusicPi:~/RPi-Jukebox-RFID/src/webapp $ npm run build - -> webapp@0.1.0 build -> react-scripts build - -... - -The build failed because the process exited too early. -This probably means the system ran out of memory or someone called 'kill -9' on the process. -``` - -#### Reason - -Node tried to allocate more memory than available on the system. - -#### Solution - -Adjust the node memory variable as described in [JavaScript heap out of memory](#javascript-heap-out-of-memory). But make sure to allocate less memory than the available memory. If that is not sufficient, increase the swap file size of your -system and try again. diff --git a/documentation/developers/development-environment.md b/documentation/developers/development-environment.md index 44b74d3b5..49a6ef97e 100644 --- a/documentation/developers/development-environment.md +++ b/documentation/developers/development-environment.md @@ -15,36 +15,15 @@ There is a complete [Docker setup](./docker.md). ## Develop on Raspberry Pi -The full setup is running on the RPi and you access files via SSH. Pretty easy to set up as you simply do a normal install and switch to the `future3/develop` branch. +The full setup is running on the RPi and you access files via SSH. ### Steps to install -We recommend to use at least a Pi 3 or Pi Zero 2 for development. This hardware won\'t be needed in production, but it can be slow while developing. +We recommend to use at least a Pi 3 or Pi Zero 2 for development. While this hardware won\'t be needed in production, it comes in helpful while developing. -1. Install the latest Pi OS on a SD card. -1. Boot up your Raspberry Pi. -1. [Install](../builders/installation.md) the Jukebox software as if you were building a Phoniebox. You can install from your own fork and feature branch you wish which can be changed later as well. The original repository will be set as `upstream`. -1. Once the installation has successfully ran, reboot your Pi. -1. Due to some resource constraints, the Web App does not build the latest changes and instead consumes the latest official release. To change that, you need to install NodeJS and build the Web App locally. -1. Install NodeJS using the recommended setup (https://deb.nodesource.com/) - - ``` bash - sudo apt-get -y update && sudo apt-get -y install ca-certificates curl gnupg - sudo mkdir -p /etc/apt/keyrings - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list - sudo apt-get -y update && sudo apt-get -y install nodejs - ``` - -1. Build the Web App using the existing build command. If the build fails, a reboot might help. - - ``` bash - cd ~/RPi-Jukebox-RFID/src/webapp; \ - ./run_rebuild.sh -u - ``` - -1. The Web App should now be updated. -1. To continuously update Web App, pull the latest changes from your repository and rerun the command above. +1. Follow the [installation preperation](../builders/installation.md#install-raspberry-pi-os-lite) steps +1. [Install](../builders/installation.md#development) the pre-release branch of the Jukebox software. You can also install from your own fork and feature branch. The original repository will be set as `upstream`. +1. If neccessary [build the Web App](./webapp.md) locally ## Develop on local machine diff --git a/documentation/developers/webapp.md b/documentation/developers/webapp.md new file mode 100644 index 000000000..fc85e482d --- /dev/null +++ b/documentation/developers/webapp.md @@ -0,0 +1,126 @@ +# Web App + +The Web App is located in `src/webapp`. During installation from the official repositories release branches a prebuilt bundle of the Web App is deployed. If you install a feature branch or from a fork repository the Web App needs to be build locally. This requires Node to be installed and is part of the installation process. + +## Install node manually + +If you installed an official release branch Node might not be installed (focus on builders). To add this for local development you can run the recommended setup (https://deb.nodesource.com/) + +``` bash +sudo apt-get -y update && sudo apt-get -y install ca-certificates curl gnupg +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list +sudo apt-get -y update && sudo apt-get -y install nodejs +``` + +## Build the Web App + +After changes to the Web App sources (locally or caused by a pull from the repository) it needs to be rebuild manually. +Use the provided script to rebuild whenever needed. + +``` bash +cd ~/RPi-Jukebox-RFID/src/webapp; \ +./run_rebuild.sh -u +``` + +## Known Issues while building + +### JavaScript heap out of memory + +While (re-) building the Web App, you get the following output: + +``` {.bash emphasize-lines="12"} +> webapp@0.1.0 build +> react-scripts build + +Creating an optimized production build... + +[...] + +<--- JS stacktrace ---> + +FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory +``` + +#### Reason + +Not enough memory for Node + +#### Solution + +Use the [provided script](#build-the-web-app) to rebuild the Web App. It sets the needed node options and also checks and adjusts the swap size if there is not enough memory available. + +If you need to run the commands manually, make sure to have enough memory available (min. 512 MB). The following commands might help. + +Set the swapsize to 512 MB (and deactivate swapfactor). Change accordingly if you have a SD Card with small capacity. +```bash +sudo dphys-swapfile swapoff +sudo sed -i "s|.*CONF_SWAPSIZE=.*|CONF_SWAPSIZE=512|g" /etc/dphys-swapfile +sudo sed -i "s|^\s*CONF_SWAPFACTOR=|#CONF_SWAPFACTOR=|g" /etc/dphys-swapfile +sudo dphys-swapfile setup +sudo dphys-swapfile swapon +``` + +Set the maximum amount of memory for node to use. Memory must be available. +``` bash +export NODE_OPTIONS=--max-old-space-size=512 +npm run build +``` + +### Process exited too early // kill -9 + +``` {.bash emphasize-lines="8,9"} +> webapp@0.1.0 build +> react-scripts build + +[...] + +The build failed because the process exited too early. +This probably means the system ran out of memory or someone called 'kill -9' on the process. +``` + +#### Reason + +Node tried to allocate more memory than available on the system. + +#### Solution + +See [JavaScript heap out of memory](#javascript-heap-out-of-memory) + + +### Client network socket disconnected + +``` {.bash emphasize-lines="8,9"} +[...] + +npm ERR! code ECONNRESET +npm ERR! network Client network socket disconnected before secure TLS connection was established +npm ERR! network This is a problem related to network connectivity. +npm ERR! network In most cases you are behind a proxy or have bad network settings. +npm ERR! network +npm ERR! network If you are behind a proxy, please make sure that the +npm ERR! network 'proxy' config is set properly. See: 'npm help config' +``` + +#### Reason + +The network connection is to slow or has issues. +This can also happens on armv6l devices where the build takes significantly longer due to the limited resources. + +#### Solution + +Try to use an ethernet connection. Also reboot might help. If the error still persists (or there is no ethernet port on your devices) try to raise the timeout for npm package resolution. + +1. Check the current config value (default is 120000) + ``` bash + npm config --location project get fetch-retry-maxtimeout + ``` + +1. Increase the value by '30000' (30 seconds) and set the new value + ``` bash + npm config --location project set fetch-retry-maxtimeout=xxx + ``` + +1. Retry the build + From 4c6f01b51078b610aeb112ec5178860bad03d082 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 12:14:50 +0100 Subject: [PATCH 45/70] also raise fetch-retry-mintimeout --- src/webapp/.npmrc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webapp/.npmrc b/src/webapp/.npmrc index 013ffc27f..f09b5b82b 100644 --- a/src/webapp/.npmrc +++ b/src/webapp/.npmrc @@ -1,2 +1,3 @@ fetch-retries=5 +fetch-retry-mintimeout=20000 fetch-retry-maxtimeout=120000 From 285b6237cce90b923e4608f97a693e02de6277c7 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:13:43 +0100 Subject: [PATCH 46/70] update docs harmonize wording for webapp. add build output. change ARMv6 installation note. --- documentation/builders/installation.md | 4 +--- documentation/builders/system.md | 6 +++--- documentation/developers/webapp.md | 5 +++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index 7d1c2bf3f..1f67e36ee 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -3,7 +3,7 @@ ## Install Raspberry Pi OS Lite > [!IMPORTANT] -> Currently, the installation does only work on Raspberry Pi's with ARMv7 and ARMv8 architecture, so 2, 3 and 4! Pi 1 and Zero's are currently unstable and will require a bit more work! Pi 4 and 5 are an excess ;-) +> Currently, the installation does work on all Raspberry Pi models. But ARMv6 models (Pi 1 and Zero 1) have limited resources and are potentially unstable and will require a bit more work! Pi 4 and 5 are an excess ;-) Before you can install the Phoniebox software, you need to prepare your Raspberry Pi. @@ -99,8 +99,6 @@ This will install the latest **stable release** from the branch *future3/main*. cd; bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/main/installation/install-jukebox.sh) ``` - - ### Pre-Release This will install the latest **pre-release** from the branch *future3/develop*. diff --git a/documentation/builders/system.md b/documentation/builders/system.md index 2f7df8888..cd8cfce60 100644 --- a/documentation/builders/system.md +++ b/documentation/builders/system.md @@ -7,7 +7,7 @@ The system consists of 1. [Music Player Daemon (MPD)](system.md#music-player-daemon-mpd) which we use for all music playback (local, stream, podcast, ...) 2. [PulseAudio](system.md#pulseaudio) for flexible audio output support 3. [Jukebox Core Service](system.md#jukebox-core-service) for controlling MPD and PulseAudio and providing all the features -4. [Web UI](system.md#web-ui) which is served through an Nginx web server +4. [Web App](system.md#web-app-ui) as UI in a web browser 5. A set of [Configuration Tools](../developers/coreapps.md#configuration-tools) and a set of [Developer Tools](../developers/coreapps.md#developer-tools) > [!NOTE] The default install puts everything into the users home folder `~/RPi-Jukebox-RFID`. @@ -96,9 +96,9 @@ The `systemd` service file is located at the default location for user services: Starting and stopping the service can be useful for debugging or configuration checks. -## Web UI +## Web App (UI) -The Web UI is served using nginx. Nginx runs as a system service. The home directory is localed at +The [Web App](../developers/webapp.md) is served using nginx. Nginx runs as a system service. The home directory is localed at ```text ./src/webapp/build diff --git a/documentation/developers/webapp.md b/documentation/developers/webapp.md index fc85e482d..a95758fb2 100644 --- a/documentation/developers/webapp.md +++ b/documentation/developers/webapp.md @@ -1,6 +1,6 @@ # Web App -The Web App is located in `src/webapp`. During installation from the official repositories release branches a prebuilt bundle of the Web App is deployed. If you install a feature branch or from a fork repository the Web App needs to be build locally. This requires Node to be installed and is part of the installation process. +The Web App sources located in `src/webapp`. During installation from the official repositories release branches a prebuilt bundle of the Web App is deployed. If you install a feature branch or from a fork repository the Web App needs to be build locally. This requires Node to be installed and is part of the installation process. ## Install node manually @@ -17,7 +17,8 @@ sudo apt-get -y update && sudo apt-get -y install nodejs ## Build the Web App After changes to the Web App sources (locally or caused by a pull from the repository) it needs to be rebuild manually. -Use the provided script to rebuild whenever needed. +Use the provided script to rebuild whenever needed. The result is written to the folder `build`. +``` ``` bash cd ~/RPi-Jukebox-RFID/src/webapp; \ From 8ab712ef40f8bc1c47897d5c78169bf5e38c54c9 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:20:28 +0100 Subject: [PATCH 47/70] add note for webserver restart --- documentation/developers/webapp.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/documentation/developers/webapp.md b/documentation/developers/webapp.md index a95758fb2..bdb75da95 100644 --- a/documentation/developers/webapp.md +++ b/documentation/developers/webapp.md @@ -25,6 +25,11 @@ cd ~/RPi-Jukebox-RFID/src/webapp; \ ./run_rebuild.sh -u ``` +After the successfull build you might need to restart the web server. +``` +sudo systemctl restart nginx.service +``` + ## Known Issues while building ### JavaScript heap out of memory From e180ea3e0f3355151289a2196e88503164f2a4c7 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:51:34 +0100 Subject: [PATCH 48/70] update installation docs. add bullet list --- documentation/builders/installation.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index 1f67e36ee..e75344e06 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -79,7 +79,11 @@ You will need a terminal, like PuTTY for Windows or the Terminal app for Mac to ## Install Phoniebox software -Run a following command in your SSH terminal and follow the instructions. +Choose a version, run the corresponding install command in your SSH terminal and follow the instructions. +* [Stable Release](#stable-release) +* [Pre-Release](#pre-release) +* [Development](#development) + After successful installation, continue with [configuring your Phoniebox](configuration.md). > [!TIP] From 1f33e41d91d3cf9fac5c3dc7e2ea1960f61b2178 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 15:26:52 +0100 Subject: [PATCH 49/70] change npm config values --- src/webapp/.npmrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webapp/.npmrc b/src/webapp/.npmrc index f09b5b82b..b1e06e471 100644 --- a/src/webapp/.npmrc +++ b/src/webapp/.npmrc @@ -1,3 +1,3 @@ fetch-retries=5 -fetch-retry-mintimeout=20000 -fetch-retry-maxtimeout=120000 +fetch-retry-mintimeout=50000 +fetch-retry-maxtimeout=300000 From 7def6538127edeb16c69cc3a621233808fc073a7 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:11:45 +0100 Subject: [PATCH 50/70] show "slow hardware message" at installation start --- installation/includes/02_helpers.sh | 11 +++++++++++ installation/routines/install.sh | 1 + installation/routines/setup_jukebox_core.sh | 13 ------------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/installation/includes/02_helpers.sh b/installation/includes/02_helpers.sh index 239a18ccf..e9ca7640e 100644 --- a/installation/includes/02_helpers.sh +++ b/installation/includes/02_helpers.sh @@ -2,6 +2,17 @@ ### Helpers +show_slow_hardware_message() { + if [[ $(uname -m) == "armv6l" ]]; then + print_c "-------------------------------------------------------------------- +| Your hardware is a little slower so this will take a while. | +| Go watch a movie but don't let your computer go to sleep for the | +| SSH connection to remain intact. | +-------------------------------------------------------------------- +" + fi +} + # $1->start, $2->end calc_runtime_and_print() { runtime=$(($2-$1)) diff --git a/installation/routines/install.sh b/installation/routines/install.sh index 62d602f17..f1f2a5f80 100644 --- a/installation/routines/install.sh +++ b/installation/routines/install.sh @@ -2,6 +2,7 @@ install() { clear_c customize_options clear_c + show_slow_hardware_message set_raspi_config set_ssh_qos update_raspi_os diff --git a/installation/routines/setup_jukebox_core.sh b/installation/routines/setup_jukebox_core.sh index 1c524abb0..d9c06b937 100644 --- a/installation/routines/setup_jukebox_core.sh +++ b/installation/routines/setup_jukebox_core.sh @@ -8,14 +8,6 @@ JUKEBOX_ZMQ_VERSION="4.3.5" JUKEBOX_PULSE_CONFIG="${HOME_PATH}"/.config/pulse/default.pa JUKEBOX_SERVICE_NAME="${SYSTEMD_USR_PATH}/jukebox-daemon.service" -_show_slow_hardware_message() { - print_c " -------------------------------------------------------------------- - | Your hardware is a little slower so this step will take a while. | - | Go watch a movie but don't let your computer go to sleep for the | - | SSH connection to remain intact. | - --------------------------------------------------------------------" -} - # Functions _jukebox_core_install_os_dependencies() { print_lc " Install Jukebox OS dependencies" @@ -86,11 +78,6 @@ _jukebox_core_build_and_install_pyzmq() { print_lc " Install pyzmq with libzmq-drafts to support WebSockets" if ! pip list | grep -F pyzmq >> /dev/null; then - - if [[ $(uname -m) == "armv6l" ]]; then - _show_slow_hardware_message - fi - mkdir -p "${JUKEBOX_ZMQ_TMP_DIR}" || exit_on_error if [ "$BUILD_LIBZMQ_WITH_DRAFTS_ON_DEVICE" = true ] ; then _jukebox_core_build_libzmq_with_drafts From ddc623f625c58e4a468ba513df4161122fef52ad Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:13:29 +0100 Subject: [PATCH 51/70] update armv6l warning for webapp rebuild --- src/webapp/run_rebuild.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 7233f7d64..063dcad2c 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -130,8 +130,6 @@ if [[ $(uname -m) == armv6l ]]; then | You are running a hardware with limited resources. | | Building the Web App takes significantly more time | | and might fail. | -| Its recommended to use an official release installation | -| which already bundles the webapp. | ----------------------------------------------------------- " fi From e91bce6325db962498fba7d0c01f131c4d970ca7 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:28:01 +0100 Subject: [PATCH 52/70] make script return value more clear --- src/webapp/run_rebuild.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 063dcad2c..8b4b538e2 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -144,4 +144,7 @@ rm -rf "${build_output_folder}.bak" if [ -d "${build_output_folder}" ]; then mv -f "${build_output_folder}" "${build_output_folder}.bak" fi -npm run build +if ! npm run build ; then + echo "ERROR: rebuild of Web App failed!" + exit 1 +fi From f6e323c4970a8407228ea8cd12cd5ecc9c879fe4 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 19:38:42 +0100 Subject: [PATCH 53/70] Make local webapp build an optional step due to unpredictable npm connection errors. Show webapp fin message only if webapp build fails --- installation/includes/00_constants.sh | 3 +++ installation/routines/customize_options.sh | 7 ------ installation/routines/setup_jukebox_webapp.sh | 22 +++++++++++++++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/installation/includes/00_constants.sh b/installation/includes/00_constants.sh index 380e1de2e..89299989c 100644 --- a/installation/includes/00_constants.sh +++ b/installation/includes/00_constants.sh @@ -16,4 +16,7 @@ GIT_BRANCH_DEVELOP=${GIT_BRANCH_DEVELOP:-future3/develop} # This message will be displayed at the end of the installation process # Functions wanting to have something important printed at the end should APPEND to this variable +# example: +# local tmp_fin_message="A Message" +# FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" FIN_MESSAGE="" diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index a198517e8..2af8c4183 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -307,13 +307,6 @@ Do you want to build the Web App? [Y/n]" ENABLE_WEBAPP_PROD_DOWNLOAD=true ;; *) - # This message will be displayed at the end of the installation process - local tmp_fin_message="ATTENTION: You have installed from an unofficial branch. - If you make changes to the Web App sources - you need to rebuild it locally with - $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u - Read the documentation regarding local Web App builds!" - FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" ;; esac fi diff --git a/installation/routines/setup_jukebox_webapp.sh b/installation/routines/setup_jukebox_webapp.sh index 9d29cbeb2..7fcbce7ff 100644 --- a/installation/routines/setup_jukebox_webapp.sh +++ b/installation/routines/setup_jukebox_webapp.sh @@ -9,6 +9,8 @@ NODE_MAJOR=20 # Node version for ARMv6 (unofficial builds) NODE_ARMv6_VERSION=v20.10.0 +OPTIONAL_WEBAPP_BUILD_FAILED=false + _jukebox_webapp_install_node() { print_lc " Install NodeJS" @@ -65,9 +67,19 @@ _jukebox_webapp_install_node() { } _jukebox_webapp_build() { - print_lc " Building Web App" - cd "${INSTALLATION_PATH}/src/webapp" || exit_on_error - ./run_rebuild.sh -u + print_lc " Building Web App" + cd "${INSTALLATION_PATH}/src/webapp" || exit_on_error + if ! ./run_rebuild.sh -u ; then + print_lc " Web App build failed! + Follow instructions shown at the end of installation!" + OPTIONAL_WEBAPP_BUILD_FAILED=true + # This message will be displayed at the end of the installation process + local tmp_fin_message="ATTENTION: The build of the Web App failed during installation. + Please run the build manually with the following command + $ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u + Read the documentation regarding local Web App builds!" + FIN_MESSAGE="${FIN_MESSAGE:+$FIN_MESSAGE\n}${tmp_fin_message}" + fi } _jukebox_webapp_download() { @@ -127,7 +139,9 @@ _jukebox_webapp_check() { verify_apt_packages nodejs fi - verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" + if [[ "$OPTIONAL_WEBAPP_BUILD_FAILED" == false ]]; then + verify_dirs_exists "${INSTALLATION_PATH}/src/webapp/build" + fi fi verify_apt_packages nginx From 65516697499716f5174f27ab0ab8a7f6f15b5cb3 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:31:37 +0100 Subject: [PATCH 54/70] use prebuilt webapp bundle also for develop --- documentation/builders/installation.md | 4 ++-- installation/routines/customize_options.sh | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index e75344e06..3edbf0c23 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -120,8 +120,8 @@ cd; GIT_USER='MiczFlor' GIT_BRANCH='future3/develop' bash <(wget -qO- https://ra ``` > [!NOTE] -> For all branches *except* the current Release `future3/main`, the Web App needs to be build locally on the Pi. This is part of the installation process. -> If you make changes to the Web App sources you need to rebuild it manually. See the developers [Web App](../developers/webapp.md) documentation. +> Installation of the official repositories release branches ([Stable Release](#stable-release) and [Pre-Release](#pre-release)) will deploy a prebuilt bundle of the Web App. +> If you install another branch or from a fork repository the Web App needs to be build locally. This is part of the installation process. See the the developers [Web App](../developers/webapp.md) documentation for further details. ### Logs If you suspect an error you can monitor the installation process with diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index 2af8c4183..c509b2e5a 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -282,7 +282,7 @@ Disable Pi's on-chip audio (headphone / jack output)? [y/N]" _option_webapp_devel_build() { # Let's detect if we are on the official release branch - if [[ "$GIT_BRANCH" != "${GIT_BRANCH_RELEASE}" || "$GIT_USER" != "$GIT_UPSTREAM_USER" || "$CI_RUNNING" == "true" ]]; then + if [[ "$GIT_BRANCH" != "${GIT_BRANCH_RELEASE}" && "$GIT_BRANCH" != "${GIT_BRANCH_DEVELOP}" ]] || [[ "$GIT_USER" != "$GIT_UPSTREAM_USER" ]] || [[ "$CI_RUNNING" == "true" ]] ; then # Unless ENABLE_WEBAPP_PROD_DOWNLOAD is forced to true by user override, do not download a potentially stale build if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == "release-only" ]]; then ENABLE_WEBAPP_PROD_DOWNLOAD=false @@ -291,13 +291,14 @@ _option_webapp_devel_build() { clear_c print_c "--------------------- WEB APP BUILD --------------------- -You are installing from an unofficial branch. -Therefore a prebuilt Web App is not available and -it needs to be build locally. +You are installing from a non-release branch +and/or an unofficial repository. +Therefore a prebuilt Web App is not available +and it needs to be build locally. This requires Node to be installed. -If you choose to decline the lastest prebuilt -version from the main repository will be installed. +If you choose to decline the lastest prebuilt version +from the official repository will be installed. This can lead to incompatibilities. Do you want to build the Web App? [Y/n]" From fa98ccc3ad9c846fce4441e8384a450e66e59c3a Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sat, 13 Jan 2024 00:19:06 +0100 Subject: [PATCH 55/70] update docs --- documentation/builders/installation.md | 2 +- documentation/builders/system.md | 2 +- documentation/developers/development-environment.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index 3edbf0c23..fec273f8c 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -111,7 +111,7 @@ cd; GIT_BRANCH='future3/develop' bash <(wget -qO- https://raw.githubusercontent. ``` ### Development -To install directly from a specific branch and/or a different repository specify the variables like this. Make sure you also update the URL accordingly to the branch and fork used. +To install directly from a specific branch and/or a fork repository specify the variables like this. Make sure you also update the URL accordingly to the branch and repository used. > [!IMPORTANT] >A fork repository must be named '*RPi-Jukebox-RFID*' like the official repository diff --git a/documentation/builders/system.md b/documentation/builders/system.md index cd8cfce60..daa7b7bbc 100644 --- a/documentation/builders/system.md +++ b/documentation/builders/system.md @@ -98,7 +98,7 @@ Starting and stopping the service can be useful for debugging or configuration c ## Web App (UI) -The [Web App](../developers/webapp.md) is served using nginx. Nginx runs as a system service. The home directory is localed at +The [Web App](../developers/webapp.md) is served using nginx. Nginx runs as a system service. The home directory is located at ```text ./src/webapp/build diff --git a/documentation/developers/development-environment.md b/documentation/developers/development-environment.md index 49a6ef97e..d2d995919 100644 --- a/documentation/developers/development-environment.md +++ b/documentation/developers/development-environment.md @@ -22,7 +22,7 @@ The full setup is running on the RPi and you access files via SSH. We recommend to use at least a Pi 3 or Pi Zero 2 for development. While this hardware won\'t be needed in production, it comes in helpful while developing. 1. Follow the [installation preperation](../builders/installation.md#install-raspberry-pi-os-lite) steps -1. [Install](../builders/installation.md#development) the pre-release branch of the Jukebox software. You can also install from your own fork and feature branch. The original repository will be set as `upstream`. +1. [Install](../builders/installation.md#development) your feature/fork branch of the Jukebox software. The official repository will be set as `upstream`. 1. If neccessary [build the Web App](./webapp.md) locally ## Develop on local machine From bccc95cdc330b37f7d9c8670e6af3f48f988f171 Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sat, 13 Jan 2024 22:40:04 +0100 Subject: [PATCH 56/70] Update webapp.md --- documentation/developers/webapp.md | 35 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/documentation/developers/webapp.md b/documentation/developers/webapp.md index bdb75da95..e7cbd10c7 100644 --- a/documentation/developers/webapp.md +++ b/documentation/developers/webapp.md @@ -1,10 +1,10 @@ # Web App -The Web App sources located in `src/webapp`. During installation from the official repositories release branches a prebuilt bundle of the Web App is deployed. If you install a feature branch or from a fork repository the Web App needs to be build locally. This requires Node to be installed and is part of the installation process. +The Web App sources are located in `src/webapp`. A pre-built bundle of the Web App is deployed during when installing from the release branch (`main`). If you install from a feature branch or from a fork repository, the Web App needs to be built locally. This requires Node to be installed and is part of the installation process. ## Install node manually -If you installed an official release branch Node might not be installed (focus on builders). To add this for local development you can run the recommended setup (https://deb.nodesource.com/) +If you installed an official release branch, Node might not be installed. To install Node for local development, follow the [official setup](https://deb.nodesource.com/). ``` bash sudo apt-get -y update && sudo apt-get -y install ca-certificates curl gnupg @@ -14,18 +14,28 @@ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.co sudo apt-get -y update && sudo apt-get -y install nodejs ``` -## Build the Web App +## Develop the Web App + +The Web App is a React application based on [Create React App](https://create-react-app.dev/). To start a development server, run the following command: -After changes to the Web App sources (locally or caused by a pull from the repository) it needs to be rebuild manually. -Use the provided script to rebuild whenever needed. The result is written to the folder `build`. +``` +cd ~/RPi-Jukebox-RFID/src/webapp +npm install # Just the first time or when dependencies change +npm start ``` -``` bash +## Build the Web App + +To build your Web App after its source code has changed (e.g. through a local change or through a pull from the repository), it needs to be rebuilt manually. +Use the provided script to rebuild whenever required. The artifacts can be found in the folder `build`. + +```bash cd ~/RPi-Jukebox-RFID/src/webapp; \ ./run_rebuild.sh -u ``` -After the successfull build you might need to restart the web server. +After a successfull build you might need to restart the web server. + ``` sudo systemctl restart nginx.service ``` @@ -59,7 +69,7 @@ Use the [provided script](#build-the-web-app) to rebuild the Web App. It sets th If you need to run the commands manually, make sure to have enough memory available (min. 512 MB). The following commands might help. -Set the swapsize to 512 MB (and deactivate swapfactor). Change accordingly if you have a SD Card with small capacity. +Set the swapsize to 512 MB (and deactivate swapfactor). Adapt accordingly if you have a SD Card with small capacity. ```bash sudo dphys-swapfile swapoff sudo sed -i "s|.*CONF_SWAPSIZE=.*|CONF_SWAPSIZE=512|g" /etc/dphys-swapfile @@ -68,7 +78,7 @@ sudo dphys-swapfile setup sudo dphys-swapfile swapon ``` -Set the maximum amount of memory for node to use. Memory must be available. +Set Node's maximum amount of memory. Memory must be available. ``` bash export NODE_OPTIONS=--max-old-space-size=512 npm run build @@ -111,12 +121,12 @@ npm ERR! network 'proxy' config is set properly. See: 'npm help config' #### Reason -The network connection is to slow or has issues. -This can also happens on armv6l devices where the build takes significantly longer due to the limited resources. +The network connection is too slow or has issues. +This tends to happen on `armv6l` devices where building takes significantly more time due to limited resources. #### Solution -Try to use an ethernet connection. Also reboot might help. If the error still persists (or there is no ethernet port on your devices) try to raise the timeout for npm package resolution. +Try to use an ethernet connection. A reboot might also help. If the error still persists (or there is no ethernet port on your devices), try to raise the timeout for npm package resolution. 1. Check the current config value (default is 120000) ``` bash @@ -129,4 +139,3 @@ Try to use an ethernet connection. Also reboot might help. If the error still pe ``` 1. Retry the build - From 1e8952e94f746fd0f0984220f4a66baa9fbccae7 Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sat, 13 Jan 2024 22:42:41 +0100 Subject: [PATCH 57/70] Update customize_options.sh (typos) --- installation/routines/customize_options.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index c509b2e5a..88c69d61e 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -293,11 +293,11 @@ _option_webapp_devel_build() { You are installing from a non-release branch and/or an unofficial repository. -Therefore a prebuilt Web App is not available -and it needs to be build locally. +Therefore a pre-built Web App is not available +and it needs to be built locally. This requires Node to be installed. -If you choose to decline the lastest prebuilt version +If you decline, the lastest pre-built version from the official repository will be installed. This can lead to incompatibilities. From f00eb322ad580843ed523cad742fed1e5a82d9c7 Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sat, 13 Jan 2024 22:58:20 +0100 Subject: [PATCH 58/70] Update installation.md --- documentation/builders/installation.md | 28 ++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index fec273f8c..1356ff0e4 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -3,7 +3,7 @@ ## Install Raspberry Pi OS Lite > [!IMPORTANT] -> Currently, the installation does work on all Raspberry Pi models. But ARMv6 models (Pi 1 and Zero 1) have limited resources and are potentially unstable and will require a bit more work! Pi 4 and 5 are an excess ;-) +> All Raspberry Pi models are supported. For sufficient performance, **we recommend Pi 2, 3 or Zero 2** (`ARMv7` models). Because Pi 1 or Zero 1 (`ARMv6` models) have limited resources, they are slower (during installation and start up procedure) and might require a bit more work! Pi 4 and 5 are an excess ;-) Before you can install the Phoniebox software, you need to prepare your Raspberry Pi. @@ -84,47 +84,41 @@ Choose a version, run the corresponding install command in your SSH terminal and * [Pre-Release](#pre-release) * [Development](#development) -After successful installation, continue with [configuring your Phoniebox](configuration.md). +After a successful installation, [configure your Phoniebox](configuration.md). > [!TIP] -> Depending on your hardware, this installation might last -around 60 minutes (usually it's faster). It updates OS -packages, installs Phoniebox dependencies and registers -settings. Be patient and don't let your computer go to -sleep. It might disconnect your SSH connection causing -the interruption of the installation process. -Consider starting the installation in a terminal -multiplexer like 'screen' or 'tmux' to avoid this. +> Depending on your hardware, this installation might last around 60 minutes (usually it's faster, 20-30 min). It updates OS packages, installs Phoniebox dependencies and applies settings. Be patient and don't let your computer go to sleep. It might disconnect your SSH connection causing the interruption of the installation process. Consider starting the installation in a terminal multiplexer like 'screen' or 'tmux' to avoid this. ### Stable Release -This will install the latest **stable release** from the branch *future3/main*. +This will install the latest **stable release** from the *future3/main* branch. ```bash cd; bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/main/installation/install-jukebox.sh) ``` ### Pre-Release -This will install the latest **pre-release** from the branch *future3/develop*. +This will install the latest **pre-release** from the *future3/develop* branch. ```bash cd; GIT_BRANCH='future3/develop' bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/develop/installation/install-jukebox.sh) ``` ### Development -To install directly from a specific branch and/or a fork repository specify the variables like this. Make sure you also update the URL accordingly to the branch and repository used. +You can also install a specific branch and/or a fork repository. Update the variables to refer to your desired location. (The URL must not necessarily be updated, unless you have actually updated the file being downloaded.) + > [!IMPORTANT] ->A fork repository must be named '*RPi-Jukebox-RFID*' like the official repository +> A fork repository must be named '*RPi-Jukebox-RFID*' like the official repository ```bash cd; GIT_USER='MiczFlor' GIT_BRANCH='future3/develop' bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/develop/installation/install-jukebox.sh) ``` > [!NOTE] -> Installation of the official repositories release branches ([Stable Release](#stable-release) and [Pre-Release](#pre-release)) will deploy a prebuilt bundle of the Web App. -> If you install another branch or from a fork repository the Web App needs to be build locally. This is part of the installation process. See the the developers [Web App](../developers/webapp.md) documentation for further details. +> The Installation of the official repository's release branches ([Stable Release](#stable-release) and [Pre-Release](#pre-release)) will deploy a pre-built bundle of the Web App. +> If you install another branch or from a fork repository, the Web App needs to be built locally. This is part of the installation process. See the the developers [Web App](../developers/webapp.md) documentation for further details. ### Logs -If you suspect an error you can monitor the installation process with +To follow the installation closely, use this command in another terminal. ```bash cd; tail -f INSTALL-.log From 6b14951c4a85642cb4064c897cd2e131c532316b Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sat, 13 Jan 2024 22:59:28 +0100 Subject: [PATCH 59/70] Update system.md --- documentation/builders/system.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/builders/system.md b/documentation/builders/system.md index daa7b7bbc..f6eeb7ba1 100644 --- a/documentation/builders/system.md +++ b/documentation/builders/system.md @@ -7,7 +7,7 @@ The system consists of 1. [Music Player Daemon (MPD)](system.md#music-player-daemon-mpd) which we use for all music playback (local, stream, podcast, ...) 2. [PulseAudio](system.md#pulseaudio) for flexible audio output support 3. [Jukebox Core Service](system.md#jukebox-core-service) for controlling MPD and PulseAudio and providing all the features -4. [Web App](system.md#web-app-ui) as UI in a web browser +4. [Web App](system.md#web-app-ui) as User Interface (UI) for a web browser 5. A set of [Configuration Tools](../developers/coreapps.md#configuration-tools) and a set of [Developer Tools](../developers/coreapps.md#developer-tools) > [!NOTE] The default install puts everything into the users home folder `~/RPi-Jukebox-RFID`. From 3d0aecab5dd5471962b74079d143c4bb2a91f8f2 Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:21:14 +0100 Subject: [PATCH 60/70] Update installation.md --- documentation/builders/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/builders/installation.md b/documentation/builders/installation.md index 1356ff0e4..7ce0e59c0 100644 --- a/documentation/builders/installation.md +++ b/documentation/builders/installation.md @@ -114,7 +114,7 @@ cd; GIT_USER='MiczFlor' GIT_BRANCH='future3/develop' bash <(wget -qO- https://ra ``` > [!NOTE] -> The Installation of the official repository's release branches ([Stable Release](#stable-release) and [Pre-Release](#pre-release)) will deploy a pre-built bundle of the Web App. +> The Installation of the official repository's release branches ([Stable Release](#stable-release) and [Pre-Release](#pre-release)) will deploy a pre-build bundle of the Web App. > If you install another branch or from a fork repository, the Web App needs to be built locally. This is part of the installation process. See the the developers [Web App](../developers/webapp.md) documentation for further details. ### Logs From 7e314e76d9e0e56b706bb56b4c6221fa61ab6e3e Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:21:48 +0100 Subject: [PATCH 61/70] Update webapp.md --- documentation/developers/webapp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/developers/webapp.md b/documentation/developers/webapp.md index e7cbd10c7..a83492c12 100644 --- a/documentation/developers/webapp.md +++ b/documentation/developers/webapp.md @@ -1,6 +1,6 @@ # Web App -The Web App sources are located in `src/webapp`. A pre-built bundle of the Web App is deployed during when installing from the release branch (`main`). If you install from a feature branch or from a fork repository, the Web App needs to be built locally. This requires Node to be installed and is part of the installation process. +The Web App sources are located in `src/webapp`. A pre-build bundle of the Web App is deployed during when installing from the release branch (`main`). If you install from a feature branch or from a fork repository, the Web App needs to be built locally. This requires Node to be installed and is part of the installation process. ## Install node manually From 9edaa5f9560f81aff8a26a6096108d27dc8d0a33 Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:22:15 +0100 Subject: [PATCH 62/70] Update customize_options.sh --- installation/routines/customize_options.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installation/routines/customize_options.sh b/installation/routines/customize_options.sh index 88c69d61e..3e94b07dc 100644 --- a/installation/routines/customize_options.sh +++ b/installation/routines/customize_options.sh @@ -293,11 +293,11 @@ _option_webapp_devel_build() { You are installing from a non-release branch and/or an unofficial repository. -Therefore a pre-built Web App is not available +Therefore a pre-build Web App is not available and it needs to be built locally. This requires Node to be installed. -If you decline, the lastest pre-built version +If you decline, the lastest pre-build version from the official repository will be installed. This can lead to incompatibilities. From 5e65478fbca32d241386f543aa2b22645a460299 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:47:02 +0100 Subject: [PATCH 63/70] change npm config values --- src/webapp/.npmrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webapp/.npmrc b/src/webapp/.npmrc index b1e06e471..f05c1e85f 100644 --- a/src/webapp/.npmrc +++ b/src/webapp/.npmrc @@ -1,3 +1,3 @@ -fetch-retries=5 -fetch-retry-mintimeout=50000 -fetch-retry-maxtimeout=300000 +fetch-retries=10 +fetch-retry-mintimeout=20000 +fetch-retry-maxtimeout=120000 From 319ed2208c68a50036da43c7de59684e3d0030f6 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:48:01 +0100 Subject: [PATCH 64/70] update docs --- documentation/developers/webapp.md | 32 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/documentation/developers/webapp.md b/documentation/developers/webapp.md index a83492c12..2e8504337 100644 --- a/documentation/developers/webapp.md +++ b/documentation/developers/webapp.md @@ -1,12 +1,13 @@ # Web App -The Web App sources are located in `src/webapp`. A pre-build bundle of the Web App is deployed during when installing from the release branch (`main`). If you install from a feature branch or from a fork repository, the Web App needs to be built locally. This requires Node to be installed and is part of the installation process. +The Web App sources are located in `src/webapp`. A pre-build bundle of the Web App is deployed when installing from an official release branch. If you install from a feature branch or a fork repository, the Web App needs to be built locally. This requires Node to be installed and is part of the installation process. ## Install node manually -If you installed an official release branch, Node might not be installed. To install Node for local development, follow the [official setup](https://deb.nodesource.com/). +If you installed from an official release branch, Node might not be installed. To install Node for local development, follow the [official setup](https://deb.nodesource.com/). ``` bash +NODE_MAJOR=20 sudo apt-get -y update && sudo apt-get -y install ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg @@ -126,16 +127,23 @@ This tends to happen on `armv6l` devices where building takes significantly more #### Solution -Try to use an ethernet connection. A reboot might also help. If the error still persists (or there is no ethernet port on your devices), try to raise the timeout for npm package resolution. +Try to use an ethernet connection. A reboot and/or running the script multiple times might also help ([Build produces EOF errors](#build-produces-eof-errors) might occur). -1. Check the current config value (default is 120000) - ``` bash - npm config --location project get fetch-retry-maxtimeout - ``` - -1. Increase the value by '30000' (30 seconds) and set the new value - ``` bash - npm config --location project set fetch-retry-maxtimeout=xxx - ``` +If the error still persists, try to raise the timeout for npm package resolution. +1. Open the npm config file in an editor +1. Increase the `fetch-retry-*` values by '30000' (30 seconds) and save 1. Retry the build + +### Build produces EOF errors + +#### Reason + +A previous run failed during installation and left a package corrupted. + +#### Solution + +Remove the mode packages and rerun again the script. +``` {.bash emphasize-lines="8,9"} +rm -rf node_modules +``` From c1743bc94bf4b0f5ed342801101432efcc898607 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 14 Jan 2024 00:01:06 +0100 Subject: [PATCH 65/70] update welcome to match changes in wiki --- installation/includes/03_welcome.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/installation/includes/03_welcome.sh b/installation/includes/03_welcome.sh index 5b3ee84be..62c4910c8 100644 --- a/installation/includes/03_welcome.sh +++ b/installation/includes/03_welcome.sh @@ -16,16 +16,16 @@ You are turning your Raspberry Pi into a Phoniebox. Good choice! Depending on your hardware, this installation might last -around 60 minutes (usually it's faster). It updates OS -packages, installs Phoniebox dependencies and registers -settings. Be patient and don't let your computer go to -sleep. It might disconnect your SSH connection causing -the interruption of the installation process. +around 60 minutes (usually it's faster, 20-30 min). It +updates OS packages, installs Phoniebox dependencies and +applies settings. Be patient and don't let your computer +go to sleep. It might disconnect your SSH connection +causing the interruption of the installation process. Consider starting the installation in a terminal multiplexer like 'screen' or 'tmux' to avoid this. -By the way, you can follow the installation details here -in a separate SSH session: +To follow the installation closely, use this command +in another terminal. cd; tail -f ${INSTALLATION_LOGFILE} Let's set up your Phoniebox. From b22586adca51c6780dae6eaf6cdd2d8fd7148421 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 14 Jan 2024 00:11:05 +0100 Subject: [PATCH 66/70] update rebuild message --- src/webapp/run_rebuild.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/webapp/run_rebuild.sh b/src/webapp/run_rebuild.sh index 8b4b538e2..e8e4d06c0 100755 --- a/src/webapp/run_rebuild.sh +++ b/src/webapp/run_rebuild.sh @@ -128,8 +128,9 @@ if [[ $(uname -m) == armv6l ]]; then echo " ----------------------------------------------------------- | You are running a hardware with limited resources. | -| Building the Web App takes significantly more time | -| and might fail. | +| Building the Web App takes significantly more time. | +| In case it fails, check the documentation | +| to trouble shoot. | ----------------------------------------------------------- " fi From 97a076b1e32eb4588c593e4bb2bb8aae5c17df21 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 14 Jan 2024 00:44:29 +0100 Subject: [PATCH 67/70] Add doc links --- resources/html/404.html | 1 + resources/html/runbuildui.html | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/html/404.html b/resources/html/404.html index 89c9905a9..a79decc6c 100755 --- a/resources/html/404.html +++ b/resources/html/404.html @@ -15,6 +15,7 @@

    Ups! Requested file not found.

    Why not try again from the top-level of

    diff --git a/resources/html/runbuildui.html b/resources/html/runbuildui.html index ebbb1bafa..6ade7bb0a 100755 --- a/resources/html/runbuildui.html +++ b/resources/html/runbuildui.html @@ -12,11 +12,11 @@

    Ups! Looks like your Web UI has not been build!

    No reason to panic. Please run through the following steps:

    -

    In case of trouble when building the Web UI, consult the official documentation! +

    In case of trouble when building the Web UI, consult the official documentation! From 6f8f228039ae9afd2331b6853a8db165c494b882 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 14 Jan 2024 01:03:08 +0100 Subject: [PATCH 68/70] update ignorefiles for build.bak --- .dockerignore | 1 + src/webapp/.gitignore | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.dockerignore b/.dockerignore index a587de477..da30b5a97 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,3 +14,4 @@ shared src/webapp/node_modules src/webapp/npm-debug.log src/webapp/build +src/webapp/build.bak diff --git a/src/webapp/.gitignore b/src/webapp/.gitignore index 4d29575de..b32ff75cd 100644 --- a/src/webapp/.gitignore +++ b/src/webapp/.gitignore @@ -11,6 +11,9 @@ # production /build +# development +/build.bak + # misc .DS_Store .env.local From 0edcb782c96d5613bea9a842e893abee228bc8cb Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 14 Jan 2024 01:32:55 +0100 Subject: [PATCH 69/70] Update doc and link for constributors --- CONTRIBUTING.md | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbf12f84d..40371b6f0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,9 +48,11 @@ Contributors have played a bigger role over time to keep Phoniebox on the edge o 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. -Development for Version 3 is done on the git branch `future3/develop`. How to move to that branch, see below. - -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. +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](documentation/developers/status.md) for available features and work in progress. ## Getting Started @@ -60,31 +62,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 @@ -168,8 +160,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 From 36c65e2c678ddb32d774445b2e0fc7e4368078a3 Mon Sep 17 00:00:00 2001 From: pabera <1260686+pabera@users.noreply.github.com> Date: Sun, 14 Jan 2024 21:18:36 +0100 Subject: [PATCH 70/70] Update CONTRIBUTING.md --- CONTRIBUTING.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 40371b6f0..f4ac9cd16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,14 +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. - -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](documentation/developers/status.md) for available features and work in progress. +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. + +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. + +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