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

jorgerobles commented 7 years ago

Great!! Hope to test today :)

ghost commented 7 years ago

Good stuff... Time crept up on us... @DarklyLabs starts shipping Emblasers this week, and @FabCreator will allow customers to collect their Fabkits on the 24th (shipping remainder the week after) - so I expect LW to have a rather busy week on the final testing of all this + support as users start receiving their machines

ghost commented 7 years ago

@Vertigotech - installer build instructions over on https://github.com/LaserWeb/lw.comm-server/blob/master/README-ELECTRON.md - done - now you dont need to distribute rogue EXEs Please help test the build process and built app and once we are all happy (in a week or so) we can make EXEs/BINs/DMGs available for users to download directly from github.com/LaserWeb

ghost commented 7 years ago

Ahh, grr, found my first issue @tbfleming - dragging items on cam tab doesnt work.

ghost commented 7 years ago

Ok hold up (: I had Electron 1.4.1 - 1.6+ is on Chrome 56...

cprezzi commented 7 years ago

@openhardwarecoza During testing I embedded lw.comm-server as dependency in LaserWeb4 and started both applications together (if needed) in packet.json of LaserWeb4. This way I was able to choose what I want to start with npm start (both) or npm start-server or npm start-app.

You flipped it around and included the app (LW4) in lw.comm-server (like it was on LW3).

But what about this scenario:

I would prefer to leave lw.comm-server as a separate, independent package (unified communications server) that can also be used by other frontends via the api.

Couldn't the electron compile also be made in LaserWeb4? This way we would have the options to compile installers with or without included server.

ghost commented 7 years ago

I tried that initially in LaserWeb4-Installer. Electron needs a node backend to start, and it needs a webserver running to host the UI on.

Feel free to refactor, but nb we owe Darkly a working solution asap (last week) so quick wins to get going now is better than not going at all.

On Feb 21, 2017 1:54 PM, "Claudio Prezzi" notifications@github.com wrote:

@openhardwarecoza https://github.com/openhardwarecoza During testing I embedded lw.comm-server as dependency in LaserWeb4 and started both application toghtery (if needed) in packet.json of LaserWeb4. This way I was able to choose what I want to start with npm start (both) or npm start-server or npm start-app.

You flipped it around and included the app (LW4) in lw.comm-server (like it was on LW3).

But what about this scenario:

  • Server started separately on a PC/Raspi... (not hosting the app)
  • App installed (manual or elektron) on a PC/Notebook without server
  • App connecting server on other machine.

I would prefer to leave lw.comm-server as a separate, independent package (unified communications server) that can also be used by other frontends via the api.

Couldn't the electron compile also be made in LaserWeb4? This way we would have the options to compile installers with or without included server.

— 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-281323076, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr29fu093CQdRaPYDU6Nq8DoF34Exsks5retCGgaJpZM4MHHcD .

ghost commented 7 years ago

Honestly it hasnt made major changes except including lw's compiled dist in the exe. Apart from that change all i did was make node server.js into an electron app (which would also be the best way to distribute lw.comm-server as a standalone app (like spjs)

It already has a webserver.

In lw2 days i would have left out the webserver and told people to use ghpages, then run the server locally. I also remember the backlash that decision had - rioting users who dont have wifi in their garages...

The history of lw does make a lot of decisions for us

On Feb 21, 2017 1:57 PM, "Peter van der Walt (Gmail)" < peter.plaaswerf@gmail.com> wrote:

I tried that initially in LaserWeb4-Installer. Electron needs a node backend to start, and it needs a webserver running to host the UI on.

Feel free to refactor, but nb we owe Darkly a working solution asap (last week) so quick wins to get going now is better than not going at all.

On Feb 21, 2017 1:54 PM, "Claudio Prezzi" notifications@github.com wrote:

@openhardwarecoza https://github.com/openhardwarecoza During testing I embedded lw.comm-server as dependency in LaserWeb4 and started both application toghtery (if needed) in packet.json of LaserWeb4. This way I was able to choose what I want to start with npm start (both) or npm start-server or npm start-app.

You flipped it around and included the app (LW4) in lw.comm-server (like it was on LW3).

But what about this scenario:

  • Server started separately on a PC/Raspi... (not hosting the app)
  • App installed (manual or elektron) on a PC/Notebook without server
  • App connecting server on other machine.

I would prefer to leave lw.comm-server as a separate, independent package (unified communications server) that can also be used by other frontends via the api.

Couldn't the electron compile also be made in LaserWeb4? This way we would have the options to compile installers with or without included server.

— 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-281323076, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr29fu093CQdRaPYDU6Nq8DoF34Exsks5retCGgaJpZM4MHHcD .

cprezzi commented 7 years ago

At least you should make a separate electron branch and leave master slick and clean for separate usage.

ghost commented 7 years ago

Fine gimme 30 and i'll revert everything

On Feb 21, 2017 2:12 PM, "Claudio Prezzi" notifications@github.com wrote:

At least you should make a separate electron branch and leave master slick and clean for separate usage.

— 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-281327143, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2xtWnoqjydfOHC_GhADyx_WEtT7Qks5retTCgaJpZM4MHHcD .

ghost commented 7 years ago

Done

I'm out. Good luck

cprezzi commented 7 years ago

@openhardwarecoza I didn't want to offend you in any way! I appreciate your opinion!! I just wanted to have a separate branch.

jorgerobles commented 7 years ago

@openhardwarecoza, @cprezzi I've got Peter's code from yesterday in my computer. I could open a branch. @openhardwarecoza do you agree? I will be sad if we lost the work you did. :cat:

ghost commented 7 years ago

Glad you did. Git reset killed my local work

jorgerobles commented 7 years ago

Available on https://github.com/LaserWeb/lw.comm-server/tree/electron_bundler

cprezzi commented 7 years ago

@jorgerobles Thank you very much!

@openhardwarecoza I am sad that you felt so negative about my statements. I did not mean it like that!

jorgerobles commented 7 years ago

@openhardwarecoza could you restore the installation wiki page, plz? :smile:

ghost commented 7 years ago

Installation of electron? Was a readme-electron.md inside the repo (: - wasnt on the wiki

ghost commented 7 years ago

https://github.com/LaserWeb/lw.comm-server/blob/electron_bundler/README-ELECTRON.md

jorgerobles commented 7 years ago

Oh, ok sorry, slipped that.

ghost commented 7 years ago

No problem. I probably should have wiki'd it instead

jorgerobles commented 7 years ago

I've added git checkout electron_bundler &&\ because the branch is different now. I've run the build script but get a blank screen (OSX) :|

ghost commented 7 years ago

Well, one of three things:

1) in https://github.com/LaserWeb/lw.comm-server/blob/electron_bundler/server.js#L1838 uncomment and see if the devtools give any clues

2) Try electron 1.4x (I also noticed just before trashing my work https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-281307654 - i was still using Electron 1.4x and that worked. When I uninstalled Electron 1.4 and installed 1.6, i also had a blank screen

2.1 If thats the case, then it means https://github.com/electron-userland/electron-builder/issues/974 might be back :( 2.1.1 running 'electron .' instead of npm run dist, should launch a live version: If that works, but the built dmg/asar doesnt, then its https://github.com/electron-userland/electron-builder/issues/974 2.1.2 If it also brings up a blank screen under live electron, its something else

  1. The server.js webserver on port 8000 serves the page that electron has to display: So a quick check on chome :8000 should also help (if it displays in chrome, then server.js is serving it fine, but electron doesnt render it?
jorgerobles commented 7 years ago

Wow, thanks! I will report news ;)

El 22 feb. 2017 2:37 p. m., "Peter van der Walt" notifications@github.com escribió:

Well, one of three things:

1.

in https://github.com/LaserWeb/lw.comm-server/blob/electron_ bundler/server.js#L1838 uncomment and see if the devtools give any clues 2.

Try electron 1.4x (I also noticed just before trashing my work #6 (comment) https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-281307654

  • i was still using Electron 1.4x and that worked. When I uninstalled Electron 1.4 and installed 1.6, i also had a blank screen

2.1 If thats the case, then it means electron-userland/electron- builder#974 https://github.com/electron-userland/electron-builder/issues/974 might be back :( 2.1.1 running 'electron .' instead of npm run dist, should launch a live version: If that works, but the built dmg/asar doesnt, then its electron-userland/electron-builder#974 https://github.com/electron-userland/electron-builder/issues/974 2.1.2 If it also brings up a blank screen under live electron, its something else

  1. The server.js webserver on port 8000 serves the page that electron has to display: So a quick check on chome :8000 should also help (if it displays in chrome, then server.js is serving it fine, but electron doesnt render it?

— 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-281670933, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoIYD7ZqYEwxOXRGmGBk_H36RkpgWXgks5rfDoAgaJpZM4MHHcD .

cprezzi commented 7 years ago

The lw.comm-server package is also included in lw4's package.json. Could that cause a problem when bundling it again with electron?

Also: LW4 uses port 8080 by default, but the webserver of lw.comm-server is on port 8000.

cprezzi commented 7 years ago

On line 111 of server.js there is still the folder ./app serverd as the web page. Shouldn't that be ./app/lw4 for the lw4 pages? (see https://github.com/LaserWeb/lw.comm-server/blob/electron_bundler/server.js#L111)

ghost commented 7 years ago

@cprezzi nope thats still fine. ./app is served by node static, but the webserver will handle subdirectories (otherwise /js and /lib wont get served either)

As a test running node server.js in there, and accesing localhost:8000/lw4 should bring it up

https://github.com/LaserWeb/lw.comm-server/blob/electron_bundler/server.js#L1825 loads up the window into electron

In this sense we really are running lightweight. server.js still does everything it did (webserver, usb, etc) only, at the very bottom, we launch a electron window (aka fullscreen slimmed down chrome browser)

that loads up webserver content from server.js:8000

cprezzi commented 7 years ago

@openhardwarecoza Ah ok, didn't see that electron specific line. Have you also tried to use localhost instead of 127.0.0.1? I had that problem on my Win10 System.

ghost commented 7 years ago

I am busy re npm'ing it now (+-500mb total @60kbps link... driving me slowly insane)

cprezzi commented 7 years ago

Ok, I leave you. I'm anyways a electron noob.

ghost commented 7 years ago

hehe no problem. we are only scratching the skin.... Once we get this ball through the gate theres still a hundred more (asar auto update servers with nutz/squirrel, being a high priority)

cprezzi commented 7 years ago

I agree.

jorgerobles commented 7 years ago

I think is 2.1.1 (974 issue) "./node_modules/.bin/electron ." works

ghost commented 7 years ago

@jorgerobles (: I'm still busy re-npm-ing (slow link = times out ECONNRESET while installing... grrr - even more reason to do the exercise of making it electron. The webpack dev environment on LW4 and the electron build env total to over 600mb (CD full just to build the 37mb LW4 electron installer (;

Was your test with electron 1.4.x as is currently in package.json, or 1.6.1 (latest) - my working test the other day was under 1.4.6 but we cannot use it as chrome 54 (in electron .1.4.6) doesnt support the touchevents/dragevents used in LW4

ghost commented 7 years ago

Well, answering my own question, launching electron . on 1.6.1. works (:

1 6 1

Lets see if a build works

ghost commented 7 years ago

Built and installed: Working!

lw4 built using 1 6 1

ghost commented 7 years ago

@openhardwarecoza Awesome! Can you post the exe for us to test?

ghost commented 7 years ago

@DarklyLabs https://drive.google.com/open?id=0B-UxBll2MapjTVNIVHlzcmdCa2s

ghost commented 7 years ago

(Win64 Build ... ) (We need to check if we can use Appveyor or something similar to automate builds for win32/64/linux/mac

ghost commented 7 years ago

@openhardwarecoza Just installed it on Win10 64bit. Chrome Version 56.0.2924.87

Installed fine but just displays a white screen when run.

ghost commented 7 years ago

On first run, windows should bring up that Firewall allow access dialog. Allow it, then restart laserweb

Also, while its running check in netstat if the webserver came up? netstat -an |find /i "listening" |find /i "8000"

netstat

ghost commented 7 years ago

@openhardwarecoza Ok, that could be the problem. Firewall dialog is not appearing.

ghost commented 7 years ago

Manually excempt it for now?

firewall

firewall2

Navigate to C:\Users\\AppData\Local\Programs\lw.comm-server\LaserWeb.exe

ghost commented 7 years ago

capture

ghost commented 7 years ago

Any other dependancies I might need to have installed?

ghost commented 7 years ago

Check netstat

https://github.com/LaserWeb/lw.comm-server/issues/6#issuecomment-281916238

ghost commented 7 years ago

Here's a build with the devtools turned on https://drive.google.com/open?id=0B-UxBll2MapjUnpvLVZmbFBIVkE - maybe there are clues

cojarbi commented 7 years ago

Do we have a build procedure for OSx i can try?

cojarbi commented 7 years ago

i get the sam as @DarklyLabs on Windows 10, firewall did appear and re checked is listening and granted access but the screen is white

cojarbi commented 7 years ago

This is what i get with the dev tools

screen shot 2017-02-23 at 7 05 25 am