Live data from Hacker News

Show HN: Redbean – Single-file distributable web server

justine.lol

41–50 of 264 posts

Re: Show HN: Redbean – Single-file distributable web server

#42
Am I the only one having issues trying to get this working? The webserver starts just fine, but once I add the index.html with zip as in the example, it stops working. This is on Mac 10.15, CentOS 8 and Ubuntu 18.04 LTS.

Centos: [centos@test ~]$ ./redbean.com -vv

  error: Uncaught SIGSEGV on test.novalocal
  ./redbean.com
  EINVAL/err=22/errno:2/GetLastError:0
  Linux test.novalocal 4.18.0-240.10.1.el8_3.x86_64 #1 SMP 
  Mon Jan 18 17:05:51 UTC 2021
On the mac: ~ my-Maccie$./redbean.com -vv Killed: 9

On Ubuntu: ubuntu@localhost:~$ ./redbean.com -vv

  error: Uncaught SIGSEGV on localhost
  ./redbean.com
  EINVAL/err=22/errno:2/GetLastError:0
  Linux localhost 4.15.0-136-generic #140-Ubuntu SMP Thu Jan 
  28 05:20:47 UTC 2021

Re: Show HN: Redbean – Single-file distributable web server

#44
post #42

Am I the only one having issues trying to get this working? The webserver starts just fine, but once I add the index.html with zip as in the example, it stops working. This is on Mac 10.15, CentOS 8 and Ubuntu 18.04 LTS. Centos: [centos@test ~]$ ./redbean.com -vv error: Uncaught SIGSEGV on test.novalocal ./redbean.com EINVAL/err=22/errno:2/GetLastError:0 Linux test.novalocal 4.18.0-240.10.1.el8_3.x86_64 #1 SMP Mon Ja…

No, I have the same issue on Linux Mint 20.1

Re: Show HN: Redbean – Single-file distributable web server

#46
post #21
post #15

Earlier quoted context omitted.

I agree, I got to the page on actually portable executable, and had to read it a few times to make sure I was grokking it properly. This is just sheer cleverness, THIS is the stuff that should be on hacker news!

For real. It's hard to grok cause there are no words to describe it. When people say that something is cross-platform, they usually mean a) that the software will build on multiple platforms b) there is some sort of vm which runs the executable (jvm, beam, wasm) This is the SAME binary. Running everywhere. Could be super-useful as an archival format for mission critical code. sqlite comes to mind. Maybe it's late at…

Author here. Thanks! I've added a new sponsor tier per your request. https://github.com/sponsors/jart

Re: Show HN: Redbean – Single-file distributable web server

#47
It's a neat coincidence that this is on at the same time as an article about CP/M, because I think there could be some overlap in the programs that would be a good fit for cosmopolitan.

Sure, there's server appliances like this, and I hope someone makes a neat services wrapper to abstract at least some platform's intricacies so you can do a "cosmo-service up redbean" on BSD/Linux/Windows.

But coming back to CP/M, there you had a lowest common denominator of terminal applications, too, but spread across different architectures. And you could still produce some quite intersting, if a bit business-like applications. These days you probably can even rely on more ANSI colors and maybe even unicode fonts (hopefull as an option, not mandatory).

The ZIP characteristics of the APE format make it even easier to distribute a whole application in a rather simple way. Yes, sure, you can do regular Unix-style servers and pipe-it-together CLI tools, but I wouldn't mind more self-contained "business" applications with a lo-fi aesthetic regarding interface and API usage. The PICO-8 of TUIs…

Re: Show HN: Redbean – Single-file distributable web server

#48
post #8

The short description is a bit too short; this is mind blowing! Redbean is a portable, single file executable webserver which also acts as a zip-file for the static content it hosts, and runs on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS without any recompilation... You can manage the static content using standard pkzip tooling! Now that's what I call thinking out of the box! Edited: some rewording and…

Is it that this binary does some tricks to run on Linux, Mac, Windows, FreeBSD, OpenBSD, NetBSD, BIOS or does it really work on all operating systems including something like Plan 9 or even TempleOS? And does it run on different architectures like ARMv6?

I think it qemu's itself if run on another platform.

Re: Show HN: Redbean – Single-file distributable web server

#49
Just make sure you don't have another server running on :8080.

I had syncthing running and kept getting some error whenever I tried to run redbean. The error didn't make much sense, but eventually I realised that this was the casue of the error.

I'm really impressed how portable this is. The only improvement I can see is if it auto-opened your browser to :8080. That way it would be easy to distribute the binary and have people run your application and just interact with it through their browser. No need to ship electron then!

Re: Show HN: Redbean – Single-file distributable web server

#50
post #37

Everybody is hyped up here but can someone explain to me what are the implications for the future of programming? Will I be able to write apps in a single language and have then run truly native on any OS or what else will we be able to do?

This is something like a "fat binary" with some magic in the header that allows it to run out of the box on Windows and several different UNIXes, a bit like those sneaky shell scripts that run on several platforms[0]. It still needs to include some native code for each of the platforms inside the compiled binary, so it's perhaps better to see it as a slick packaging/distribution solution for C programmers than a total game changer for developers everywhere.

The more interesting thing I think is the mapping of C library functionality between Linux, BSD and Windows. There have been other attempts to do this, but they never seem to get much traction. I think it's because C programmers tend to get wedded to their OS of choice and then invest time in improving that platform's C libraries. The problem with trying to remain portable with everything is that you tend to be stuck working with the lowest common denominator functionality, which can be frustrating when doing OS-specific stuff would open up so many more options.

All that said, the cleverness of this project is inspirational in a way that might encourage other programmers to also focus more on building against simple functionality that is truly portable. It shows that you don't need all the bells and whistles to build cool stuff. That feels aligned with early UNIX philosophy and (more broadly) the hacker ethic, which is why it's neat to see, even if never gets adopted as a mainstream thing.

[0] https://github.com/llamasoft/polyshell

Post reply on HN