hoprnet / hopr-core

Main repository of HOPR - this is all you need to run a node on the HOPR network!
https://hoprnet.org
GNU General Public License v3.0
14 stars 5 forks source link

Add Windows-focused compiling tooling to create ready-to-use binary for hopr-chat #89

Closed 0xjjpa closed 4 years ago

0xjjpa commented 4 years ago

Introduction

As described in our docs, hopr-chat can be run inside a Windows computer using Docker. However, the requirements for having Docker installed inside an average Windows machine are not only high, but also cumbersome for a non-technical user (e.g. enabling Hyper-V, ensuring the machine has virtualisation capabilities, etc). To showcase hopr-chat and push for mass adoption, we are looking to ship hopr-chat as a standalone binary that can be quickly executed to connect to other running hopr-chat nodes.

Task Description

Definition of Complete

The task is considered completed when a build workflow for the Windows Binary has been added to the project and a successful release can be used on any Windows 64-bit machine on a double-click fashion. Furthermore, the binary is able to execute through all the steps shown in our Documentation, specifically from Step 3 to 5. The easiest way to do so, is by running the binary multiple times inside the same computer with different ports and effectively sending messages across each other.

Testing Criteria

Notes

Some prior work was conducted (see below under “Prior Work”). For the deliverable, we are not only looking for the compiled binary, but also the required steps to build one, alongside the tooling or pipeline setup needed to enable so. If third party tooling is used (e.g. Azure Pipelines), please describe as such.

Prior Work

There's some previous work done on this task, which can be seen in https://github.com/hoprnet/hopr-core/issues/26 and https://github.com/hoprnet/hopr-core/issues/88 more recently. Right now, all effort on this direction can be seen in https://github.com/hoprnet/hopr-core/issues/86, and might need tasks like https://github.com/hoprnet/hopr-testing/issues/1 to be completed first as to ease the process.

Nexe

Multiple efforts were done using nexe, but we stumbled upon multiple issues. To mention just some:

In short, some work was done here but even by bundling the entire node_modules folder would create a 1.2 GB binary and would yet still not work. In some cases, the nexe created binary would work, but as soon as the binary would be moved to another computer, it will fail to find the dependencies, and even shipping with a node_modules folder alongside would produce some errors such as the following:

image.png

Pkg

Another tool called pkg was also explored, and even with the included externals it would not work.

image.png

In this particular case, we were faced with an error KeccakState, which we had been unable to resolve and are trying to pin to ganache-core as seen in https://github.com/hoprnet/hopr-core-ethereum/issues/63.

image.png

So far that has stopped our progress using pkg so far, as that doesn't seem to be an issue with pkg itself but with the program so far. It's worth mentioning that running the program with node running locally in a Windows computer works without any issues, and that pkg also has similar issues as nexe handling external/native dependencies (see https://github.com/vercel/pkg/issues/663, https://github.com/vercel/pkg/issues/749, and some efforts in https://github.com/vercel/pkg/pull/837)

State of Art

Some projects are looked upon in order to use them as a reference as to mimic their successful setup. In particular, we had been taking a close look at IPFS as they have effectively being able to run an ipfs node based on JavaScript alongside a Desktop App (see https://github.com/ipfs-shipyard/ipfs-desktop).

We have noticed that IPFS created its own bundler, Aegir as to bundle some of their code as seen in their javascript implementation of ipfs, and are now actively looking to implement it. It sadly doesn't have TypeScript support yet, but there's an existing PR driving some of that conversation (i.e. does not provide TypeScript support, only jsdocs).

(It's worth mentioning some efforts had already been done with Aegir, but we now stumble with some issues from our own dependencies (i.e. ganache-core) that need to be handled, see screenshot below).

image.png

Some of the work in terms of distributed deliverables for libp2p based projects for IPFS can be seen in their root GUI repo - https://github.com/ipfs/ipfs-gui. From compiling ipfs into a single executable file (js-ipfs) to bundling into their desktop app can be found from there. For instance, we have yet to explore electron-builder which will be the next step to follow.

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 80.0 DAI (80.0 USD @ $1.0/DAI) attached to it.

0xjjpa commented 4 years ago

This has been completed in https://github.com/hoprnet/hopr-core/pull/106. We are still not embedding everything needed for a full “binary” per se, but right now it's enough for us to get started with node as a dependency for the time being. Closing.

KiChjang commented 4 years ago

@SCBuergel Do you mind cancelling the corresponding Gitcoin bounty for this issue?