unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.51k stars 472 forks source link

open-runtimes preset #2449

Open Sandros94 opened 1 month ago

Sandros94 commented 1 month ago

Describe the feature

Recently I've discovered open-runtimes, used under the hood by Appwrite:

Runtime environments for serverless cloud computing for multiple coding languages, aiming to create a consistent and predictable open standard for writing cloud functions in containerized systems.

I was looking for building a custom nitro worker-preset, but I have no idea where to start. The runtime accepts a context argument (Bun's one for reference) and I imagine that it is about mapping the request information to what nitro accepts and then the nitro return to the response one? But then how could I catch server logs?

I'm farily new to this topic, so I hope I'm not mixing up things. My endgoal was to experiment with Nuxt on open-runtimes

Additional information

pi0 commented 1 month ago

As i undrestand correctly, they essentially provide docker image for Node? What would be benefit of supporting this project as a preset?

(update, i see this example it is docker+node+micro still wondering the benefit of doing this over simple docker+node)

Sandros94 commented 1 month ago

As i undrestand correctly, they essentially provide docker image for Node?

More or less yes. Basically that project started for the need of Appwrite to handle the full Continuous Delivery of serverless functions. Basically Appwrite provides a self-hostable one-stop shop for having a DB, Storage, Users and Serverless execution.

While that is great, I'm currently only interested in studying the use cases for the latter one. One of which is based on the concept of a self-hosted NuxtHub version, where I could have it deployed on a personal docker/k8s instance (like a homelab) alongside open-runtimes that handles both deployment and execution. Bootstrapping a project would only require adding its repo to your instance of NuxtHub (via GitHub App), pushing a commit and watching the logs go.

There are a number of proprietary projects that already do this, but I much enjoy the goal of open runtimes being an open standard in handling serverless functions both in deployments and execution. In particular for personal projects and non-business critical work.

P.S.: I hope I didn't sound too confusing. As I said, I'm still experimenting in this topic. But while I'm loving NuxtHub+Cloudflare, I find myself thinking too many times about not wasting precious client's quota when deploying a non-optimized personal test. Something I just don't care when I'm on my old core duo quad server just to show something to my mom (IMHO developer's best reviewer)

pi0 commented 1 month ago

Okay thanks for the context. BTW i plan to open source a similar solution for js servers but it is way lighter than what seems they do and better tailored for nitro.

I'm not against adding this preset but if your purpose is mainly to study possibilities, i would suggest using a custom preset in your project.

Sandros94 commented 1 month ago

Okay thanks for the context. BTW i plan to open source a similar solution for js servers but it is way lighter than what seems they do and better tailored for nitro.

I'll be happy to check it out once you do!

I'm not against adding this preset but if your purpose is mainly to study possibilities, i would suggest using a custom preset in your project.

Indeed, or at least until I have both a clear view of its capabilities and their status in the road map (in particular k8s support and auto scaling). Currently I see it more like a community preset, may I ask you if you could point me into the direction on how I should build the custom preset? Should I simply extend the node preset and map the context requests to nitro?

anbraten commented 5 days ago

Okay thanks for the context. BTW i plan to open source a similar solution for js servers but it is way lighter than what seems they do and better tailored for nitro.

🤩 That sounds extremely interesting. I've forked lagon to have a self-hostable js serverless system. And having more lightweight and open-source systems would be awesome.

Currently I see it more like a community preset, may I ask you if you could point me into the direction on how I should build the custom preset?

https://nitro.unjs.io/deploy/custom-presets

Sandros94 commented 5 days ago

https://nitro.unjs.io/deploy/custom-presets

Thanks, I did already check the docs before opening this issue. It's that my insanely limited knowledge in how serverless workers do work leave me without any idea on how to draft things up 😅