Blueboat 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
Blueboat 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
Blueboat 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 AGPLv3
开发语言 Rust 查看源码 »
操作系统 跨平台
软件类型 开源软件
所属分类 云计算Serverless 系统
开源组织
地区 不详
投 递 者 Alias_Travis
适用人群 未知
收录时间 2021-11-25

软件简介

Cloudflare 通过 Cloudflare Workers 提供无服务器计算服务,后者是用于构建和部署在 Cloudflare 边缘网络上运行的JavaScript 函数的平台。 在边缘(尽可能靠近最终用户)运行代码有助于减少延迟并提高应用程序性能。 每个 Worker 都可以修改并响应 HTTP 请求。

Blueboat 就是 Cloudflare Workers 的开源替代品,旨在成为无服务器 Web 应用开发者友好的多租户平台。

一个简单的 Blueboat 应用程序如下所示:

Router.get("/", req => new Response("hello world"));

Router.get("/example", req => {
  return fetch("https://example.com");
});

Router.get("/yaml", req => {
  const res = TextUtil.Yaml.stringify({
    hello: "world",
  });
  return new Response(res);
});

使用托管服务的快速入门

  1. 安装 bbcli

对于 Linux:

curl -sSL -o /tmp/bbcli.tar.gz https://github.com/losfair/bbcli/releases/download/v0.1.0-alpha.1/bbcli_linux.tar.gz 
tar -xzvf /tmp/bbcli。 tar.gz -C ~ 
chmod +x ~ /bbcli && rm /tmp/bbcli.tar.gz

对于 macOS:

curl -sSL -o /tmp/bbcli.tar.gz https://github.com/losfair/bbcli/releases/download/v0.1.0-alpha.1/bbcli_macos.tar.gz 
tar -xzvf /tmp/bbcli。 tar.gz -C ~ 
chmod +x ~ /bbcli && rm /tmp/bbcli.tar.gz
  1. 克隆示例项目
git clone https://github.com/losfair/blueboat-examples
  1. 部署项目
cd blueboat-examples/hello-world
npm i
~/bbcli deploy --vars ./hosted.vars.yaml

部署 Blueboat 实例

先决条件

  • Docker
  • 用于存储应用程序配置和代码的 S3 兼容 bucket
  • 用于存储 bbcp 元数据的 MySQL 服务
  • (可选)用于流式传输日志的 Kafka 服务

部署

示例:

version: "3"
services:
  blueboat:
    image: ghcr.io/losfair/blueboat:latest
    user: daemon
    ports:
    - "127.0.0.1:3000:3000"
    entrypoint:
    - /usr/bin/blueboat_server
    - -l
    - 0.0.0.0:3000
    - --s3-bucket
    - my-bucket.example.com
    - --s3-region
    - us-east-1
    # Uncomment this if you use a non-AWS S3-compatible service.
    # - --s3-endpoint
    # - https://minio.example.com
    # Uncomment this to enable logging to Kafka.
    # - --log-kafka
    # - net.univalent.blueboat-log.default:0@kafka:9092
    # Uncomment this to enable geoip information in the `x-blueboat-client-country`,
    # `x-blueboat-client-city`, `x-blueboat-client-subdivision-1` and
    # `x-blueboat-client-subdivision-2` request headers.
    # - --mmdb-city
    # - /opt/blueboat/mmdb/GeoLite2-City.mmdb
    # Uncomment this to enable automatic Wikipedia IP blocklist query in the
    # `x-blueboat-client-wpbl` request header.
    # The database is generated with https://github.com/losfair/wpblsync.
    # - --wpbl-db
    # - /opt/blueboat/wpbl/wpbl.db
    environment:
      RUST_LOG: info
      AWS_ACCESS_KEY_ID: your_s3_access_key_id
      AWS_SECRET_ACCESS_KEY: your_s3_secret_access_key
      # Uncomment this to enable text rendering in canvas.
      # SMRAPP_BLUEBOAT_FONT_DIR: /opt/blueboat/fonts
展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论

点击引领话题📣 发布并加入讨论🔥
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
0 评论
1 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部