retrohacker / peerweb

Welcome to the Decentralized Web
http://will.blankenship.io/peerweb
MIT License
118 stars 9 forks source link

Project restructuring required for packaging. #31

Closed phoenix1796 closed 8 years ago

phoenix1796 commented 8 years ago

For creating a Build system which will properly support any new dependencies (including native deps.) and be easy to implement (instead of re-inventing the wheel) , we need to do some restructuring of the project For reference , https://github.com/electron-userland/electron-builder#two-packagejson-structure An electron project using the same structure , https://github.com/develar/onshape-desktop-shell

I would like to know everyone's opinion , before implementing this packaging and CI structure , because it seems that there are many branches using the current structure and that could result in some messy branch-merging in the near future.

retrohacker commented 8 years ago

I'd personally like to do the builds in a Docker image (this is supported by TravisCI). It would ensure we are building in a controlled and pristine environment both on the CI server and locally. This would solve Node version issue out the door.

I'd also like to keep as much of this configuration out of the package.json as possible. I'm thinking we create a Makefile that handles all of the Docker stuff, and package.json will simply have a command for npm build that kicks off the build process for the electron bundle with whatever node version is available.

retrohacker commented 8 years ago

We should be able to push most of the configuration out of the package.json and into a build.js script if we use https://github.com/electron-userland/electron-builder#programmatic-usage

I've created a branch https://github.com/retrohacker/peerweb/tree/build

We can use this as a place to work together (you have commit access so you don't have to work from a fork).

phoenix1796 commented 8 years ago

Awesome, I was gonna suggest docker build after we resolved the restructuring issue 👍

retrohacker commented 8 years ago

I don't think there is a need to restructure if we do our build in Docker, since we can pin the version of Node.js inside the docker container to the version of Node.js that electron is using.

retrohacker commented 8 years ago

I'll start on the Docker and Makefile now.

retrohacker commented 8 years ago

Alright.

Running make will give you a list of the supported commands for the project: https://github.com/retrohacker/peerweb/blob/build/Makefile

The Dockerfile pins the version of node the project uses to the same as electron, saving us the need of having to maintain two package.json files: https://github.com/retrohacker/peerweb/blob/build/Dockerfile

We can exclude file from the final build by including them in the .dockerignore file: https://github.com/retrohacker/peerweb/blob/build/.dockerignore

phoenix1796 commented 8 years ago

Hey , regarding the dockerization of build process , there is still the problem for building package for windows and mac as they both require the corresponding OS to compile properly ? (As in the example app in the issue i posted , we could use appveyor for windows builds but that still leaves mac builds on travis(without docker)) So , any ideas regarding that ?

(P.S. On an informal note , Man... you are fast at implementing stuff ... :smiley: :+1: )

retrohacker commented 8 years ago

Ah yeah, you are right, it looks like this solves for windows and linux (https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build#linux) but code signing only works on OSx... Gah, walled garden.

For OSx, we can pin the build server's Node version to that of electron's on TravisCI https://docs.travis-ci.com/user/osx-ci-environment/ using something like https://github.com/tj/n

The only reason I'm pushing back on the restructure is that I'd like to keep our dependencies from heavily influencing our codebase. When dependencies influence codebases like that, it makes them less approachable. While this uses Electron for the GUI, I'd like to try and keep this from becoming an "electron app." As long as we keep it a Node.js app, any Node developer can approach it. The same is true for the frontend. /ui contains plain html, css, and js by design so that it remains approachable to any frontend dev.

The purpose of PeerWeb is to make this technology as approachable as possible for as many people as possible. I had a nice writeup on dependencies that spoke to this but failed to check it in.

retrohacker commented 8 years ago

I'm going to be at Node Summit this week, so I may not have much free time.

If I get a moment, I'll try tackling this as part of the TravisCI setup.

phoenix1796 commented 8 years ago

If it's alright with you , I'd like to handle the TravisCI setup (Although I am a newbie at CI , but I'd like to use this to learn about it)

retrohacker commented 8 years ago

Yeah! For sure! If you want to hop on a hangout or something later this week to go through it I'm here to help :-)

Sent from Android

On Jul 25, 2016 9:17 PM, "Abhishek Chopra" notifications@github.com wrote:

If it's alright with you , I'd like to handle the TravisCI setup (Although I am a newbie at CI , but I'd like to use this to learn about it)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/retrohacker/peerweb/issues/31#issuecomment-235158619, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCA3dcGYjKORwlyDRrjmUL2tRvIzx-Mks5qZYpxgaJpZM4JTiSY .

phoenix1796 commented 8 years ago

@retrohacker Awesome , that'd be a great help :+1: So, how about July 30th ?

retrohacker commented 8 years ago

Perfect! My email is william.jblankenship@gmail.com if you can send a calendar invite at a time that works for you :-)

On Jul 27, 2016 10:35 AM, "Abhishek Chopra" notifications@github.com wrote:

@retrohacker https://github.com/retrohacker Awesome , that'd be a great help 👍 So, how about July 30th ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/retrohacker/peerweb/issues/31#issuecomment-235660720, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCA3anX-kHPWGvrb2MFFdGdQ7gHFav4ks5qZ5bEgaJpZM4JTiSY .

retrohacker commented 8 years ago

Hey @phoenix1796, any updates?

retrohacker commented 8 years ago

Also, if you want to hang out in IRC, check out irccloud.com

I use it for staying "online" even when I'm away. They have a great mobile app as well :smile:

phoenix1796 commented 8 years ago

I'm sorry for not contacting you the previous week , I had been busy with our College's Annual Hackathon coming near and also i crashed a test cluster in our college while compiling a docker image (Crazy right !!! :smile: ) I'll be getting onto this today :+1:

phoenix1796 commented 8 years ago

Hey , while i was building the docker image , i was constantly facing an error, http://imgur.com/a/76med

I tried searching about it and found this old post , https://github.com/dokku/dokku/issues/280 , But do you have any idea as to what might be causing this now ?

retrohacker commented 8 years ago

Hmm that is a strange one. Try repulling and building again, I just shipped a bunch of new stuff to the build branch.

We now have working builds spitting out .zip files. Right now they are in Docker containers, but will probably move everything to TravisCI.

retrohacker commented 8 years ago

I have been working on CI/CD over at https://travis-ci.org/retrohacker/peerweb-testing/builds

We now have test running on Travis-CI and our ./bin/package.js is building our packages for Linux and OSx. Right now I'm working on getting cross compiling to work by installing wine over brew, but that is causing Travis-CI to time out. Trying to find creative ways around that now.

Next we need to create our .pkg (or maybe .dmg, not sure yet) and .deb files, followed by getting Travis-CI to do code signing for OSx.

Finally we can push these up to GitHub as releases.

retrohacker commented 8 years ago

Now building all packages with current structure.