electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.72k stars 1.74k forks source link

How does electron building behave when executing builder with `-wl` params? #2427

Closed jhnferraris closed 6 years ago

jhnferraris commented 6 years ago

I'm quite curious on how

$ build -wl

behaves. Is it concurrently build windows and linux installer at the same time or it builds windows then linux installer?

The reason why I'm asking is that when I execute build -wl it eats up all of my memory therefore blocking me to do other coding jobs. thanks for the insight. :)

develar commented 6 years ago

Yes, concurrently. Windows NSIS target is CPU hungry, because of lzma2 compression. Remote AppImage is also CPU hungry, because of zstd compression. And memory — because of used dict size.

If you just want to produce development builds — you can try to pass --config.compression=store to disable compression (not applicable in all cases).

jhnferraris commented 6 years ago

@develar What's your suggested CPU and RAM spec for a "builder machine" taking into account the CPU and memory requirement of electron builder?

develar commented 6 years ago

Well... Do you aware of https://github.com/electron-userland/electron-build-service? Why do you need to setup own build machine instead of some cloud service (Travis and so on)?

develar commented 6 years ago

CPU

doesn't matter. Build will be just slow if CPU not powerful.

Memory

Due to lzma2 dict size, 1 GB of RAM is recommended. But... most of out targets don't use large dict size anymore (for differential updates we set dict size to 4M instead of 64-64M). e.g. portable uses, but nsis not.

Known memory hungry targets:

jhnferraris commented 6 years ago

@develar I am not aware of the Build service. I was asking because we're planning to setup a Jenkins CI on an EC2 for building electron apps.

Thanks for the inputs.

ghost commented 6 years ago

@develar Running a Gitlab Runner on my droplet with 1 GB RAM and using the electronuserland/electron-builder:wine images does not suffice:

Error: Exit code: 8. Command failed: 7za a -bd -mx=9 -mtc=off -mtm=off -mta=off /builds/bgg/launcher/Release/launcher-0.1.0-x64.nsis.7z .
ERROR: Can't allocate required memory!

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz (406F1),ASM,AES-NI)

Scanning the drive:
2 folders, 117 files, 141153950 bytes (135 MiB)

Creating archive: /builds/bgg/launcher/Release/launcher-0.1.0-x64.nsis.7z

Items to compress: 119

ERROR: Can't allocate required memory!

    at /builds/bgg/launcher/node_modules/builder-util/src/util.ts:125:16

During the build I tracked the memory usage and noticed how it filled up the entire memory and errored. Unfortunately I cannot enable swap and apparently will have to go back to the Gitlab shared runners.