This repository has been archived by the owner on Dec 21, 2020. It is now read-only.
Add Windows-focused compiling tooling to create ready-to-use binary for hopr-chat #89
Labels
help wanted
Extra attention is needed
Milestone
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 showcasehopr-chat
and push for mass adoption, we are looking to shiphopr-chat
as a standalone binary that can be quickly executed to connect to other runninghopr-chat
nodes.Task Description
chat/package.json
calledbuild:binary:windows
which runs the required commands to deliver a binary insidedist/windows/winx64-12.9.1
. The architecture targeted isx64
and the node version to be used is12.x
(ideally12.9.1
, as12.9.0
has some memory leak issues).Windows 10 Home
andWindows 10 Pro
editions, both on 64-bit architectures, able to be run as standalone binaries executable via “double-click”. In case some external dependencies need to be bundled alongside (e.g.wrtc.node
), please provide the binary as azip
compressed folder which can be extracted and run alongside the dependencies.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
package.json
includes all the requireddevDependencies
to bundle, compile and create a distributable binary usable in any Windows 64-bit computer.package.json
includes the scriptbuild:binary:windows
which will trigger a local build against the existing codebase to produce an executable binary..exe
format or similar. If additional external dependencies need to be distributed alongside, then the distributable will be a.zip
file which will be easily extracted and then run in any working directory.Windows 10 *
distribution (e.g. Home, Pro) and all needed dependencies will be included, such as anode
runtime that can processhopr-chat
logic.F5
.Run as an Administrator
is used..env
file inside the same working directory to read env variables such asBOOTSTRAP_SERVER
1 GB
in disk space.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 #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 hoprnet/hopr-testing#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 a1.2 GB
binary and would yet still not work. In some cases, thenexe
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 anode_modules
folder alongside would produce some errors such as the following:Pkg
Another tool called pkg was also explored, and even with the included externals it would not work.
In this particular case, we were faced with an error
KeccakState
, which we had been unable to resolve and are trying to pin toganache-core
as seen in hoprnet/hopr-core-ethereum#63.So far that has stopped our progress using
pkg
so far, as that doesn't seem to be an issue withpkg
itself but with the program so far. It's worth mentioning that running the program withnode
running locally in a Windows computer works without any issues, and thatpkg
also has similar issues asnexe
handling external/native dependencies (see vercel/pkg#663, vercel/pkg#749, and some efforts in vercel/pkg#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).
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 compilingipfs
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.The text was updated successfully, but these errors were encountered: