These are chat archives for resin-io/chat

21st
Jul 2017
webartistse
@webartistse
Jul 21 2017 08:26
What is best practice when it comes to build? Now I have an electron app with react and webpack. It takes resin 31 minutes to do the build. Libsass takes ages to build (im using sass-loader for webpack). Shall I have the build in the repo? It feels wrong but it will speed things up. Or shall I let resin/docker do the total build?

It looks like this:
WORKDIR /tmp
COPY package.json /tmp/
RUN npm config set registry http://registry.npmjs.org/ \
&& npm install --unsafe-perm --production \
&& npm cache clean && node_modules/.bin/electron-rebuild

WORKDIR /usr/src/app
COPY . /usr/src/app/
RUN cp -a /tmp/node_modules /usr/src/app/
RUN npm run build

resin.io team
@resinio
Jul 21 2017 12:04
[Florin-Ionut Sarbu (floion)] @webartistse does it take that long every time you build it?
webartistse
@webartistse
Jul 21 2017 12:51
@resinio yeah, 30 min to 1 hour
resin.io team
@resinio
Jul 21 2017 12:54
[Florin-Ionut Sarbu (floion)] @curcuz, do you know how to speed this up? ^
[Carlo Curinga (curcuz)] @webartistse I agree with you that having to compile an artifact on your own and put that in your project is not a desired experience
[Carlo Curinga (curcuz)] maybe leveraging multistage build would help at least caching big parts of your project ( see https://github.com/resin-io-playground/nodejs-multistage-docker )
resin.io team
@resinio
Jul 21 2017 13:00
[Carlo Curinga (curcuz)] but to be fair, 30 mins (we are talking about a full run build without cache) is what I also get on that project
[Carlo Curinga (curcuz)] @CameronDiver might have more effective suggestions to share, since he has been working a lot on speeding up builds
webartistse
@webartistse
Jul 21 2017 13:03
I tested to run build locally and check in the build in repo. then it takes 3-4 min
But it feels like the wrong way to go
resin.io team
@resinio
Jul 21 2017 13:07
[Cameron Diver (CameronDiver)] @webartistse I guess the main bulk of the time is spent building electron?
[Cameron Diver (CameronDiver)] If so then there is not really much you can do to speed that up
[Cameron Diver (CameronDiver)] but we have some exciting changes coming in the next few weeks, which should reduce the build time by quite a significant amount
webartistse
@webartistse
Jul 21 2017 13:08
I dont know exactly how this work but node-gype and libsass takes alot of time
electron-rebuild, does this rebuild all node modules?
resin.io team
@resinio
Jul 21 2017 13:09
[Cameron Diver (CameronDiver)] It shouldn't, but @curcuz would be the one who could tell you for certain
resin.io team
@resinio
Jul 21 2017 13:25

[Carlo Curinga (curcuz)] quoting the electron-rebuild readme

"This executable rebuilds native Node.js modules against the version of Node.js that your Electron project is using. This allows you to use native Node.js modules in Electron apps without your system version of Node.js matching exactly (which is often not the case, and sometimes not even possible)."

[Carlo Curinga (curcuz)] so it does only rebuild native modules
webartistse
@webartistse
Jul 21 2017 13:27
ok thanks
I will test some cases and see what works best :)
enigma4sidd
@enigma4sidd
Jul 21 2017 14:27
Hey anyone has a clue on how to get LXDE autostart to launch easyGUI on Resin OS running on Raspberry Pi 3
??
CameronDiver
@CameronDiver
Jul 21 2017 14:35
@enigma4sidd assuming you have LXDE automatically starting up, I'd refer to the LXDE documentation for starting jobs on login as the process should not be any different on resinOS
enigma4sidd
@enigma4sidd
Jul 21 2017 14:36
I'm not sure if I have LXDE automatically starting up
Since resin doesn't have LXDE pre-installed, I had to apt-get it
So the only place I could find autostart was /etc/xdg/lxsession/LXDE
CameronDiver
@CameronDiver
Jul 21 2017 14:37
@enigma4sidd it sounds like you will have to first ensure that LXDE gets started, probably with an .xinitrc file
enigma4sidd
@enigma4sidd
Jul 21 2017 14:38
But I'm not sure if the autostart file at the above location is being run on startup
CameronDiver
@CameronDiver
Jul 21 2017 14:38
It will not be if LXDE is not being started
and then will not be setup automatically by apt-get
enigma4sidd
@enigma4sidd
Jul 21 2017 14:39
Hmmm where can I find the .xinitrc file and any pointers on how to modify it for my purpose?
A link to an article would also do
enigma4sidd
@enigma4sidd
Jul 21 2017 14:40
thanks.. Do u know where .xinitrc is located on the resin filesystem?
CameronDiver
@CameronDiver
Jul 21 2017 14:44
I guess it will be in the same place as a non-resin filesystem. I unfortunately am not sure where that is.
webartistse
@webartistse
Jul 21 2017 14:46
@enigma4sidd /etc/X11/xinit/xserverrc
CameronDiver
@CameronDiver
Jul 21 2017 14:46
@enigma4sidd this project may be of use: https://github.com/resin-io-playground/electron-rpi-quick-start it shows the xserver being started, albeit with the electron frontend. Shouldn't be too hard to convert this to LXDE
enigma4sidd
@enigma4sidd
Jul 21 2017 14:49
Thanks @webartistse @CameronDiver...I'll try out these things and update her
here*
enigma4sidd
@enigma4sidd
Jul 21 2017 15:19
Ok when i run the startlxde command I get this error -
(lxsession:618): Gtk-WARNING **: cannot open display: 99.0
root@29f2053:/etc/X11/xinit# xinit
cannot open display: 99.0
I was also trying to run a pyside script and I kept getting the display issue
I'm guessing the display needs to be set to something in the environment variables, but I'm not sure what the appropriate value is
cannot open display: 99.0 . btw the 99 value is there because I set display as 99 in environment variables. I've also tried 0.0, 1.0, etc
But nothing works
any help will be appreciated
enigma4sidd
@enigma4sidd
Jul 21 2017 15:30
Now trying to run xterm and getting this error
term: Xt error: Can't open display: %s
@webartistse open to suggestions
@resinio Request your help
CameronDiver
@CameronDiver
Jul 21 2017 15:52
@enigma4sidd I believe the default screen variable is 0:0
enigma4sidd
@enigma4sidd
Jul 21 2017 15:52
yea it still says can't open display:0.0
Its some configuration issue and I'm unable to figure it out