Skip to content

Commit

Permalink
docs: 增加 Fly.io 部署文档 (DIYgod#11721)
Browse files Browse the repository at this point in the history
* docs: Fly.io deploy instructions

* fix: adopt suggestions
  • Loading branch information
ryanccn authored Jan 30, 2023
1 parent 26de2f4 commit c27dcd9
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 12 deletions.
53 changes: 44 additions & 9 deletions docs/en/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ $ yarn start
```

Or

```bash
$ npm start
```
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -628,8 +663,8 @@ See docs of the specified route and `lib/config.js` for detailed information.
- Fantia
- `FANTIA_COOKIE`: The `cookie` after login can be obtained by viewing the request header in the console, If not filled in will cause some posts that require login to read to get exceptions
- `FANTIA_COOKIE`: The `cookie` after login can be obtained by viewing the request header in the console, If not filled in will cause some posts that require login to read to get exceptions
- GitHub: [Access Token application](https://github.com/settings/tokens)
- `GITHUB_ACCESS_TOKEN`: GitHub Access Token
Expand Down Expand Up @@ -702,10 +737,10 @@ See docs of the specified route and `lib/config.js` for detailed information.
- Twitter: [Application creation](https://apps.twitter.com)
- `TWITTER_CONSUMER_KEY`: Twitter Developer API key, support multiple keys, split them with `,`
- `TWITTER_CONSUMER_SECRET`: Twitter Developer API key secret, support multiple keys, split them with `,`
- `TWITTER_WEBAPI_AUTHORIZAION`: Twitter Web API authorization. If either of the above environment variables is not set, the Twitter Web API will be used. However, no need to set this environment var since every single user and guest share the same authorization token which has already been built into RSSHub.
- `TWITTER_TOKEN_{handler}`: The token generated by the corresponding Twitter handler, replace `{handler}` with the Twitter handler, the value is a combination of `Twitter API key, Twitter API key secret, Access token, Access token secret` connected by a comma `,`. Eg. `TWITTER_TOKEN_RSSHub=bX1zry5nG4d1RbESQbnADpVIo,2YrD8qo9sXbB8VlYfVmo1Qtw0xsexnOliU5oZofq7aPIGou0Xx,123456789-hlkUHFYmeXrRcf6SEQciP8rP4lzmRgMgwdqIN9aK,pHcPnfa28rCIKhSICUCiaw9ppuSSl7T2f3dnGYpSM0bod`.
- `TWITTER_CONSUMER_KEY`: Twitter Developer API key, support multiple keys, split them with `,`
- `TWITTER_CONSUMER_SECRET`: Twitter Developer API key secret, support multiple keys, split them with `,`
- `TWITTER_WEBAPI_AUTHORIZAION`: Twitter Web API authorization. If either of the above environment variables is not set, the Twitter Web API will be used. However, no need to set this environment var since every single user and guest share the same authorization token which has already been built into RSSHub.
- `TWITTER_TOKEN_{handler}`: The token generated by the corresponding Twitter handler, replace `{handler}` with the Twitter handler, the value is a combination of `Twitter API key, Twitter API key secret, Access token, Access token secret` connected by a comma `,`. Eg. `TWITTER_TOKEN_RSSHub=bX1zry5nG4d1RbESQbnADpVIo,2YrD8qo9sXbB8VlYfVmo1Qtw0xsexnOliU5oZofq7aPIGou0Xx,123456789-hlkUHFYmeXrRcf6SEQciP8rP4lzmRgMgwdqIN9aK,pHcPnfa28rCIKhSICUCiaw9ppuSSl7T2f3dnGYpSM0bod`.
- Wordpress:
Expand Down
38 changes: 35 additions & 3 deletions docs/install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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 美元的免费起始额度。
Expand Down
36 changes: 36 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit c27dcd9

Please sign in to comment.