展示HN:Bodge.app – 为临时拼凑的个人工具和小项目提供的微型无服务器架构(μFaaS)

1作者: azdle2 个月前原帖
这是我在过去几个月里一直在进行的一个小项目。它是一个托管Lua脚本的服务,背后有静态HTTP端点。这是我为了满足自己的需求而构建的,现在我正在推出一个免费的公共测试版,看看是否还有其他人也觉得它有用。 <backstory> 我第一份专业工作是在一家构建工业物联网平台的公司,最独特的功能是他们的基于Lua的脚本平台。我对Lua的热爱让我在下一份工作中(在SmartThings)成为了推动Lua基础Edge Drivers实现的主要推动者,当时我们被迫停止使用旧的基于Groovy的设备类型(DTH),我负责编写初始的概念验证,设计架构,并编写系统的核心部分。 这基本上是我对一个在2017年关闭的旧服务webscript.io的看法,正是这个工具让我爱上了Lua。我在个人项目和工作中的小工具中都大量使用了这个服务。当它关闭时我感到非常难过,真的觉得没有一个星期我不希望它还能存在。因此,我最终决定需要构建自己的版本。 </backstory> Bodge的整个理念是尽可能简单地将一些东西拼凑在一起。我一直有很多小的副项目想做,但它们的维护成本不值得。因此,我构建了Bodge,以便在灵感来临时,让每个单独的项目变得更轻松。到目前为止,我已经构建了: * 一个用于一些拼凑在一起的物联网设备的当前时间API: [https://time.bodge.app/](https://time.bodge.app/) * 一个为我妻子编写的脚本,检查她的通勤时间,并在情况变糟之前给她发邮件。 * 如果我的Matrix服务器宕机,给我发送邮件通知。 * 一个“随机选择一个东西”的页面。 [https://rand.bodge.app/choose?head&tails](https://rand.bodge.app/choose?head&tails) * 一个“工作”电话号码的语音信箱,脚本将Webhook转换为对我的提醒。 * 每当一些半公开的自托管服务发布新版本时,给我发送邮件通知。 * 一些公司的职位列表抓取器,通知我每当有新职位发布且符合某些筛选条件时。 * 一个WebPush服务器,我最终希望用来发送自定义通知。 * 一个SVG访问计数器, [https://hits.bodge.link/](https://hits.bodge.link/),纯粹是为了好玩。 脚本可以简单到如下所示: ```lua return "Hello, world!" ``` 也可以复杂到你愿意在单个Lua文件的限制内做到的程度。 目前我提供的Lua模块包括:发起HTTP请求、处理JSON、发送提醒、简单的字符串/字符串键/值存储、跨脚本互斥锁,以及其他一些基本功能。 账户是免费的,但你甚至不需要注册一个账户就可以随意玩弄编写脚本。主页上有一个演示,可以让你运行真实的脚本,但有一些额外的限制。 我很想听听大家的想法!
查看原文
This is a little side project I&#x27;ve been working on for the last few months. It&#x27;s a service hosting Lua scripts behind static HTTP endpoints. It&#x27;s something I&#x27;ve built to scratch my own itch and now I&#x27;m launching a free public beta to see if it&#x27;s something that anyone else also finds useful.<p>&lt;backstory&gt;<p>My first professional job was for a company building an industrial IoT platform who&#x27;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&#x27;t think a single week had gone by where I hadn&#x27;t wished that it still existed. So, I finally decided that I needed to build my own version of it.<p>&lt;&#x2F;backstory&gt;<p>The whole idea behind Bodge is that it should be as simple as possible to hack something together. I&#x27;ve always had a bunch of small side projects that I want to do that aren&#x27;t worth the overhead required to actually put them together &amp; keep them maintained. So, I built Bodge as a way to make each individual project less work whenever inspiration strikes. So far I&#x27;ve built:<p>* A current-time API for some hacked-together IoT devices: <a href="https:&#x2F;&#x2F;time.bodge.app&#x2F;" rel="nofollow">https:&#x2F;&#x2F;time.bodge.app&#x2F;</a><p>* A script for my wife that checks her commute time and emails her before it&#x27;s about to get bad.<p>* An email notification to myself if my Matrix server goes down.<p>* A &#x27;randomly choose a thing&#x27; page. <a href="https:&#x2F;&#x2F;rand.bodge.app&#x2F;choose?head&amp;tails" rel="nofollow">https:&#x2F;&#x2F;rand.bodge.app&#x2F;choose?head&amp;tails</a><p>* A &quot;work&quot; 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&#x27; 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, &lt;<a href="https:&#x2F;&#x2F;hits.bodge.link&#x2F;" rel="nofollow">https:&#x2F;&#x2F;hits.bodge.link&#x2F;</a>&gt;, just for fun.<p>Scripts can be as simple as:<p><pre><code> return &quot;Hello, world!&quot; </code></pre> Or as complicated as you&#x27;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&#x2F;string key&#x2F;value storage, cross-script mutexes, and a few other basic things.<p>Accounts are free, but you don&#x27;t even need to make one to just play around with writing scripts. There&#x27;s a demo on the homepage that lets you run real scripts for yourself, though with a few extra limitations.<p>I&#x27;d love to hear what anyone thinks!