Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swap file adjustment for webapp build #2204

Conversation

AlvinSchiller
Copy link
Collaborator

@AlvinSchiller AlvinSchiller commented Jan 4, 2024

  • reworked the webapp build script to automatically calculate and adjust the swap if needed (for low memory devices)
  • raised the minimum memory used for the build for better performance
  • added webapp build option to installation (instead of manually trigger it afterwards)
  • added an action to test if the webapp build is successfull after changes

Tested on a RPI 3 A+ and a RPI Zero W with 512MB Ram

@AlvinSchiller AlvinSchiller added enhancement installation future3 Relates to future3 development labels Jan 4, 2024
@AlvinSchiller
Copy link
Collaborator Author

There are some deprecation and linting warnings that should be addressed in another PR

installation/routines/customize_options.sh Outdated Show resolved Hide resolved

if [[ -z $NODEMEM ]]; then
# mininum memory used for node
local mem_min=512
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: How can we use min 512MB for Node when the entire device only has so much? E.g. Pi Zero 2 only has 512MB. I guess you try to max out the swap size in the next step with this approach?

Copy link
Collaborator Author

@AlvinSchiller AlvinSchiller Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "missing" memory is compensated by the swap.
I made a few testruns with the old memory steppings and using only 256 MB was causing failures during build.
So i used the next step (512 MB) from the old code , which didn't faild so far in multiple tests.
This is also already documented.

The 3 A+ has only 512MB physical ram too and it works well so far.

src/webapp/run_rebuild.sh Outdated Show resolved Hide resolved
documentation/builders/system.md Outdated Show resolved Hide resolved
due to unpredictable npm connection errors.

Show webapp fin message only if webapp build fails
@AlvinSchiller
Copy link
Collaborator Author

Further information for commit use prebuilt webapp bundle also for develop

The bundled webapp was used for installations from the official repos main branch.
For the official repos develop branch the flag "ENABLE_WEBAPP_PROD_DOWNLOAD" was forced to false (see below), which resulted in installing node but didn't download the prebuilt bundle. Only if the user declined to install node the bundle was used.

if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" == "release-only" ]]; then
ENABLE_WEBAPP_PROD_DOWNLOAD=false
fi

As the webapp is now build during installation and the official repos release branches (main and develop) are most likely not directly used for development, but could be used by Builders to try new features / bugfixes, these will now handled the same.
The bundled webapp will be downloaded and Node will NOT be installed.
Developers should start the installation directly with the feature branch / fork defined.

The docs have been updates accordingly.

Comment on lines 129 to 133
-----------------------------------------------------------
| You are running a hardware with limited resources. |
| Building the Web App takes significantly more time |
| and might fail. |
-----------------------------------------------------------
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about unifying this with show_slow_hardware_message ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did think about this too.
Which message should we use?
And do you want to import the helper script or just duplicat the message?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not merge it and instead give a little bit more support

Building the Web App takes significantly more time. In case it fails, check the documentation to trouble shoot.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to write a second time, that the hardware is slow ;-)

@AlvinSchiller
Copy link
Collaborator Author

This is ready for final reviews

@AlvinSchiller AlvinSchiller merged commit 6e9e4f7 into MiczFlor:future3/develop Jan 15, 2024
22 checks passed
@AlvinSchiller AlvinSchiller deleted the future3/feature/installation_webapp_build branch January 15, 2024 08:32
@pabera pabera mentioned this pull request Jan 15, 2024
13 tasks
@pabera pabera added this to the v3.5 milestone Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement future3 Relates to future3 development installation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants