question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Evaluate use of pkg to make single-binary server

See original GitHub issue

pkg is a application that compiles the project into a single executable, which we currently do, but pkg seems to be flexible as you can provide runtime version and such with the sacrifice of requiring some of the requires to be __dirname’d

[Zeit pkg repo]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
code-ashercommented, Apr 27, 2022

To go back a bit first, I think the main draws were that a single binary is easy to run (just download one file and execute it), easy to install (just copy one file), and easy to clean up (just delete one file).

Unfortunately the single binary ended up not being straightforward because there are extensions that make file reads to some of the files distributed with code-server which fail because those files are not actually individually on the filesystem; they are in the binary. Another example is the git extension; it was attempting to spawn a shell script distributed with code-server which does not work for the same reason. There may be other broken scenarios we did not discover.

To deal with this I believe there were three ideas:

  1. Binary extracts parts of itself then we patch reads/spawns/etc to read from the extracted location (we did this for a while).
  2. Patch reads/spawns/etc to read directly from the binary (I think we tried this but ran into issues).
  3. Binary extracts itself entirely and we run from the extracted location.

In practice the first two strategies sort of worked but they were brittle (basically a game of whack-a-mole) and the patching only works for JavaScript code. Self-extraction deviates from why we wanted a single binary in the first place since it is not especially different from an archive except less flexible since you cannot choose the extraction location.

If there was a general and robust way of solving these issues then I feel like going back to the single binary would be a good option.

0reactions
jsjoeiocommented, Apr 26, 2022

Interesting! Smaller is definitely appealing. I don’t know the full history around some of the hacks or limitations from the early years of the project.

@code-asher do you have any context? Is this worth considering?

Read more comments on GitHub >

github_iconTop Results From Across the Web

vercel/ncc: Compile a Node.js project into a single file ... - GitHub
This is useful for packages that want to use .js files as modules in native Node.js using a "type": "module" in the package.json...
Read more >
Parameter server training with ParameterServerStrategy
ParameterServerStrategy will use all the available GPUs on each worker, with the restriction that all workers should have the same number of GPUs...
Read more >
Create single binary from express + react app with zeit pkg?
I can start both like this: scripts element in package.json: "myapp": "concurrently --kill-others \"node server\" \"npm run --prefix client ...
Read more >
Creating and Publishing a Package - Oracle Help Center
Publication in IPS consists of the following steps: Generate a package manifest. Add necessary metadata to the generated manifest. Evaluate dependencies. Add ...
Read more >
Comparing Go vs. C in embedded applications
In this evaluation process Go, C, and C++ were shortlisted as candidates ... in C and reuse code between the client and server...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found