Hacker News Re-Imagined

Redbean 2.0 turned into more than a hobby project

  • 1040 points
  • 20 days ago

  • @jart
  • Created a post

Redbean 2.0 turned into more than a hobby project


@lxe 20 days

Replying to @jart 🎙

I love how this is a huge hack and it works so well. Nicely done.

Reply


@cycomanic 18 days

Replying to @jart 🎙

What would be awesome if fossil (the scm) could be integrated into this. This would enable to put you repository on a USB stick and you could use it (including issues etc) on any platform without installing anything.

Reply


@elamje 19 days

Replying to @jart 🎙

This is so amazing - I had to give it a shot. There have only been a couple of projects I’ve ever gotten excited about on HN and this is certainly one of them!!

I’m curious if any other users ran into issues with MacOS running 2.0? I may have just missed a step, but I started an issue nonetheless.

https://github.com/jart/cosmopolitan/issues/426#issue-127445...

Reply


@sscarduzio 20 days

Replying to @jart 🎙

No ARM64 love?

Reply


@panarky 20 days

Replying to @jart 🎙

Maybe this is common knowledge, but this is a quick and dirty way to reduce bots, spam and abuse.

    if geo:get('location', 'accuracy_radius') >= 100 then
       SetStatus(403)
       Write('you can only post comments from your home internet connection')
       return
    end
Bad actors often use cheap cloud instances, and the IP addresses of their data centers typically have an accuracy radius of 1000 km.

Reply


@dinobones 19 days

Replying to @jart 🎙

whenever I need a web server in a pinch: "python3 -m http.server"

Reply


@r0b05 19 days

Replying to @jart 🎙

I've been following this project but am curious about what are the actual use cases apart from being able to send a portable web site around?

If you're running a production web server you're not really switching OS's often. Something like nginx is battle tested so what would be the benefits of using redbean?

It is a marvelous piece of technology but I am struggling to see the use cases right now.

Reply


@mister_goo 20 days

Replying to @jart 🎙

This is a single executable web server with Lua and other libs, with a zip file appended. I have done something similar with Python+tcltk.

Reply


@didip 19 days

Replying to @jart 🎙

I am in awe with this masterpiece. How do you even gained the knowledge to pull off something like this (and Cosmopolitan)?

You are up there on the same level as Fabrice Bellard!

Reply


@ramesh31 20 days

Replying to @jart 🎙

But can it read email?

Reply


@sergiotapia 20 days

Replying to @jart 🎙

Is this related to the ORM? https://redbeanphp.com/index.php

Reply


@kreelman 20 days

Replying to @jart 🎙

Downloaded redbean by doing curl https://redbean.dev/redbean-latest.com >redbean.com in powershell

Tried to run it IN CMD.EXE with

redbean.com -v

I get this error (in a dialog).

--------------------------- Unsupported 16-Bit Application ---------------------------

The program or feature "\??\C:\Downloads\redbean.com" cannot start or run due to incompatibity with 64-bit versions of Windows.

Please contact the software vendor to ask if a 64-bit Windows compatible version is available.

--------------------------- OK ---------------------------

If I've missed twiddling an option, please let me know?

Reply


@ncmncm 18 days

Replying to @jart 🎙

We do not deserve Justine. We can only Give Thanks.

Reply


@swamp_cypress 19 days

Replying to @jart 🎙

"There's no need for a proxy like nginx; redbean is vertically integrated."

Anyone have suggestions for caching? router? Something small and lightweight in the spirit of readbean itself.

Reply


@dflock 19 days

Replying to @jart 🎙

If you like this, you should support Justine & the project, if you can spare a few bucks a month:

> Funding for the development of redbean was crowdsourced from Justine Tunney's [GitHub sponsors](https://github.com/sponsors/jart) and [Patreon subscribers](https://www.patreon.com/jart). Your support is what makes projects like redbean possible. Thank you.

Reply


@keb_ 19 days

Replying to @jart 🎙

