LaserWeb / lw.comm-server

Unified communications server for LaserWeb4 (and other frontends)
GNU General Public License v3.0
38 stars 46 forks source link

Electron - Build #6

Closed ghost closed 7 years ago

ghost commented 7 years ago

Morning

I integrated Electron-Builder into lw.comms-server itself

  1. Basically, I copy laserweb4/dist to app/lw4 (we can later remove your test/app and replace it with lw4's html)

  2. I created a ./build/ directory to contain the icons/bg (hardcoded paths/filenames which electron expects to be what they are: http://electron.rocks/electron-builder-explained/)

  3. Then in server.js at the very bottom we handle the electron gui

  4. Lastly, in package.json I added two more scripts, and the build{} json for Electron-builder

I tested briefly and it didnt seem to break your normal workflows (lw4 start-all, and standalone lw.comm-server)

I also tested the built electron app and comms seem to be running.

https://github.com/electron-userland/electron-builder/issues/974 used to be an issue, but as of this build its no longer an issue. I suspect the bug got fixed somewhere in one of the dependencies and now just work (: Yay

ghost commented 7 years ago

@cojarbi

https://github.com/LaserWeb/lw.comm-server/blob/electron_bundler/README-ELECTRON.md should apply on Mac as well, except the very first step, instead of Windows Build Tools

Instead:

ghost commented 7 years ago

@cojarbi any clues on console tab?>

cojarbi commented 7 years ago

@openhardwarecoza Console tab is totally empty

screen shot 2017-02-23 at 7 10 49 am
ghost commented 7 years ago

start

Thats what I get. One probable problem is maybe because LW4's Webpack bundle-prod isnt working and we use bundle-dev: I see we are still launching some webpack dev server components. Maybe that causes issues

The socket.io errors is a little weird too as I can connect to the backend... but wont cause this symptom

ghost commented 7 years ago

Ahaa, finally, I can replicate the issue (:

1) launching a new mainWindow.loadURL('http://127.0.0.1:8000/anything'); from the exe, comes up blank 2) if I launch it first using 'electron . ', it works, subsequent runs with the exe also works (suspect we have loading issue from electron-builder still, running it once the electron . way caches the page... thats why it works.

Great now that I can replicte, I can investigate

cojarbi commented 7 years ago

I get this in the last step of the build npm run dist

screen shot 2017-02-23 at 7 29 41 am
ghost commented 7 years ago

try 'npm install -g electron-builder' then try again

cojarbi commented 7 years ago

That did not run, it asked me to run it with admin, i did. Next i run npm run dist and get

Ariels-MBP:lw.comm-server ayahni$ npm run dist

lw.comm-server@4.0.34 dist /Users/ayahni/lw4build/lw.comm-server npm run copy && build

lw.comm-server@4.0.34 copy /Users/ayahni/lw4build/lw.comm-server ncp ../LaserWeb4/dist/ app/lw4/ --limit=6

Error: Config is invalid: { "win": [ { "remoteReleases": "Unknown option" }, "Invalid option object" ] }

Raw validation errors: [ { "keyword": "additionalProperties", "dataPath": ".win", "schemaPath": "#/additionalProperties", "params": { "additionalProperty": "remoteReleases" }, "message": "should NOT have additional properties" }, { "keyword": "type", "dataPath": ".win", "schemaPath": "#/properties/win/anyOf/1/type", "params": { "type": "null" }, "message": "should be null" }, { "keyword": "anyOf", "dataPath": ".win", "schemaPath": "#/properties/win/anyOf", "params": {}, "message": "should match some schema in anyOf" } ] at /usr/local/lib/node_modules/electron-builder/src/packager.ts:139:13 at next (native) at /usr/local/lib/node_modules/electron-builder/node_modules/jsonfile/index.js:46:5 at /usr/local/lib/node_modules/electron-builder/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) From previous event: at Packager.build (/usr/local/lib/node_modules/electron-builder/out/packager.js:278:11) at /usr/local/lib/node_modules/electron-builder/src/builder.ts:217:33 at next (native) From previous event: at build (/usr/local/lib/node_modules/electron-builder/out/builder.js:70:21) at Object. (/usr/local/lib/node_modules/electron-builder/out/cli/build-cli.js:71:41) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist" npm ERR! node v6.9.5 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! lw.comm-server@4.0.34 dist: npm run copy && build npm ERR! Exit status 255 npm ERR! npm ERR! Failed at the lw.comm-server@4.0.34 dist script 'npm run copy && build'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the lw.comm-server package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run copy && build npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs lw.comm-server npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls lw.comm-server npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /Users/ayahni/lw4build/lw.comm-server/npm-debug.log

ghost commented 7 years ago

Run git pull, then instead of npm run dist, do npm run distmac (I added a --mac buildscript)

cojarbi commented 7 years ago

getting this Ariels-MBP:lw.comm-server ayahni$ npm run distmac

lw.comm-server@4.0.34 distmac /Users/ayahni/lw4build/lw.comm-server npm run copy && build --mac

lw.comm-server@4.0.34 copy /Users/ayahni/lw4build/lw.comm-server ncp ../LaserWeb4/dist/ app/lw4/ --limit=6

Error: Config is invalid: { "win": [ { "remoteReleases": "Unknown option" }, "Invalid option object" ] }

Raw validation errors: [ { "keyword": "additionalProperties", "dataPath": ".win", "schemaPath": "#/additionalProperties", "params": { "additionalProperty": "remoteReleases" }, "message": "should NOT have additional properties" }, { "keyword": "type", "dataPath": ".win", "schemaPath": "#/properties/win/anyOf/1/type", "params": { "type": "null" }, "message": "should be null" }, { "keyword": "anyOf", "dataPath": ".win", "schemaPath": "#/properties/win/anyOf", "params": {}, "message": "should match some schema in anyOf" } ] at /usr/local/lib/node_modules/electron-builder/src/packager.ts:139:13 at next (native) at /usr/local/lib/node_modules/electron-builder/node_modules/jsonfile/index.js:46:5 at /usr/local/lib/node_modules/electron-builder/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3) From previous event: at Packager.build (/usr/local/lib/node_modules/electron-builder/out/packager.js:278:11) at /usr/local/lib/node_modules/electron-builder/src/builder.ts:217:33 at next (native) From previous event: at build (/usr/local/lib/node_modules/electron-builder/out/builder.js:70:21) at Object. (/usr/local/lib/node_modules/electron-builder/out/cli/build-cli.js:71:41) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3

npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "distmac" npm ERR! node v6.9.5 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! lw.comm-server@4.0.34 distmac: npm run copy && build --mac npm ERR! Exit status 255 npm ERR! npm ERR! Failed at the lw.comm-server@4.0.34 distmac script 'npm run copy && build --mac '. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the lw.comm-server package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run copy && build --mac npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs lw.comm-server npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls lw.comm-server npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /Users/ayahni/lw4build/lw.comm-server/npm-debug.log Ariels-MBP:lw.comm-server ayahni$

ghost commented 7 years ago

Lets fix the webserver issue first. Mac distraction slowing me down (;

ghost commented 7 years ago

@cojarbi Interesting catch on that error: I was on electron-builder 13.5 - didnt complain about "remoteReleases"

When I upgraded to 14.1.1 I also got errors about "remoteReleases" - so i removed that from package.json. Git pull and try again

(:

ghost commented 7 years ago

Progress... (:

path issue

Running the laserweb exe from CMD regains logging - which is quite important - see #7 will add later

And here we see why :8000 listens but doesnt serve content... Path issue!

cojarbi commented 7 years ago

Build completed successfully, but getting White screen of death, same as windows

also got this warnings while building, posting here for future reference

Rebuilding native production dependencies for darwin:x64 ⚠️ Packaging using asar archive is disabled — it is strongly not recommended. Please enable asar and use asarUnpack to unpack files that must be externally available. Packaging for darwin x64 using electron 1.6.1 to dist/mac ⚠️ App is not signed: cannot find valid "Developer ID Application" identity or custom non-Apple code signing certificate, see https://github.com/electron-userland/electron-builder/wiki/Code-Signing

ghost commented 7 years ago

Asar is purposely turned off as a test from https://github.com/electron-userland/electron-builder/issues/974#issuecomment-264914579

I suspect enabling it and then pointing node static at the proper ASAR path may actually help, looking at the above discovery

ghost commented 7 years ago

added the "path" module to construct a better relative path than ./app (see change on https://github.com/LaserWeb/lw.comm-server/commit/d381dc9a120fd3a6ad03e2b4aef39128e91e2c4f - @cprezzi that particular change would do well in master too - its the correct standard for node relative paths, as / and \ on win/linux come into play with ./app (i think you inherited that problem though)

And now it seems to work. Uploading to Google Drive - holding thumbs that when it gets to your machines it still works (:

Here you go https://drive.google.com/open?id=0B-UxBll2MapjeHRxWmgtZ0FxRDg

cojarbi commented 7 years ago

i can open it now in Windows 10 with that executable. Its seems to be working properly but dont have a smoothie stamp to test connection.

It does loads open the dev tools

ghost commented 7 years ago

cool yes, I have an open issue to handle devtools open/close with keyboard shortcut here https://github.com/LaserWeb/LaserWeb4/issues/169

You can try the mac compile too (: should work now

cojarbi commented 7 years ago

will do tonight, out for the day doing that boring thing we call work

ghost commented 7 years ago

Ahh man.. We all gotta

On Feb 23, 2017 6:18 PM, "Ariel Yahni" notifications@github.com wrote:

will do tonight, out for the day doing that boring thing we call work

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-282040300, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2zbAE9EZQXDKY702KyQMLlL_EczGks5rfbFkgaJpZM4MHHcD .

cheton commented 7 years ago

I had ever encountered a blank screen issue, and I eventually found a solution by ignoring proxy settings. Not sure if it's related to yours, but it's worth a try.

See sess.setProxy API below:

jorgerobles commented 7 years ago

Running on mac! https://drive.google.com/open?id=0B9GOB0erdDVbR3BDeVpzaHAxMEE

ghost commented 7 years ago

Awesomeness!

ghost commented 7 years ago

@DarklyLabs

Mac test: https://drive.google.com/open?id=0B9GOB0erdDVbR3BDeVpzaHAxMEE Win64 test: https://drive.google.com/open?id=0B-UxBll2MapjeHRxWmgtZ0FxRDg v 4.0.34 Win64 test: https://drive.google.com/open?id=0B-UxBll2MapjRW9nbFlFZ0RrSXc v 4.0.36

ghost commented 7 years ago

@cheton valid point - may encounter users with proxies - would be good to force direct

ghost commented 7 years ago

@jorgerobles https://github.com/LaserWeb/lw.comm-server/blob/electron_bundler/README-ELECTRON.md#subsequent-updates - @cprezzi pushed some fixes into master on this repo, i have pulled the changes into this branch. new version 4.0.36

PS @cprezzi version numbering propogates nicely into electron (;

ghost commented 7 years ago

As a creepy yet useful side effect of keeping the lw3 test code, and lw4 in the build, means that although the Electron UI launches localhost:8000/lw4, opening chrome you can go to either localhost:8000/lw4 or localhost:8000 (lw3)

Pooky1306 commented 7 years ago

Works well on my win64 desktop. Any 32b version (pipo x9) ?

I'm reading your posts diagonally, not understanding most of them but you guys are doing an awesome job !

On Thu, Feb 23, 2017 at 8:29 PM, Peter van der Walt < notifications@github.com> wrote:

As a creepy yet useful side effect of keeping the lw3 test code, and lw4 in the build, means that although the Electron UI launches localhost:8000/lw4, opening chrome you can go to either localhost:8000/lw4 or localhost:8000 (lw3)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-282094995, or mute the thread https://github.com/notifications/unsubscribe-auth/AHPo3KPm7fvEktPbAaj_gHVYjTwubx61ks5rfd4MgaJpZM4MHHcD .

ghost commented 7 years ago

Let me build you a 32 bit! I need it for my nextbook little netbook too

On Feb 23, 2017 9:30 PM, "MaxFavre" notifications@github.com wrote:

Works well on my win64 desktop. Any 32b version (pipo x9) ?

I'm reading your posts diagonally but you guys are doing an awesome job !

www.pentaprisme.com

On Thu, Feb 23, 2017 at 8:29 PM, Peter van der Walt < notifications@github.com> wrote:

As a creepy yet useful side effect of keeping the lw3 test code, and lw4 in the build, means that although the Electron UI launches localhost:8000/lw4, opening chrome you can go to either localhost:8000/lw4 or localhost:8000 (lw3)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/lw.comm-server/issues/6# issuecomment-282094995, or mute the thread https://github.com/notifications/unsubscribe-auth/AHPo3KPm7fvEktPbAaj_ gHVYjTwubx61ks5rfd4MgaJpZM4MHHcD .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-282095290, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2-XQD6Ou67WLxrGGB-pJcjuKAmLnks5rfd5NgaJpZM4MHHcD .

FabCreator commented 7 years ago

@Pooky1306 FYI the pipo you will get with the Fabkit is the X9s which is a 64bit :)

FabCreator commented 7 years ago

awesome work btw guys, my emails still playing up so just read through another 200 github emails haha its like reading a thriller! Super excited to get LW4 on these machines asap :D

Pooky1306 commented 7 years ago

@FabCreator good to know ;) Anyway I have another one for the mill which is 32b

cprezzi commented 7 years ago

@openhardwarecoza Having lw3 and lw4 in parallel was very usefull during testing ;) I also planned to convert the lw3 testpage later to a responsive mini control pannel, so users can additionally connect with a mobile or tablet to see how far the job is and pause or stop it.

We should probaly also discuss how we want to make the version numbering. Especially between lw.comm-server and lw4 itself. Both versions need to match in some way to be "compatible".

I have already created two version numbers in config.js (for lw.comm-server and API-version). Probably we could add the compatible lw4 version also.

The config.js content is also delivered to the frontend, so we could make some checks there and alert the user if updates are needed.

ghost commented 7 years ago

Updates/releases will be a rather hectic mini project. Electron-builder / asar / nutz / squirrel etc all playing together

On Feb 23, 2017 10:07 PM, "Claudio Prezzi" notifications@github.com wrote:

@openhardwarecoza https://github.com/openhardwarecoza Having lw3 and lw4 in parallel was very usefull during testing ;) I also planned to convert the lw3 testpage later to a responsive mini control pannel, so users can additionally connect with a mobile or tablet to see how far the job is and pause or stop it.

We should probaly also discuss how we want to make the version numbering. Especially between lw.comm-server and lw4 itself. Both versions need to match in some way to be "compatible".

I have already created two version numbers in config.js (for lw.comm-server and API-version). Probably we could add the compatible lw4 version also.

The config.js content is also delivered to the frontend, so we could make some checks there and alert the user if updates are needed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-282105618, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr25ZHmFBiSBuYUeYLZGWvixH64gpaks5rfebrgaJpZM4MHHcD .

cprezzi commented 7 years ago

No holiday yet? ;)

ghost commented 7 years ago

Definitely only after a mini holiday! Else we (read Peter) may have too many stress fits and break up the team lol

On Feb 23, 2017 10:13 PM, "Claudio Prezzi" notifications@github.com wrote:

No holliday yet? ;)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-282107496, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2we5KxEKg86NeC7lY_wYoWDeklGkks5rfeiGgaJpZM4MHHcD .

ghost commented 7 years ago

Reading material in the meantime:

https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build

and https://github.com/electron-userland/electron-builder/wiki/Auto-Update

ghost commented 7 years ago

@Pooky1306 - Win32 test: https://drive.google.com/open?id=0B-UxBll2MapjdnhTRDB4UE8yX00

ghost commented 7 years ago

Mac test: https://drive.google.com/open?id=0B9GOB0erdDVbR3BDeVpzaHAxMEE Win32 test: https://drive.google.com/open?id=0B-UxBll2MapjdnhTRDB4UE8yX00 Win64 test: https://drive.google.com/open?id=0B-UxBll2MapjRW9nbFlFZ0RrSXc v 4.0.36

cojarbi commented 7 years ago

@openhardwarecoza what would be the equivalent installer for linux?

Pooky1306 commented 7 years ago

Thanks Peter. I'll test it this weekend and report back.

cojarbi commented 7 years ago

OSx https://drive.google.com/file/d/0B-1--YftWEOrTktnYVN4Y1daNjA/view?usp=sharing v 4.0.36

FabCreator commented 7 years ago

I seem unable to get it out of the alarm state? Win64 test: 4.0.36

cprezzi commented 7 years ago

I have made some changes today on lw.comm-server and laserweb4 that should solve the alarm problem. Everyting is merged to dev-es6 now and Pater will generate a new electron installer. Version should be 4.0.40.

You could also try with dev_comms, but check that lw.comm-server in node_modules is updated to version 4.0.40 (or 4040 in version.txt).

cprezzi commented 7 years ago

The stop button (abort job) is now dual state. In alarm state, it clears the alarm, otherwise it sends ctrl-x.

ghost commented 7 years ago

@cprezzi Solved. The git pull didn't update lw-comm. Deleted and ran installdev got it up to version 4040. I can confirm the dual-action abort functionality works. Well done Claudio.

ghost commented 7 years ago

https://plus.google.com/109807573626040317972/posts/V6m5H3AXAEw (;

On Mar 1, 2017 12:47 AM, "DarklyLabs" notifications@github.com wrote:

@cprezzi https://github.com/cprezzi Solved. The git pull didn't update lw-comm. Deleted and ran installdev got it up to version 4040. I can confirm the dual-action abort functionality works. Well done Claudio.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-283186463, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr29AmQuuF4kd8Q1dev6GgvfUaGC8Pks5rhKQbgaJpZM4MHHcD .

ghost commented 7 years ago

I updated the readme, fixed the caching issue and fixed the devtools button today. Electron app is again able to run up to date from dev-es6

I think we can close this now

Next step: (in LW4.1) automate builds with Appveyor/Travis (; and implement auto update with Squirrel