16 ms·
Redbean 2.0 turned into more than a hobby project
- mysterydip 4y agoReally 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.
- deleted 4y ago[deleted]
- paulclinger 4y ago> Is Lua backend-able? I'd say yes; I've been using it to develop https://github.com/pkulchenko/fullmoon https://github.com/pkulchenko/fullmoon, which is a redbean-based webframework written in Lua.
- ifyouhate 4y ago
- tomcam 4y agoFullmoon looks impressive and your README.md is very well written.
- paulclinger 4y agoThanks tomcam! There are still several sections that need to be completed (mostly around template processing), but getting feedback like this is always encouraging.
- jay_kyburz 4y agoThank you for ZeroBrane! I am a Love2D user!
- VWWHFSfQ 4y ago> Is Lua backend-able? Yes and some of the largest web infrastructures in the world run on it! I'm not sure if it's still true, but it's my understanding that CloudFlare runs it at the edge globally. I personally know of several other _very large services_ running it at massive scale. In my experience Lua in nginx is such a pleasure to work with. It's all transparently async using nginx's event loop. You just write regular procedural code in Lua and the runtime handles yielding/resuming for you automatically. There's no special async/await stuff. Just write your Lua code and the runtime figures out the yield points internally. It's a breath of fresh air. [0] https://openresty.org https://openresty.org [1] https://en.wikipedia.org/wiki/OpenResty https://en.wikipedia.org/wiki/OpenResty Edit: This was from several years ago, but CloudFlare built their WAF product on nginx/Lua: https://blog.cloudflare.com/cloudflares-new-waf-compiling-to-lua/ https://blog.cloudflare.com/cloudflares-new-waf-compiling-to...
- formerly_proven 4y agoLikely more because of Mike Pall's LuaJIT instead of the traditional reference implementation.
- adolph 4y agoIs Kong still OpenResty based?
- VWWHFSfQ 4y agoYes Kong is a custom distribution of OpenResty
- oliwary 4y agoLua also powers itch.io! [0] Leafo, the creator, has also built Moonscript [1], a language that compiles to lua, and Lapis [2], a web-framework for Lua and Moonscript. I am always fascinated by his productivity. [0] https://leafo.itch.io/ https://leafo.itch.io/ [1] https://moonscript.org/ https://moonscript.org/ [2] https://leafo.net/lapis/ https://leafo.net/lapis/
- christoph 4y agoYou're not alone. Maybe it's lack of knowledge on my part... but too much around node / npm, still seems like copy/pasting random incontations into the command line to try and solve whatever problem I have at a specific time. There is lot's of good in there, but somethings just don't work how you think they will. For instance, we've been building a totally static site recently in node/npm/js/posthtml and posthtml has a concept of "local variables". A project called posthtml-expressions in theory allows you to put "expressions" into "HTML" modules (if's, loops, etc.), but it only works with "globally" defined variables. i.e. you can't define a variable locally to a component, you need to define it "globally" in the project, which IMO defeats the whole purpose of the project. Nowhere is this easily explained or defined in their documentation. The first thing I want to do is define a property/attribute inline to a component, otherwise I end up with word soup of global variables - $page_1_title, $page_2_title, etc., rather than <component title="xxx">. Bizarre. No idea what the point is if I can't declare variables "locally" to said component? And this is the feeling I've got of lots of NPM packages - there is just no cohesion between things. I love the work people have done, it's literally saved me hundreds of man hours, but I've also spent untold hours wrestling with things that seem obvious to me, that should work, which frankly just don't work how I expect. Maybe it's me?
- downwa 4y agoJust 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.
- jart 4y agoAuthor here. I would happily share information like hashes and build artifacts with Microsoft and other virus scanners if it would fix all these false positives. However I don't know how to do that (other than uploading to VirusTotal which I've always done) and Windows is just 1 out of the 6 platforms we support. I don't charge money for redbean. I don't have a commercial interest in distributing these binaries. I'm just an open source developer trying to help out. It's up to the community members who want to see it unflagged with Windows to help us make that happen, and I'm happy to cooperate in any way I can.
- mhd 4y agoLua REPL based on new minimalistic readline lib? Interesting…
- panarky 4y agoMaybe 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.
- m00dy 4y agoI wouldn't prefer that rule.
- detaro 4y agoHave a normal connection at one of Germanys biggest ISPs, am a bot according to that rule.
- 8organicbits 4y agoThe same is true for some large US based ISPs. Lot's of home users would be considered bots using this rule.
- andrewmcwatters 4y agoThanks for sharing this, but how are accuracy radii defined by MaxMind?
- gazby 4y agoThis strikes me as a terrible idea, relying on an idiosyncrasy of an arbitrary database to deny access to users. For anyone doing something like this with a service that's useful to people, consider MaxMind's minFraud service. It's PAYG and you can choose three different levels of information at three different price points. It's targeted at fraud minimization, but you can hand it as little as an IP address and it'll give you what you need to know.
- panarky 4y agoDepends on the use case. MaxMind's minFraud is $0.015 per request and requires a call to an external endpoint. Justified for finance and shopping apps, not great for a high volume free service. And you don't have to deny based on this one signal alone, you could fall back to recaptcha or minFraud to reduce the false positive rate.
- m00dy 4y agoI heard that version 3.0 will be on baremetal, is that true ?
- jart 4y agoWe're working on improving our bare metal support. Once we embed a TCP/IP stack your redbean will optionally be able to run as its own autonomous operating system with the absolute lowest network latency and minimal attack surface area. It's a idea whose time has come now that everything runs under a hypervisor in the cloud. If the hypervisor is the new operating system, then it'd be nice to not need a second operating system too.
- rank0 4y agoI love your work! How do you find the time to work on readbean/ape/etc? I sponsor you on github, but surely donations pale in comparison to what you could earn at an engineering day job. Do you plan on writing your own tcp/ip stack with cosmopolitan? Why not pull in the networking stack and syscall libraries from MirageOS?
- jart 4y agoIt's not so much could but have. I used to work at Google Brain. I decided I'd rather be doing this instead. I make it work by living modestly, eating ramen, and avoiding doctors. Thank you for sponsoring me! It helps a lot.
- eigenvalue 4y agoI have really enjoyed your submissions in the past year. Just sponsored you on Github. I feel like your work is of sufficient excellence and utility that you shouldn't need to eat unhealthy food to get by. Have you considered applying for grants from the non-profit arms of big tech companies? I do think that if you can combine Python in redbean in a seamless way, it would really drive adoption and lead to more sponsors for your work. Anyway, thanks for many hours of entertainment watching blinking lights.
- sscarduzio 4y agoNo ARM64 love?
- db65edfc7996 4y agoSo 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?
- jart 4y agoTry hitting ctrl+shift+r in your browser. Sometimes browsers don't respect the cache headers which say 1 hour max and I haven't figured out why. This new release includes functions like setitimer() to help the primitives be there for anyone wanting to use Lua to build something like Celery.
- unsafecast 4y agoFirefox uses Ctrl-R instead.
- capableweb 4y agoMaybe that depends on the OS? Firefox on Linux does a normal refresh for me when doing CTRL+R but a hard refresh (without any cache) when I do CTRL+SHIFT+R.
- twicetwice 4y agoThis is standard at least across Chrome and Firefox on Linux and MacOS— (ctrl|cmd)+R does a normal page refresh, (ctrl|cmd)+shift+R does a "hard refresh" where it reloads every resource on the page without caching. Also, in Chrome, if and only if you have the dev tools open, right clicking the reload button will give you a menu with the options "Normal Reload", "Hard Reload", and "Empty Cache and Hard Reload". The third option will ensure that requests initiated by JS or that otherwise weren't part of the page load also won't be served from cache.
- igravious 4y ago
- sydthrowaway 4y agoDead link
- jart 4y agoDo you use Comcast Xfinity? Try using 8.8.8.8 for DNS.
- sydthrowaway 4y agoTrue, but why this workaround?
- twicetwice 4y agoI ran into the same issue on Xfinity, why is it broken there? Some nonsense Comcast gets up to?
- jart 4y agoI don't know yet. This was only reported recently. Do you know if there's a form I can fill out to file an appeal? Abuses of DNS are very common around the world and we're starting to see a lot more of it in the first world. In the Cosmopolitan repository, we've always had a PNG file checked-in to cope with these kinds of situations. https://github.com/jart/cosmopolitan/blob/master/libc/dns/dns.png https://github.com/jart/cosmopolitan/blob/master/libc/dns/dn...
- cyanydeez 4y agoYou may want to upload the file to virustotal.com Likely everything you're doing have been done in various Trojans, viruses, etc. You'll need to hack the noosphere at this point
- jart 4y agoI always upload my binaries to VirusTotal and always have. Like what? Writing assembly? Using the RDTSC instruction? Having a run-length decoder to make lookup tables smaller? I must be a stone cold black hat hacker. Anyone who monitors the behavior of these programs can see they're fully transparent, don't interact with the system weirdly, and they don't have any telemetry. The truth is some virus scanner person wrote an overly broad regex somewhere that's raising false positives due to a completely random occurrence. It might not happen as much to people who use MSVC since it always generates binaries the exact same way. But does that mean we should accept an MSVC monopoly? Because MSVC is the kind of compiler that's been known to insert telemetry into your programs when it wraps main(). Why don't virus scanners complain about that? All I'm trying to do is innovate in this space and create a better alternative. There shouldn't be these kinds of roadblocks to competition. In fact APE doesn't even compete. It's designed to be a complementary format that bridges gaps between communities and helps reduce pain for developers.
- sergiotapia 4y agoIs this related to the ORM? https://redbeanphp.com/index.php https://redbeanphp.com/index.php
- xmonkee 4y agono
- JodieBenitez 4y agoGreat ORM by the way.
- quickthrower2 4y agoThe second hardest problem in CS
- speed_spread 4y agoDepending on what you ORDER BY
- rawoke083600 4y agoAbsolute hidden treasure in PHP world :)
- csdvrx 4y agoI 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 :)
- jart 4y agoWe ported Fabrice Bellard's QuickJS engine to Cosmopolitan last year. We ported Python3 too. (You can build Python3 as a 5mb single file Actually Portable Executable!) So integrating them into redbean is on the table. The big question is whether or not redbean should be multitenant with languages, or if we should ship separate binaries where you choose the redbean "flavor" that has your preferred one. I'm leaning towards the latter, since there can only be one REPL language. What do you think?
- thesuperbigfrog 4y ago>> The big question is whether or not redbean should be multitenant with languages, or if we should ship separate binaries where you choose the redbean "flavor" that has your preferred one. I'm leaning towards the latter, since there can only be one REPL language. What do you think? Different flavors of redbean would be awesome! Thank you for building redbean.
- eigenvalue 4y agoI also think the latter is cleaner. I might also suggest that if you are going to integrate with Python, you should make it as "batteries included" as possible with the Python data stack (numpy/pandas/scipy/sklearn) so that you can easily add a redbean web app to an existing Python project without worrying about how those "heavy duty" libraries will work.
- foxhop 4y agothat seems sane to me with my novice understanding of the project. im most confortable with Python3 & have existing projects which I would try to port over as a test. a python3 flavor could be experimental at first, I bet it would boost overall adoption & be an unfair advantage over nginx approach. having multiple repl in one binary would remind me of containers in a very strange but cool way, that would be more a fun experimental feature a rabbit hole for others to explore.
- mister_goo 4y agoThis is a single executable web server with Lua and other libs, with a zip file appended. I have done something similar with Python+tcltk.
- ok_dad 4y agoYea but this one runs on 6 operating systems with the same binary artifact.
- socialdemocrat 4y agoOn an OS without a Python interpreter? I doubt it. This is a binary that runs anywhere. No interpreter or virtual environment needs to be installed for it to work.
- ramesh31 4y agoBut can it read email?
- capableweb 4y agoWhy not? https://github.com/vrld/imap4.lua/blob/master/example.lua https://github.com/vrld/imap4.lua/blob/master/example.lua
- Severian 4y agoRedbean 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!
- jart 4y agoHalf a percent is small but there should ideally be zero errors. Could you file a report so we can fix that? Part of what makes the redbean TLS stack fast is I spent some time hacking on MbedTLS to improve its performance. One of things that's counter intuitive about crypto code is assembly can be safer in additional to being faster, since it helps guarantee the compiler doesn't add branches, for things like bit overflow carrying in arithmetic operations. One example is https://github.com/jart/cosmopolitan/blob/master/third_party/mbedtls/secp384r1.c https://github.com/jart/cosmopolitan/blob/master/third_party... which I wrote to make the NSA curve much faster. I've been meaning to upstream into MbedTLS. Another thing I added is https://github.com/jart/cosmopolitan/blob/master/libc/nexgen32e/mul8x8adx.S https://github.com/jart/cosmopolitan/blob/master/libc/nexgen... which greatly improves the performance of RSA multiplication using Intel's ADX ISA. But C crypto code can be beautiful too! For example, I found Everest (curve25519) particularly impressive, since they solve overflow in a different way, and as such, it's quite possibly the only large piece of C/C++ code I've ever seen that contains zero conditional branches and zero pointers. https://github.com/jart/cosmopolitan/blob/master/third_party/mbedtls/everest.c https://github.com/jart/cosmopolitan/blob/master/third_party... The closest thing I've found to measuring the performance impact of my changes is by recording how long the MbedTLS test suite takes to run. The speedup for suite_ssl is 13.11x faster, RSA is 1.91x, ECP is 1.86x, and ECDSA is 2.84x.
- Severian 4y agoSorry to drag an old thread up, I just saw your reply. This was testing against the old version (1.4) a while ago. I retested using the new version and have 0 errors. However, that said, I also upgraded my ethernet switch since then, so possibly the original TLS errors were due to simple dropped packets.
- deleted 4y ago[deleted]
- newaccount2021 4y ago
- rcarmo 4y agoOnly thing it's missing is Fennel, although I suspect it should be trivial to add :)
- capableweb 4y agoThat was my first thought as well. If it can support Fennel as a first-class citizen, then I might just switch wholesale to using Redbean for any application development.
- masukomi 4y agoyup. I was thinking the same thing.
- javajosh 4y agoFor the curious, Fennel[1] is to Lua what Clojure is to Java. I'm curious, though, can you not add Lua libraries to redbean? My understanding is that the file is a zip and you can therefore add dependencies and (presumably) load them into the lua runtime on invocation. E.g. you don't need Justine to add it for you, you can add it yourself. 1 - https://fennel-lang.org/ https://fennel-lang.org/
- rcarmo 4y agoI don’t want it added, I want it as a first-class citizen so I don’t have to write Lua to configure, load fennel and invoke handlers…
- actuallyalys 4y agoI created a template for adding Fennel to Redbean, although I haven't tested it with Redbean 2.0:https://gitlab.com/actuallyalys/redbean-fennel https://gitlab.com/actuallyalys/redbean-fennel.
- zX41ZdbW 4y agoMaybe 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...
- jart 4y agoThat's one of our goals! We recently started porting libcxx: https://github.com/jart/cosmopolitan/tree/master/third_party/libcxx https://github.com/jart/cosmopolitan/tree/master/third_party... This week we're working on getting the complex math functions in, thanks to Musl and one of our most productive contributors: https://github.com/jart/cosmopolitan/pull/422 https://github.com/jart/cosmopolitan/pull/422 Anyone reading who wants to get involved, you're very much welcome to join our project. Please join our Discord https://discord.gg/EZwQUAcx https://discord.gg/EZwQUAcx and read https://github.com/jart/cosmopolitan/blob/master/CONTRIBUTING.md https://github.com/jart/cosmopolitan/blob/master/CONTRIBUTIN...
- turnsout 4y agoJust when you're feeling confident in your own coding skills, Justine comes along and releases an update. Just incredible stuff!
- heavyset_go 4y agoSeriously, APE was just impressive and they just keep on going.
- deleted 4y ago[deleted]
- silisili 4y agoJust 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.
- jart 4y agoIn my GitHub profile photo https://github.com/jart https://github.com/jart you'll see me holding a stuffed toy I call greenbean which has been cute little work desk companion of mine for some time. Later on I came into possession of a stuffed red lobster. A Chinese friend of mine suggested the name redbean as a companion for greenbean. Later in 2020 I was writing demo programs to showcase the capabilities of Actually Portable Executable. When I decided I wanted to write an HTTP server, redbean was looking up at me on my desk. That's when the idea clicked and it's been redbean ever since.
- silisili 4y agoNice, that explains the lobster logo too. Thanks for sharing :).
- eismcc 4y agoIt’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.
- pstuart 4y agoyep. It's being done today with dqlite -- perhaps there's an opportunity for synergy?
- languageserver 4y ago> 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
- justinsaccount 4y agohttps://en.wikipedia.org/wiki/Linux_kernel_interfaces https://en.wikipedia.org/wiki/Linux_kernel_interfaces
- jart 4y agoThe Fifth Bell System Interface, Community Edition https://github.com/jart/cosmopolitan/blob/master/libc/sysv/syscalls.sh https://github.com/jart/cosmopolitan/blob/master/libc/sysv/s...
- throwaway09223 4y agoA syscall is a method for calling a kernel routine to do something outside the current process. All i/o (network, filesystem, ipc), memory allocation, process interaction, signals, etc go through syscalls. open(), read() and write() are all syscalls. If the syscall interface exists then the only thing left to do is to execute the program -- which depends on the cpu executing the machine instructions. If the machine instructions are for the wrong cpu then emulation may come into play.
- chubot 4y agoIt might help to understand API vs. ABI with respect to the C language and CPU architectures. I put definitions here awhile ago, and mentioned the Actually Portable Executable project as an example of taking the ABI philosophy to an extreme, and ignoring APIs (source code). https://www.oilshell.org/cross-ref.html#API https://www.oilshell.org/cross-ref.html#API Links to this thread: https://news.ycombinator.com/item?id=12029321 https://news.ycombinator.com/item?id=12029321 It's unfortunately not explained well in many places, and even experienced C programmers don't understand the details. You won't learn about this in a C programming book, because it's not really part of the C language proper. It sits at an awkward spot between the language, the CPU, and the operating system. ---- The relation to Linus Torvalds is that historically Unix kernels were developed in a single tree and there was no stable ABI. For example I believe OpenBSD and NetBSD are still like this. But Linux is different in that the kernel maintained a stable ABI, and you can run different user utilities on top, without necessarily recompiling them against headers. Highly related blog post and discussion: https://old.reddit.com/r/ProgrammingLanguages/comments/tg55ow/c_isnt_a_programming_language_anymore_faultlore/ https://old.reddit.com/r/ProgrammingLanguages/comments/tg55o... (including comments by me/oilshell explaining the Unix kernel interface issue)
- lxe 4y agoI love how this is a huge hack and it works so well. Nicely done.
- TimTheTinker 4y agoThis 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.
- deleted 4y ago[deleted]
- vsroy 4y agoHow does Readbean beat Nginx? My assumption was that forking is very slow.
- nielsole 4y agoJust guessing here, but redbeam likely does not have to access the filesystem as the files are in the binary and thus saves on syscalls and context switches.
- jart 4y agoOne thing that helps is the binary size is tiny and the memory usage patterns are tight. It's bloat that usually makes fork() go slow, since if you have a lot of little pieces updating disparate memory locations, then you're going to have a lot of page faults. Redbean was built with a singular first-principles vision. When I started working on this, all I had was an empty file and an assembler. As such, I spent a lot of time using things like linker scripts to organize exactly where in the binary code gets relocated.
- rawoke083600 4y ago>have a lot of little pieces updating disparate memory locations, then you're going to have a lot of page faults. This is wonderful, just thinking out loud. Out of interests would something like ECS (Entity Component System) be useful or yield better memory usage since it should in theory trash the cache less ?
- kreelman 4y agoDownloaded redbean by doing curl https://redbean.dev/redbean-latest.com 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?
- jart 4y agoTry the following: wget -O redbean.com https://redbean.dev/redbean-demo-2.0.1.com .\redbean.com -v The "curl" on Windows appears to output a UTF-16 headers list to stdout. I verified the above will work in PowerShell.
- kreelman 4y agoHi Jart, From powershell, via .\redbean.com -v Program 'redbean.com' failed to run: Operation did not complete successfully because the file contains a virus or potentially unwanted software At line:1 char:1 + .\redbean.com -v + ~~~~~~~~~~~~~~~~. At line:1 char:1 + .\redbean.com -v + ~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException + FullyQualifiedErrorId : NativeCommandFailed From cmd.exe I get The system cannot execute the specified program. I'll see if I can get it "unblacklisted", Perhaps my anti-virus got to it first?
- jart 4y agoYes please help us get it unblacklisted with your scanner. Security vendors work by keeping an eye out for the strange and unusual, and I myself am strange and unusual. The last month or so has been particularly bad with the virus scanners. Possibly due to some random change I made to the APE assembly or performance optimization in the C library. For example, we've needed to make changes in the past where error messages containing the word "oldskool" needed to be removed because virus scanners thought that made it a virus. Also if you get a chance, please upvote the redbean binaries on VirusTotal. I always try to do that (I'm "howishexeasier") since it helps people verify that a binary came from me. Traditionally the open source community worked around these issues by not distributing binaries and instead asking people to build the software on their own. I like the convenience of binaries because open source software is becoming increasingly fragmented and impossible to build. So then people use interpreters instead of compilers, which are slower. In any case, I don't think the source code workaround is going to last forever. Many companies are now focusing on applying the virus scanner model to source code too.
- fartcannon 4y agoEvery 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.
- deepnet 4y agoIt is a masterpiece of tech, eminently useful. A testament to quality development work. An example of what can be achieved and how much our community benefits from good software. The Redbean 2.0 license is intriguing (snip): " Copyright 2020 Justine Alexandra Roberts Tunney │ │ │ │ Permission to use, copy, modify, and/or distribute this software for │ │ any purpose with or without fee is hereby granted, provided that the │ │ above copyright notice and this permission notice appear in all copies. │ " Seems to assert the (FSF) four freedoms well, all is good in the world, it can be used and contributed to safely by all.
- bergenty 4y ago
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- appel 4y agoI for one sure appreciate your graceful and eloquent tribute, fartcannon.
- FpUser 4y agoNever heard about it before but after reading a bit it seems like Redbean is one of the most insanely cool projects.
- elamje 4y agoThis 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-1274453274 https://github.com/jart/cosmopolitan/issues/426#issue-127445...
- jart 4y agoThis is a high priority item. It sounds like you're using a recently released Mac OS X version. One of the great fears has always been the possibility of Apple breaking the UNIX system interface, like they did to the Go team in the past. So I'd like to get any issues resolved here as quickly as possible. I left a comment on the GitHub issue about next steps.
- paulclinger 4y agoThis issue should be resolved now and redbean-2.0.2+ includes a fix for it.
- dinobones 4y agowhenever I need a web server in a pinch: "python3 -m http.server"
- toastercat 4y agoThat's not really similar to Redbean; it requires an OS-compatible Python be installed on the system (whereas Redbean is a single binary artifact that runs anywhere). Plus Redbean can substitute for nginx, whereas you should never try doing that with the built in Python server.
- christoph 4y agoIt'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?
- geek_at 4y agoOh wow redbean with PHP support would really be a killer feature
- Lorin 4y agoWould be fun to run RedbeanPHP within Redbean :D
- realitylabs 4y agoI think this is awesome too, but I’m at a loss to describe where I could replace already built services. Can you share some perspective on specific things that you see this can do that is amazing?
- ok_dad 4y agoMy industry routinely has to have electrician install additional controllers (basically just a Linux industrial computer) on customer sites because the ones already there won’t support our software. With this, I could imagine just shipping a binary on a flash drive that the customer can run on whatever they have on site. There is nothing stopping that other than it’s too hard to build our software for hundreds of hardware and OS combinations. With this you probably only need to build a handful of artifacts. It would save thousands per install. If there were a plug-in system to be able to run different languages than Lua, that would be cool too, but maybe I’ll have to learn Lua.
- 4y ago
- didip 4y agoI 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!
- jart 4y agoThank you! Through grit, focus, and never giving up no matter what.
- wly_cdgr 4y agoPlease keep making Lua more relevant, I want to have more excuses to work with a scripting language that's popular in gamedev
- r0b05 4y agoI'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.
- jart 4y agoredbean was originally intended as a locally running web server, sort of like an Electron competitor, where you launch your GUI in Chrome, rather than linking a copy of Chrome into your executable. We live in a fragmented o/s world. If you're someone like me then you've got a Macbook from the office, a Windows PC for games, a Linux workstation for compiling code, a FreeBSD server, an OpenBSD router, etc. When you're dealing with so many different systems, sometimes just having something as simple as a sed command that works reliably the same seems like an impossible ask. Now we've got an entire app platform that works on the lion's share of PCs/servers in a small 1mb file. It's also a question of being able to distribute code. I used to work on the TensorFlow team. We were tasked with building an open source library that people on pretty much every platform imaginable would use. It broke my brain just how difficult it was for us to ship open source binaries that actually work and don't cause an avalanche of GitHub issues. Even just working on more than a few Linux distros felt like an impossible ask back then. Now that I've figured out how to do it for every distro and seven operating systems total in just one file, I wish I could go back in time and use tools like redbean and Cosmopolitan Libc to fix all the things with TensorFlow that I wish I could have done. It'd've been a different project.
- lewisjoe 4y agoredbean as an electron alternative is mind-blowing! I had the same question as the op, and this perspective does put me in fascinating directions. Like, this could be the most light-weight electron alternative, with the server acting as a escape hatch to sneak cross-domain communications and computation intensive parts of the app, etc.
- swamp_cypress 4y ago"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.
- delijati 4y ago.oO(Could be a whole OS written in Cosmopolitan?)
- tangjurine 4y ago>There's no need for a proxy like nginx; redbean is vertically integrated Not super familiar with this stuff, can someone explain?
- 83457 4y agoMost languages expect you to have a high quality web server between the outside world and your code. Nginx, Apache, IIS, etc are extremely well tested and secure. They can serve up assets fast, cache, and much more. A popular way to host now is to have an nginx server or process that accepts requests from the outside and then makes a request to a less capable web server for the app internally to provide a response, also known as proxying. This provides a clear barrier with outside world in one very concise config file. What redbean apparently has is a sufficiently high quality web server included, so they can handle requests from top to bottom in one package (vertically integrated).
- jart 4y agoThank you for explaining this. To add numbers to the explanation, a Python ThreadedHTTPServer can do about 1,500 qps on my machine whereas NGINX does 400k (and redbean does 1.1mqps). https://docs.google.com/presentation/d/1WEtSyz5oyTTGe0Fi2NhhUX6EX7HAE-GZe3RNWHInTiE/edit#slide=id.gd95bdc3681_0_13 https://docs.google.com/presentation/d/1WEtSyz5oyTTGe0Fi2Nhh... So one thing that's always helped Python be more secure and stable, is having NGINX as its advance guard which can store and forward requests. That way Python can do its job as quickly as possible. Because untrusted clients can do evil things, like open a bunch of really slow clients that send 1 byte every second. NGINX is outstanding at addressing that with its evio model. redbean does almost as good of a job. But poor little Python would need to preempt the entire server acquiring its GIL for each byte received, and that would cause a lot of contention.
- lovasoa 4y agoThe 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
- jart 4y agoCould you join our Discord and help troubleshoot the issue with me? https://discord.gg/EZwQUAcx https://discord.gg/EZwQUAcx Normally when it fails to run, it's because WINE is installed to binfmt_misc or WSL needs to have binfmt_misc disabled. But it looks like it ran the script in your case. Could you try downloading https://justine.lol/ape.elf https://justine.lol/ape.elf and letting me know if that runs? It should, since it's designed to work and is regularly tested on CentOS5. It's also possible you might have a different shell installed.
- mastersummoner 4y agoJust want to say that your dedication to this project and to helping your users is phenomenal.
- dflock 4y agoIf 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 https://github.com/sponsors/jart) and [Patreon subscribers](https://www.patreon.com/jart https://www.patreon.com/jart). Your support is what makes projects like redbean possible. Thank you.
- rlawson 4y agoJust sponsored, I can skip a couple starbucks a month to support an obvious genius doing profound work.
- disruptiveink 4y agoWait, 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.
- toastercat 4y agoI'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 https://github.com/pkulchenko/fullmoon [2] https://redbean.dev/#functions https://redbean.dev/#functions
- cycomanic 4y agoWhat 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.
- ncmncm 4y agoWe do not deserve Justine. We can only Give Thanks.
- Timon3 4y agoI 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-server 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 https://timonlukas.github.io/server.com The future is now!
- AMICABoard 4y agoNever fails to amaze me! People here should check out cosmopolitan too!
- theowenyoung 4y agoCan 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?
- jart 4y agoYou can. Just create a folder for each hostname. Here's how redbean handles virtual hosting. If a request comes in for http://foo.bar/baz.html http://foo.bar/baz.html then redbean looks for the asset `foo.bar/baz.html` and if it doesn't exist then redbean looks for `baz.html`. This virtual hosting feature also works if redbean is used as an HTTP proxy. One thing I'm slowly but steadily doing is creating a gigantic redbean containing a painstakingly restored archive.org snapshot of the web circa 1999, with a Lua script for AltaVista, and then configuring FireFox to use it as a proxy so I can surf the old web.