I've been having a lot of fun with this developing tiny webapps using Fullmoon[1]. I love Lua, but I frequently bounce between a Windows PC and a Linux PC. Having redbean + Fullmoon has made it a breeze switching back and forth without having to deal with system Lua installs. SQLite and the thorough amount of built-ins[2] is also a dream. Lua also has a lovingly awesome hobbyist community, so having another outlet for me to leverage that ecosystem is great.

[1] https://github.com/pkulchenko/fullmoon

[2] https://redbean.dev/#functions

Reply


@lovasoa 19 days

Replying to @jart 🎙

The idea is incredible ! But it doesn't seem to work on my ubuntu:

     wget https://redbean.dev/redbean-2.0.1.com -O redbean.com
    2022-06-17 10:35:12 (1,95 MB/s) - ‘redbean.com’ saved [1999386/1999386]
     chmod +x redbean.com 
     ./redbean.com 
    ./redbean.com: line 16: /tmp/ape: cannot execute binary file: Exec format error
    ./redbean.com: line 16: /tmp/ape: Success

Reply


@TimTheTinker 20 days

Replying to @jart 🎙

This is incredible. Justine's work continues to amaze.

Work like this proves that assumption-questioning research on its own can produce incredible results if done by the right people.

I think a lot of companies have stopped doing this kind of research, in favor of chasing more immediate profits, to their long-term detriment.

Reply


@m00dy 20 days

Replying to @jart 🎙

I heard that version 3.0 will be on baremetal, is that true ?

Reply


@db65edfc7996 20 days

Replying to @jart 🎙

So many great features in this release. Love the .args and subprocess support. I have been toying with redbean on and off, and I have been wanting to see if I could kludge together a poor man's long running job (scheduled) runner (something like Celery).

Also, why is redbean.dev not ported to 2.0?

Reply


@fartcannon 19 days

Replying to @jart 🎙

Every time this masterpiece comes up on HN, I try to think of something to say that explains how profoundly good this project is and I never feel like I can do it justice. It's small, it's fast, it's useful. It makes so much other software look bloated by comparison.

In a world where a lot of developers on HN are too scared to run apt upgrade, you write this brilliant piece of tech. It's inspirational, really.

Reply


@christoph 19 days

Replying to @jart 🎙

It's not often these days that a project pops up where I start thinking about re-imagining our whole build/deployment strategy around it. This project easily hits that high watermark. I'm already thinking about how we re-architect a few existing projects around it to reap the benefits. Very excited to do some new projects with this as well and get to understand it in more detail. Many thanks!

PHP support would be beyond amazing, what would be required (top-level) to get that working/usable?

Reply


@theowenyoung 17 days

Replying to @jart 🎙

Can I host multiple sites in it? Like I have a VPS, but I have 4 sites in it, can I just pack it to 1 binary file?

Reply


@mhd 20 days

Replying to @jart 🎙

Lua REPL based on new minimalistic readline lib? Interesting…

Reply


@FpUser 19 days

Replying to @jart 🎙

Never heard about it before but after reading a bit it seems like Redbean is one of the most insanely cool projects.

Reply


@Severian 20 days

Replying to @jart 🎙

Redbean is amazing. I was able to run some TLS stress tests against it (where you setup a handshake and just disconnect). I was able to pump out about 1200 connections per second between my desktop and laptop on 1gb ethernet. I only had 5 handshake errors.

I look forward to playing with this!

Reply


@AMICABoard 17 days

Replying to @jart 🎙

Never fails to amaze me! People here should check out cosmopolitan too!

Reply


@mysterydip 20 days

Replying to @jart 🎙

Really impressive feature additions since the first time I heard of it. Is Lua backend-able? I've been looking for a langage since PHP, the node ecosystem seems too volatile to me.

Reply


@turnsout 20 days

Replying to @jart 🎙

Just when you're feeling confident in your own coding skills, Justine comes along and releases an update. Just incredible stuff!

Reply


@vsroy 20 days

