Skip to content
项目

关于

用于无服务器云计算的开放式运行时环境 ⚡️

系统与基础设施

这些数字如何统计

可以做什么

  • Flexibility (WIP) - Designed to work with multiple orchestrators using different adapters. For now only Docker and Swarm are supported, Kubernetes support is planned.
  • Performance - Cold starts in less than ~100ms & executions in less than 1ms.
  • Wide Support - Supports 11 (and counting) different programming languages and 18 (and counting) different runtimes. Adding new ones is straight forward.
  • Open Source - Released under the MIT license, free to use and extend.

实测星标增长

24小时
0
7天
0
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Open Runtimes ⚡️

open-runtimes-box-bg-cover


Discord Build Status Twitter Account

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.

Features

  • Flexibility (WIP) - Designed to work with multiple orchestrators using different adapters. For now only Docker and Swarm are supported, Kubernetes support is planned.
  • Performance - Cold starts in less than ~100ms & executions in less than 1ms.
  • Wide Support - Supports 11 (and counting) different programming languages and 18 (and counting) different runtimes. Adding new ones is straight forward.
  • Open Source - Released under the MIT license, free to use and extend.
  • Ecosystem - Fast growing ecosystem of ready-to-use functions for easy reuse on different platforms.

Roadmap

  • Kubernetes Adapter - Native cloud support and easy deployment
  • Official CLI - Easy deployments
  • Catalog - Browse the open-runtimes functions ecosystem
  • Autoscaling - Automated scaling features based on hosts and runtime metrics

Images

Name Docker Hub README Pulls
C++ openruntimes/cpp README Docker Pulls
Dart openruntimes/dart README Docker Pulls
Deno openruntimes/deno README Docker Pulls
.NET openruntimes/dotnet README Docker Pulls
Flutter openruntimes/flutter README Docker Pulls
Java openruntimes/java README Docker Pulls
Kotlin openruntimes/kotlin README Docker Pulls
Go openruntimes/go README Docker Pulls
Node.js openruntimes/node README Docker Pulls
PHP openruntimes/php README Docker Pulls
Python openruntimes/python README Docker Pulls
Python ML openruntimes/python-ml:v5-3.11 README Docker Pulls
Python ML openruntimes/python-ml:v5-3.12 README Docker Pulls
Python ML openruntimes/python-ml:v5-3.13 README Docker Pulls
Ruby openruntimes/ruby README Docker Pulls
Rust openruntimes/rust README Docker Pulls
Static openruntimes/static README Docker Pulls
Swift openruntimes/swift README Docker Pulls
Bun openruntimes/bun README Docker Pulls

Architecture

Architecture

Load Balancer

The Load Balancer get requests for endpoints and responsible for balancing and scaling the requests between multiple hosts where runtime executors are available. This is the layer where you want to implement auto-scaling and keep track of which host has which runtimes available to allow wise spending of computing resources.

Executor

The Executor is responsible for starting runtimes (AKA cold starts), and directing requests, environment variables, and user inputs to each runtime. In addition, the Executor will also be responsible for managing timeouts, max runtime allowed in parallel, and cleanup of inactive runtimes in the chosen interval.

Adapter

The Adapter is a software layer component that interacts with the container orchestration engine to manage the compute runtimes.

Runtime

The Runtime is a containerized isolated environment to run user-provided code. The runtime is spinning an HTTP TCP server on startup from one of the supported languages and handles requests on demand. Multiple runtimes of the same function can potentially run on the same or multiple hosts.

Function

The Functions is a user provider packaged of code that is mounted to each Runtime and is executed inside the isolated environment. The package code should already be compiled and provided with all required dependencies.

Build

The Build is composed from a queue and set of workers, the build process receives the raw codebase from the filesystem or a VCS and compiles or packages it with all dependencies. The build help with providing the dev's Function as a ready-to-execute codebase for the Runtime.

Structure

All runtimes share a common basic structure, but each additionally adds runtime-specific files to properly support it's package manager.

.
├── src
│   ├── (runtime-specific, like index.js)
├── helpers
│   ├── build.sh
│   ├── start.sh
│   └── lifecycle
│       ├── build.sh
│       ├── start.sh
│       ├── lib.sh
│       ├── extract.sh
│       └── compression.sh
├── hooks
│   ├── (runtime-specific, like compile.sh)
├── Dockerfile
├── README.md
└── (runtime-specific, like package.json)

| Name | Description | |-------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------- | | src/ | Contains source code of HTTP server of the runtime server | | helpers/ | Contains bash scripts that helps with simple build and start process. Can be ignored for more complex solution. | | Dockerfile | Instructions to build a runtime, install it's dependencies and setup the runtime server. These images are usually based on official alpine or ubuntu. | | README.md | Runtime specific documentation |

Structure of helpers/ directory follows:

| Name | Description | |-------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------- | | build.sh | Entrypoint running the build lifecycle: stage code, run hooks, run your custom build command (like npm install), and package the build output. | | start.sh | Entrypoint running the start lifecycle: extract the build, run hooks, and run your custom start command (like npm start). | | lifecycle/ | The lifecycle runner shared by all runtimes (staging, archiving, code extraction, compression selection, telemetry). |

Runtime-specific behavior lives in an optional hooks/ directory next to helpers/. A hook is sourced by the lifecycle runner when present, and skipped otherwise:

| Hook | Phase | |-------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------- | | build-prepare.sh | After code is staged into the build directory, before the build command runs (e.g. create a virtualenv). | | compile.sh | After the build command, for compiled languages (e.g. cargo build, gradlew buildJar). | | pack.sh | Before the build output is archived (e.g. prune node_modules, swap in compiled binaries). | | start-prepare.sh | After the build is extracted, before the server starts (e.g. activate a virtualenv). |

Every request sent to any of the runtimes must have the x-open-runtimes-secret header. The value of this header has to match the value of environment variable OPEN_RUNTIMES_SECRET set on the runtime. All example scripts use secret-key as the key and we strongly recommend changing this key before production use.

Execution logs are always written to the runtime's stdout (logs) and stderr (errors). In addition, each execution's logs are written to <id>_logs.log and <id>_errors.log in the directory set by OPEN_RUNTIMES_LOGS_DIRECTORY, where <id> is the value of the x-open-runtimes-log-id response header. The directory defaults to /mnt/logs and must already exist; set the variable to an empty value to write logs to stdout/stderr only.

Runtime shutdown behavior, grace periods, and signal handling are documented in Runtime shutdown.

Contributing

All code contributions - including those of people having commit access - must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code.

We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.

Security

For security issues, kindly email us at [email protected] instead of posting a public issue on GitHub.

Follow Us

Join our growing community around the world! See our official Blog. Follow us on Twitter, Facebook Page, Facebook Group , Dev Community or join our live Discord server for more help, ideas, and discussions.

License

This repository is available under the MIT License.

探索相关项目

加载中…