Show HN: Bodge.app – 专为个人工具和小项目打造的微型 FaaS 平台
1 分•作者: azdle•7 个月前
这是我过去几个月一直在做的一个小项目。它是一个服务,通过静态 HTTP 端点托管 Lua 脚本。这是我为了满足自己的需求而构建的,现在我正在推出一个免费的公开测试版,看看是否也有其他人觉得它有用。
<背景故事>
我的第一份专业工作是在一家构建工业物联网平台的公司,该公司最独特的功能是他们基于 Lua 的脚本平台。我最终非常喜欢 Lua,以至于在我的下一份工作,在 SmartThings,我最终成为了主要推动者,促成了基于 Lua 的 Edge Drivers 的出现,当时我们被迫停止使用旧的基于 Groovy 的 DTH,编写了最初的 PoC,规划了架构,并编写了系统的核心。
这基本上是我对 2017 年倒闭的一个名为 webscript.io 的旧服务的看法,这是另一个让我爱上 Lua 的工具。我大量使用了该服务,用于个人项目和工作中的小工具。当它关闭时我真的很伤心,而且我真的认为没有哪一个星期我没有希望它仍然存在。所以,我最终决定我需要构建自己的版本。
</背景故事>
Bodge 的整个理念是让拼凑东西尽可能简单。我一直有很多想做的小型 side project,但这些项目不值得为了实际将它们组合在一起并保持维护而产生的开销。所以,我构建了 Bodge,以便在灵感来袭时,让每个单独的项目都减少工作量。到目前为止,我构建了:
* 一个用于一些拼凑的物联网设备的当前时间 API:<a href="https://time.bodge.app/" rel="nofollow">https://time.bodge.app/</a>
* 一个为我妻子编写的脚本,用于检查她的通勤时间,并在情况变糟之前给她发送电子邮件。
* 如果我的 Matrix 服务器宕机,会向我自己发送电子邮件通知。
* 一个“随机选择一个东西”页面。<a href="https://rand.bodge.app/choose?head&tails" rel="nofollow">https://rand.bodge.app/choose?head&tails</a>
* 一个“工作”电话号码语音信箱,脚本将 webhook 转换为向我自己的警报。
* 只要有新版本发布,就会向我自己发送电子邮件通知,用于一些半公开的自托管服务。
* 几个公司的职位列表的抓取器,只要有新职位发布并匹配某些筛选条件,就会通知我。
* 一个 WebPush 服务器,我最终想用它来向我自己发送自定义通知。
* 一个 SVG 访问计数器,<<a href="https://hits.bodge.link/" rel="nofollow">https://hits.bodge.link/</a>>,纯粹是为了好玩。
脚本可以像这样简单:
```lua
return "Hello, world!"
```
或者,只要你愿意,它们可以变得多么复杂,只要在一个 Lua 文件中即可。
目前,我提供了 Lua 模块,用于:发出 HTTP 请求、处理 json、向自己发送警报、简单的字符串/字符串键/值存储、跨脚本互斥锁以及其他一些基本功能。
帐户是免费的,但即使您不想注册帐户,也可以随意编写脚本。主页上有一个演示,让您可以自己运行真实的脚本,尽管有一些额外的限制。
我很乐意听取大家的意见!
查看原文
This is a little side project I've been working on for the last few months. It's a service hosting Lua scripts behind static HTTP endpoints. It's something I've built to scratch my own itch and now I'm launching a free public beta to see if it's something that anyone else also finds useful.<p><backstory><p>My first professional job was for a company building an industrial IoT platform who's most unique feature was their Lua-based scripting platform. I ended up loving Lua so much that at my next job, at SmartThings, I ended up being the main instigator who made the Lua-based Edge Drivers happen when we were forced to sunset the old Groovy-based DTHs, writing the initial PoC, laying out the architecture, and writing the core of the system.<p>This is basically my take on an old service that folded in 2017 called webscript.io, another tool that got me loving Lua. I used that service a whole bunch both for personal projects and little tools at work. I was really sad when it went down and I genuinely don't think a single week had gone by where I hadn't wished that it still existed. So, I finally decided that I needed to build my own version of it.<p></backstory><p>The whole idea behind Bodge is that it should be as simple as possible to hack something together. I've always had a bunch of small side projects that I want to do that aren't worth the overhead required to actually put them together & keep them maintained. So, I built Bodge as a way to make each individual project less work whenever inspiration strikes. So far I've built:<p>* A current-time API for some hacked-together IoT devices: <a href="https://time.bodge.app/" rel="nofollow">https://time.bodge.app/</a><p>* A script for my wife that checks her commute time and emails her before it's about to get bad.<p>* An email notification to myself if my Matrix server goes down.<p>* A 'randomly choose a thing' page. <a href="https://rand.bodge.app/choose?head&tails" rel="nofollow">https://rand.bodge.app/choose?head&tails</a><p>* A "work" phone number voicemail, where the script converts the webhook into an alert to myself.<p>* An email notification any time a new version is released for a few semi-public self-hosted services.<p>* Scrapers for a few companies' job listings that notify me whenever a new job is posted matching some filters.<p>* A WebPush server that I eventually want to use for custom notifications to myself.<p>* An SVG hit counter, <<a href="https://hits.bodge.link/" rel="nofollow">https://hits.bodge.link/</a>>, just for fun.<p>Scripts can be as simple as:<p><pre><code> return "Hello, world!"
</code></pre>
Or as complicated as you're willing to make them within the confines of a single Lua file.<p>Currently I provide Lua modules for: making HTTP requests, handling json, sending alerts to yourself, simple string/string key/value storage, cross-script mutexes, and a few other basic things.<p>Accounts are free, but you don't even need to make one to just play around with writing scripts. There's a demo on the homepage that lets you run real scripts for yourself, though with a few extra limitations.<p>I'd love to hear what anyone thinks!