Replying to @jart 🎙

How does Readbean beat Nginx? My assumption was that forking is very slow.

Reply


@eismcc 20 days

Replying to @jart 🎙

It’d be fun to add raft support so that multiple readbeans could share state such as monkey patching updates and other useful distributed features. On bare metal this could be a whole stack in a tiny bin.

Reply


@Timon3 18 days

Replying to @jart 🎙

I love this project! I still remember that one of my first questions when I started programming was why there wasn't really a standard between OS for executable files. And while I always thought it should be possible, seeing it implemented and laid out is a completely different beast.

In that spirit I wanted to generate a redbean executable for an SPA. To make this process a bit easier I just published a Github Action to create a redbean server for static assets: https://github.com/marketplace/actions/create-static-redbean...

Thanks to this my Github page now hosts a single-file server of... itself: https://timonlukas.github.io/server.com

The future is now!

Reply


@silisili 20 days

Replying to @jart 🎙

Just curious about the name - what made you pick redbean? Not hating on it, it's just unusual enough for me to ask about the backstory there.

Reply


@wly_cdgr 19 days

Replying to @jart 🎙

Please keep making Lua more relevant, I want to have more excuses to work with a scripting language that's popular in gamedev

Reply


@languageserver 20 days

Replying to @jart 🎙

> Thanks to Linus Torvalds, we not only have a consensus on architecture, but we've come pretty close to having a consensus on the input output mechanism by which programs communicate with their host machines, via the SYSCALL instruction.

Could someone explain this? I cannot find any information online

Reply


@rcarmo 20 days

Replying to @jart 🎙

Only thing it's missing is Fennel, although I suspect it should be trivial to add :)

Reply


@sydthrowaway 20 days

Replying to @jart 🎙

Dead link

Reply


@disruptiveink 19 days

Replying to @jart 🎙

Wait, you reimplemented most of GNU Readline in a single file with no dependencies? Appreciate you started from someone else's library, but yours actually looks feature complete! Wow.

Reply


@delijati 19 days

Replying to @jart 🎙

.oO(Could be a whole OS written in Cosmopolitan?)

Reply


@zX41ZdbW 20 days

Replying to @jart 🎙

Maybe Cosmopolitan Libc can be developed to become a full-featured glibc replacement like Musl and what LLVM libc is going to target? To be able to link with large C++ codebases it is still missing a ton of small cruft...

Reply


@tangjurine 19 days

Replying to @jart 🎙

>There's no need for a proxy like nginx; redbean is vertically integrated

Not super familiar with this stuff, can someone explain?

Reply


@downwa 14 days

Replying to @jart 🎙

Just tried and am very impressed with APE and redbean. However, I had to turn off Windows Defender to even download (much less run) redbean, due to it detecting redbean as Trojan:Win32/Sabsik.FL.B!ml

Windows Defender quarantines the file within seconds of download, but even when I did catch the option to Allow, it never seemed to stick.

It would be nice to either find a way to avoid redbean being seen as a virus (I'm guessing it's the self-modifying code that bothers it), or ask Microsoft nicely to add redbean to the False Positives list.

However, I'm guessing it would be easy for someone to misuse redbean too, deploying what looks legit but with some added nefarious code. In that case, you'd need to submit checksums of legitimate releases to Microsoft (and other antivirus vendors) just to make deployment of the base redbean work without complaint. And anyone who adds to the archive for their own use (basically any real use of it) would have to do the same...

Not trying to discourage anyone. This is a great project! Looking for solutions to the false positive antivirus problem.

Reply


@csdvrx 20 days

Replying to @jart 🎙

I love it!

If I may suggest, supporting more languages than lua could help bring more people: say php or python, maybe with something like vscodium?

IIRC python2 was a WIP (issue #141 for cosmopolitan)

Personally I'd prefer perl for performance, and vscodevim or similar to edit code, but I have weird tastes :)

Reply


About Us

site design / logo © 2022 Box Piper