mike-goodwin / owasp-threat-dragon-desktop

An installable desktop variant of OWASP Threat Dragon
Apache License 2.0
594 stars 90 forks source link

Provide Linux distribution independent packages #130

Closed fajabird closed 4 years ago

fajabird commented 4 years ago

Instead of providing packages in DEB and RPM format, provide distribution independent packages in Appimage (and possibly Flatpak) format. No installation required (appimage).

Example: JITSI (online audio/video conferences) provides a desktop application based on electron and for linux is distrubuted as appimage (https://www.appimagehub.com/p/1248973/).

jgadsden commented 4 years ago

Hello @fajabird - sounds good to me, many thanks for raising this issue. Are you able to provide this as a PR ? We are going to release version 1.2 in a couple of weeks and this would be good to have. I guess initially alongside the deb and rpm packages. I am moving this issue to the Desktop Threat Dragon repo, as it is specific to the desktop version: https://github.com/mike-goodwin/owasp-threat-dragon-desktop

fajabird commented 4 years ago

Hi, I can try to help out. First step would be do decide upon the pipeline: here is a short summary of the options. Can you give advise which way to go?

https://docs.appimage.org/packaging-guide/overview.html

jgadsden commented 4 years ago

Thanks @fajabird - much appreciated. We use electron installers in the package.json scripts, so there is an electron installer package for appimage: https://www.npmjs.com/package/electron-installer-appimage but I am not sure if this is similar to the rpm electron installer or not: https://www.npmjs.com/package/electron-installer-redhat

Ideally we would prefer something like electron-builder: https://www.electron.build/ that may be more work, but a nice thing to have, and we do run Travis on all pull requests: https://docs.appimage.org/packaging-guide/overview.html#automated-continuous-builds-on-travis-ci

Not sure if any of this helps on which way to go, maybe electron-installer-appimage is the most direct way to get Appimage packages

fajabird commented 4 years ago

Thanks @jgadsden for the input. Unfortunately electron-installer-appimage seems to be just a reference to electron-builder. So I tried the following without any modifications to any files:

npx electron-builder -l (where -m=mac -w=windows -l=linux) Result: • electron-builder version=22.4.1 os=5.5.13-arch2-1 • writing effective config file=dist/builder-effective-config.yaml • installing production dependencies platform=linux arch=x64 appDir=/home/artur/Apps/ThreatDragon/owasp-threat-dragon-desktop • packaging platform=linux arch=x64 electron=5.0.5 appOutDir=dist/linux-unpacked • building target=snap arch=x64 file=dist/threatdragon_1.1.0_amd64.snap • building target=AppImage arch=x64 file=dist/OWASP-Threat-Dragon-1.1.0.AppImage • application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux • default Electron icon is used reason=application icon is not set • application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux • downloading url=https://github.com/electron-userland/electron-builder-binaries/releases/download/snap-template-4.0-2/snap-template-electron-4.0-2-amd64.tar.7z size=1.5 MB parts=1 • downloading url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z size=1.6 MB parts=1 • downloaded url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z duration=6.433s • downloaded url=https://github.com/electron-userland/electron-builder-binaries/releases/download/snap-template-4.0-2/snap-template-electron-4.0-2-amd64.tar.7z duration=10.906s

So this successfully created a threatdragon_1.1.0_amd64.snap and a OWASP-Threat-Dragon-1.1.0.AppImage file. The Appimage runs fine.

npx electron-builder -m also creates successfully a OWASP-Threat-Dragon-1.1.0-mac.zip file

npx electron-builder -w fails due to missing dependencies on my host (e.g. wine) but in a proper environment should also work.

So "npx electron-builder -mwl" will create all above files. Further documentation: https://www.electron.build/cli#targetconfiguration

fajabird commented 4 years ago

Hi, I have added a build-block and a "dist" script to the package.json which allows to do a "npm run dist" which will build all windows, mac and linux files in one go using electron-builder. Its a tiny change but if you like I can create a PR.

jgadsden commented 4 years ago

Hello @fajabird - yes please, if you would like to create this PR that would be great. It looks like we also get the .snap file as well ... double good result I will create the npx electron-builder -w image, I have a tame windows box at the side of the desk. (I am a linux sort of person, with a Mac for work) This is good timing as the testing for version 1.2 is about to start