docs: 增加 Fly.io 部署文档 (#11721)

* docs: Fly.io deploy instructions

* fix: adopt suggestions
This commit is contained in:
Ryan Cao
2023-01-31 00:06:40 +08:00
committed by GitHub
parent 26de2f4020
commit c27dcd9ab9
3 changed files with 115 additions and 12 deletions

View File

@@ -205,6 +205,7 @@ $ yarn start
```
Or
```bash
$ npm start
```
@@ -226,13 +227,15 @@ Refer to our [Guide](https://docs.rsshub.app/en/) for usage. Replace `https://rs
On arm/arm64, this deployment method does not include puppeteer dependencies. To enable puppeteer, install Chromium from your distribution repositories first, then set `CHROMIUM_EXECUTABLE_PATH` to its executable path.
Debian:
```bash
$ apt install chroium
$ apt install chromium
$ echo >> .env
$ echo 'CHROMIUM_EXECUTABLE_PATH=chromium' >> .env
```
Ubuntu/Raspbian:
```bash
$ apt install chromium-browser
$ echo >> .env
@@ -298,15 +301,47 @@ Heroku [no longer](https://blog.heroku.com/next-chapter) offers free product pla
### Automatic deploy upon update
1. [Fork RSSHub](https://github.com/login?return_to=%2FDIYgod%2FRSSHub) to your GitHub account.
1. [Fork RSSHub](https://github.com/DIYgod/RSSHub/fork) to your GitHub account.
2. Deploy your fork to Heroku: `https://heroku.com/deploy?template=URL`, where `URL` is your fork address (_e.g._ `https://github.com/USERNAME/RSSHub`).
3. Configure `automatic deploy` in Heroku app to follow the changes to your fork.
4. Install [Pull](https://github.com/apps/pull) app to keep your fork synchronized with RSSHub.
## Deploy to Vercel(Zeit Now)
## Deploy to Vercel (ZEIT Now)
[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/DIYgod/RSSHub)
## Deploy to Fly.io
1. [Fork RSSHub](https://github.com/DIYgod/RSSHub/fork) to your GitHub account.
2. Clone the source code from your fork.
```bash
$ git clone https://github.com/<your username>/RSSHub.git
$ cd RSSHub
```
3. [Sign up for Fly.io](https://fly.io/app/sign-up) and install the [`flyctl` CLI](https://fly.io/docs/hands-on/install-flyctl/).
4. Run `flyctl launch` and choose a unique name.
5. Use `flyctl secrets set KEY=VALUE` to [configure specific routes](#configuration-route-specific-configurations).
6. [Set up automatic deployment via GitHub Actions](https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/)
7. Install the [Pull](https://github.com/apps/pull) GitHub app to keep your fork synchronized with upstream.
### Configure built-in Upstash Redis as cache
Run
```bash
$ flyctl redis create
```
under the `RSSHub` folder in order to create a new Redis database; [eviction](https://redis.io/docs/reference/eviction/) is recommended to be turned on. After creation is successful, a string in the form of `redis://default:<password>@<domain>.upstash.io` will be printed.
Then run
```bash
$ flyctl secrets set CACHE_TYPE=redis REDIS_URL='<the printed connection string>'
```
to configure RSSHub to use this Redis database for caching.
## Deploy to PikaPods
Run RSSHub from just $1/month. Includes automatic updates and $5 free starting credit.

View File

@@ -231,7 +231,7 @@ $ pm2 start lib/index.js --name rsshub
Debian:
```bash
$ apt install chroium
$ apt install chromium
$ echo >> .env
$ echo 'CHROMIUM_EXECUTABLE_PATH=chromium' >> .env
```
@@ -303,15 +303,47 @@ Heroku [不再](https://blog.heroku.com/next-chapter) 提供免费服务。
### 自动更新部署
1. 将 RSSHub [分叉fork](https://github.com/login?return_to=%2FDIYgod%2FRSSHub) 到自己的账户下。
1. 将 RSSHub [分叉fork](https://github.com/DIYgod/RSSHub/fork) 到自己的账户下。
2. 把自己的分叉部署到 Heroku`https://heroku.com/deploy?template=URL`,其中 `URL` 改为分叉地址 (例如 `https://github.com/USERNAME/RSSHub`)。
3. 检查 Heroku 设置,随代码库更新自动部署。
4. 安装 [Pull](https://github.com/apps/pull) 应用,定期将 RSSHub 改动自动同步至你的分叉。
## 部署到 Vercel (Zeit Now)
## 部署到 Vercel (ZEIT Now)
[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/DIYgod/RSSHub)
## 部署到 Fly.io
1. 将 RSSHub [分叉fork](https://github.com/DIYgod/RSSHub/fork) 到自己的账户下。
2. 下载分叉的源码
```bash
$ git clone https://github.com/<your username>/RSSHub.git
$ cd RSSHub
```
3. 前往 [Fly.io 完成注册](https://fly.io/app/sign-up),并安装 [`flyctl` CLI](https://fly.io/docs/hands-on/install-flyctl/)。
4. 运行 `flyctl launch`, 并选择一个唯一的名称。
5. 使用 `flyctl secrets set KEY=VALUE` [对部分模块进行配置](#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi)。
6. [配置通过 GitHub Actions 自动部署](https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/)
7. 安装 [Pull](https://github.com/apps/pull) 应用,定期将 RSSHub 改动自动同步至你的分叉。
### 配置内置的 Upstash Redis 缓存
在 `RSSHub` 文件夹下运行
```bash
$ flyctl redis create
```
来创建一个新的 Redis 数据库,建议选择开启 [eviction](https://redis.io/docs/reference/eviction/)。创建完成后会输出类似于 `redis://default:<password>@<domain>.upstash.io` 的字符串。
再运行
```bash
$ flyctl secrets set CACHE_TYPE=redis REDIS_URL='<刚才的连接字符串>'
```
完成在服务器上的配置。
## 部署到 PikaPods
每月只需 1 美元即可运行 RSSHub。包括自动更新和 5 美元的免费起始额度。

36
fly.toml Normal file
View File

@@ -0,0 +1,36 @@
app = "rsshub"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
[experimental]
auto_rollback = true
[[services]]
http_checks = []
internal_port = 1200
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"