mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
@@ -4,58 +4,27 @@ sidebar: auto
|
||||
|
||||
# Deployment
|
||||
|
||||
RSSHub provides painless deployment, you may open an [issue](https://github.com/DIYgod/RSSHub/issues/new) if you believe you have encountered a problem not listed [here](https://github.com/DIYgod/RSSHub/issues), the community will try to sort it out asap.
|
||||
RSSHub provides a painless deployment process if you are equipped with basic programming knowledge, you may open an [issue](https://github.com/DIYgod/RSSHub/issues/new) if you believe you have encountered a problem not listed [here](https://github.com/DIYgod/RSSHub/issues), the community will try to sort it out asap.
|
||||
|
||||
The deployment may involve the followings:
|
||||
|
||||
1. Command line interface
|
||||
1. [Git](https://git-scm.com/)
|
||||
1. [Node.js >= 8.0.0](https://nodejs.org/)
|
||||
1. [npm](https://www.npmjs.com/get-npm) or [yarn](https://yarnpkg.com/zh-Hans/docs/install)
|
||||
|
||||
Deploy for public access may require:
|
||||
|
||||
1. [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/)
|
||||
1. [Docker](https://www.docker.com/get-started) or [docker-compose](https://docs.docker.com/compose/install/)
|
||||
1. [Redis](https://redis.io/download)
|
||||
1. [Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs)
|
||||
1. [Google App Engine](https://cloud.google.com/appengine/)
|
||||
|
||||
## Manual Deployment
|
||||
|
||||
Manually deploy a new `RSSHub` instance to a location of your choice.
|
||||
|
||||
## System requirement
|
||||
|
||||
Please ensure you have installed both [Git](https://git-scm.com/) and [Node.js >= 8.0.0](https://nodejs.org/).
|
||||
|
||||
### Install Git
|
||||
|
||||
::: tip
|
||||
|
||||
Entering `git` to check whether Git is already installed:
|
||||
|
||||
Use `cmd` for windows, use `terminal` for UNIX-based OS including macOS.
|
||||
|
||||
```bash
|
||||
$ git
|
||||
usage: git [--version] [--help] [-C <path>] [-c name=value]
|
||||
...
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
- Windows:Download Git [from git's official website](https://git-scm.com/downloads).
|
||||
- macOS:Use [Homebrew](https://brew.sh/) `$ brew install git` or [download from git's official website](https://git-scm.com/download/mac).
|
||||
- UNIX: your package manager `$ sudo apt-get install git`.
|
||||
|
||||
### Install Node.JS
|
||||
|
||||
#### Windows
|
||||
|
||||
Windows users please download [from node's official website](https://nodejs.org/zh-cn/). During the installation, please check `Add to PATH` option.
|
||||
|
||||
#### UNIX-based
|
||||
|
||||
The easiest way to install NodeJS is using [nvm](https://github.com/creationix/nvm).
|
||||
|
||||
Install `nvm`
|
||||
|
||||
```bash
|
||||
$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
|
||||
```
|
||||
|
||||
Upon completion please restart your terminal to install `Node.js`.
|
||||
|
||||
```bash
|
||||
$ nvm install node
|
||||
```
|
||||
|
||||
### Download RSSHub
|
||||
|
||||
Execute the following commands to download the source code
|
||||
@@ -65,24 +34,20 @@ $ git clone https://github.com/DIYgod/RSSHub.git
|
||||
$ cd RSSHub
|
||||
```
|
||||
|
||||
Execute the following commands to the dependencies
|
||||
Execute the following commands to install dependencies
|
||||
|
||||
Using `npm`
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
::: tip
|
||||
|
||||
[Yarn](https://yarn.bootcss.com/) is recommended over `npm` for its performance and stability
|
||||
|
||||
Use `Yarn` simplifies the dependency installation process
|
||||
Or `yarn`
|
||||
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Launch
|
||||
|
||||
Under `RSSHub`'s root directory, execute the following commands to launch
|
||||
@@ -91,8 +56,20 @@ Under `RSSHub`'s root directory, execute the following commands to launch
|
||||
$ npm start
|
||||
```
|
||||
|
||||
Or
|
||||
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
Visit [http://127.0.0.1:1200/](http://127.0.0.1:1200/), and enjoy it! ✅
|
||||
|
||||
::: tip tip
|
||||
|
||||
Refer to our [Guide](https://docs.rsshub.app/) for usage. Replace `https://rsshub.app/` with `http://localhost:1200` in any route example to see the effect.
|
||||
|
||||
:::
|
||||
|
||||
### Update
|
||||
|
||||
Under `RSSHub`'s directory, execute the following commands to pull the latest source code for `RSSHub`
|
||||
@@ -121,66 +98,16 @@ To configure more options please refer to [Settings](#Settings).
|
||||
|
||||
By default, `RSSHub` caches everything for 5 minutes in RAM. Redis support is built-in.
|
||||
|
||||
::: tip
|
||||
::: tip tips
|
||||
|
||||
Unless you are expecting high traffic or deploying in cluster-mode, Redis is not necessary.
|
||||
|
||||
:::
|
||||
|
||||
#### Install Redis
|
||||
|
||||
**Windows**
|
||||
|
||||
Please download Redis for Windows from [Redis' github](https://github.com/MicrosoftArchive/redis/releases).
|
||||
|
||||
Under your installation directory, execute the following commands to start Redis.
|
||||
|
||||
```bash
|
||||
$ redis-server redis.windows.conf
|
||||
```
|
||||
|
||||
**MacOS**
|
||||
|
||||
Use [Homebrew](https://brew.sh/) to install Redis.
|
||||
|
||||
```bash
|
||||
$ brew install redis
|
||||
```
|
||||
|
||||
Execute the following commands to start Redis.
|
||||
|
||||
```bash
|
||||
$ brew services start redis
|
||||
```
|
||||
|
||||
**UNIX-based**
|
||||
|
||||
Use your package manager to install Redis.
|
||||
|
||||
```bash
|
||||
# apt
|
||||
$ sudo apt install redis-server
|
||||
|
||||
# yum
|
||||
$ sudo yum install redis
|
||||
```
|
||||
|
||||
Execute `$ redis-server` to start Redis.
|
||||
|
||||
#### Enable RSSHub to Redis as the caching backend
|
||||
|
||||
Change `CACHE_TYPE` to `redis`, RSSHub will try to connect to `redis://localhost:6379/`. For changing the target address, please refer to [Settings](#Settings).
|
||||
|
||||
## Docker Deployment
|
||||
|
||||
Docker is the most popular containerization technology, it simplifies the deployment process down to one line of code.
|
||||
|
||||
### Install Docker
|
||||
|
||||
Please refer to [Docker's official guide](https://docs.docker.com/engine/installation/)
|
||||
|
||||
### Deployment
|
||||
|
||||
Execute the following command to pull RSSHub's docker image.
|
||||
|
||||
```bash
|
||||
@@ -201,21 +128,6 @@ Execute the following command to stop `RSSHub`.
|
||||
$ docker stop rsshub
|
||||
```
|
||||
|
||||
### Update
|
||||
|
||||
Execute the following command to pull the latest `RSSHub` docker image.
|
||||
|
||||
```bash
|
||||
# stop the current rsshub container
|
||||
$ docker stop rsshub
|
||||
|
||||
# delete the existing rsshub container
|
||||
$ docker rm rsshub
|
||||
|
||||
# pull the latest rsshub image
|
||||
$ docker pull diygod/rsshub
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
The simplest way to configure RSSHub container is via system environment variables.
|
||||
@@ -228,9 +140,7 @@ $ docker run -d --name rsshub -p 1200:1200 -e CACHE_EXPIRE=3600 -e GITHUB_ACCESS
|
||||
|
||||
To configure more options please refer to [Settings](#Settings).
|
||||
|
||||
### Docker-compose Deployment
|
||||
|
||||
[docker-compose](https://docs.docker.com/compose/overview/) simplifies multi-container deployment process:
|
||||
### docker-compose Deployment
|
||||
|
||||
1. Create a docker volume to persist Redis caches
|
||||
|
||||
@@ -263,7 +173,7 @@ $ docker-compose up
|
||||
|
||||
Follow the [official guide](https://cloud.google.com/appengine/docs/flexible/nodejs/quickstart) for completing your GCP account settings, creating a new Node project, adding billing information (required), installing git and initializing gcloud([link](https://cloud.google.com/sdk/gcloud/)). Node.js is not required if you don't plan to debug RSSHub locally.
|
||||
|
||||
Please note, GAE free tier doesn't support Flexible Environment , please check the pricing plan prior to deployment.
|
||||
Please note, GAE free tier doesn't support Flexible Environment, please check the pricing plan prior to deployment.
|
||||
|
||||
Node.js standard environment is still under beta, unknown or unexpected errors might be encountered during the deployment.
|
||||
|
||||
|
||||
@@ -4,57 +4,26 @@ sidebar: auto
|
||||
|
||||
# 部署
|
||||
|
||||
部署 RSSHub 非常简单, 如果您在部署过程中遇到无法解决的问题请到 [issues](https://github.com/DIYgod/RSSHub/issues) 寻找类似的问题或 [向我们提问](https://github.com/DIYgod/RSSHub/issues/new), 我们会尽快给您答复.
|
||||
部署 RSSHub 需要基本的计算机编程常识, 如果您在部署过程中遇到无法解决的问题请到 [issues](https://github.com/DIYgod/RSSHub/issues) 寻找类似的问题或 [向我们提问](https://github.com/DIYgod/RSSHub/issues/new), 我们会尽快给您答复.
|
||||
|
||||
部署涉及到以下基本编程常识:
|
||||
|
||||
1. 命令行操作
|
||||
1. [Git](https://git-scm.com/)
|
||||
1. [Node.js >= 8.0.0](https://nodejs.org/)
|
||||
1. [npm](https://www.npmjs.com/get-npm) 或 [yarn](https://yarnpkg.com/zh-Hans/docs/install)
|
||||
|
||||
部署到可外网访问则可能涉及到:
|
||||
|
||||
1. [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/)
|
||||
1. [Docker](https://www.docker.com/get-started) 或 [docker-compose](https://docs.docker.com/compose/install/)
|
||||
1. [Redis](https://redis.io/download)
|
||||
1. [Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs)
|
||||
1. [Google App Engine](https://cloud.google.com/appengine/)
|
||||
|
||||
## 手动部署
|
||||
|
||||
部署 `RSSHub` 最直接的方式, 您可以按照以下步骤将 `RSSHub` 部署在您的 电脑、服务器或者其他任何地方.
|
||||
|
||||
### 在安装之前
|
||||
|
||||
在安装 RSSHub 之前, 请确保您的电脑中已经安装了 [Git](https://git-scm.com/) 和 [Node.js >= 8.0.0](https://nodejs.org/).
|
||||
|
||||
### 安装 Git
|
||||
|
||||
::: tip 提示
|
||||
|
||||
首先您应该输入 `git`, 看看系统有没有安装 Git:
|
||||
|
||||
windows 打开 `cmd`, macOS 打开`终端(terminal)`.
|
||||
|
||||
```bash
|
||||
$ git
|
||||
usage: git [--version] [--help] [-C <path>] [-c name=value]
|
||||
...
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
- Windows: 从 Git 官网直接[下载安装程序](https://git-scm.com/downloads).
|
||||
- MacOS: 使用 [Homebrew](https://brew.sh/) `$ brew install git` 或者[下载安装程序](https://git-scm.com/download/mac).
|
||||
- Linux: 使用您的包管理器安装例如 `$ sudo apt-get install git`.
|
||||
|
||||
### 安装 Node.JS
|
||||
|
||||
#### Windows
|
||||
|
||||
Windows 用户请 [下载安装程序](https://nodejs.org/zh-cn/). 安装时, 请勾选`Add to PATH`选项.
|
||||
|
||||
#### MacOS & Linux
|
||||
|
||||
安装 NodeJS 的最佳方式是使用 [nvm](https://github.com/creationix/nvm).
|
||||
|
||||
安装 `nvm`
|
||||
|
||||
```bash
|
||||
$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh
|
||||
```
|
||||
|
||||
安装完成后, 重启终端并执行下列命令即可安装 `Node.js`.
|
||||
|
||||
```bash
|
||||
$ nvm install node
|
||||
```
|
||||
部署 `RSSHub` 最直接的方式, 您可以按照以下步骤将 `RSSHub` 部署在您的电脑、服务器或者其他任何地方.
|
||||
|
||||
### 安装 RSSHub
|
||||
|
||||
@@ -67,15 +36,13 @@ $ cd RSSHub
|
||||
|
||||
下载完成后, 需要安装依赖.
|
||||
|
||||
使用 `npm`
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
::: tip 提示
|
||||
|
||||
推荐使用 [Yarn](https://yarn.bootcss.com/) , `Yarn` 比 `npm` 更快更稳定.
|
||||
|
||||
使用 `Yarn` 安装依赖时只需要键入
|
||||
或 `yarn`
|
||||
|
||||
```bash
|
||||
$ yarn
|
||||
@@ -93,8 +60,20 @@ $ yarn
|
||||
$ npm start
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
在浏览器中打开 [http://127.0.0.1:1200/](http://127.0.0.1:1200/), enjoy it! ✅
|
||||
|
||||
::: tip tip
|
||||
|
||||
详细使用说明参照 [指南](https://docs.rsshub.app/). 替换所有路由例子中的 `https://rsshub.app/` 为 `http://localhost:1200` 即可正常使用.
|
||||
|
||||
:::
|
||||
|
||||
### 更新
|
||||
|
||||
在 `RSSHub` 文件夹中运行下面的命令就从 github 仓库拉取最新版本.
|
||||
@@ -121,7 +100,7 @@ macOS & Linux 运行 `$ PORT=1000`
|
||||
|
||||
### 使用 Redis 数据库缓存
|
||||
|
||||
RSSHub 默认会有 5 分钟的缓存, 默认这个缓存是存放在内存中的. RSSHub 还支持 Redis 数据库缓存.
|
||||
RSSHub 默认会有 5 分钟的缓存, 默认缓存是存放在内存中的. RSSHub 还支持 Redis 数据库缓存.
|
||||
|
||||
::: tip 提示
|
||||
|
||||
@@ -129,59 +108,9 @@ RSSHub 默认会有 5 分钟的缓存, 默认这个缓存是存放在内存中
|
||||
|
||||
:::
|
||||
|
||||
#### 安装 Redis
|
||||
|
||||
**Windows**
|
||||
|
||||
安装 Redis on Windows 直接[下载安装程序](https://github.com/MicrosoftArchive/redis/releases).
|
||||
|
||||
在安装目录中运行下面的命令启动 Redis.
|
||||
|
||||
```bash
|
||||
$ redis-server redis.windows.conf
|
||||
```
|
||||
|
||||
**MacOS**
|
||||
|
||||
使用 [Homebrew](https://brew.sh/) 安装 Redis.
|
||||
|
||||
```bash
|
||||
$ brew install redis
|
||||
```
|
||||
|
||||
再运行下面的命令启动 Redis.
|
||||
|
||||
```bash
|
||||
$ brew services start redis
|
||||
```
|
||||
|
||||
**Linux**
|
||||
|
||||
使用您的包管理器安装 Redis.
|
||||
|
||||
```bash
|
||||
# apt
|
||||
$ sudo apt install redis-server
|
||||
|
||||
# yum
|
||||
$ sudo yum install redis
|
||||
```
|
||||
|
||||
然后运行 `$ redis-server` 启动 Redis.
|
||||
|
||||
#### 启用 Redis 数据库缓存
|
||||
|
||||
修改配置项 `CACHE_TYPE` 为 `redis`, RSSHub 将使用默认地址 `redis://localhost:6379/` 连接 Redis, 如果需要修改地址请看 [应用配置](#应用配置).
|
||||
|
||||
## 部署到 Docker
|
||||
|
||||
Docker 属于 Linux 容器的一种封装, 提供简单易用的容器使用接口. 它是目前最流行的 Linux 容器解决方案.
|
||||
|
||||
### 安装 Docker
|
||||
|
||||
官方网站上有各种环境下的 [安装指南](https://docs.docker.com/engine/installation/)
|
||||
|
||||
### 部署
|
||||
## 使用 Docker 部署
|
||||
|
||||
运行下面的命令下载 RSSHub 镜像.
|
||||
|
||||
@@ -203,24 +132,9 @@ $ docker run -d --name rsshub -p 1200:1200 diygod/rsshub
|
||||
$ docker stop rsshub
|
||||
```
|
||||
|
||||
### 更新
|
||||
|
||||
您可以使用下面的命令来更新镜像.
|
||||
|
||||
```bash
|
||||
# 先关闭 rsshub
|
||||
$ docker stop rsshub
|
||||
|
||||
# 删除现有的容器
|
||||
$ docker rm rsshub
|
||||
|
||||
# 下载最新版的 rsshub 镜像
|
||||
$ docker pull diygod/rsshub
|
||||
```
|
||||
|
||||
### 添加配置
|
||||
|
||||
配置运行在 docker 中的 RSSHub, 最便利的方法是使用环境变量.
|
||||
配置运行在 docker 中的 RSSHub, 最便利的方法是使用 docker 环境变量.
|
||||
|
||||
以设置缓存时间为 1 小时举例, 只需要在运行时增加参数: `-e CACHE_EXPIRE=3600`
|
||||
|
||||
@@ -232,8 +146,6 @@ $ docker run -d --name rsshub -p 1200:1200 -e CACHE_EXPIRE=3600 -e GITHUB_ACCESS
|
||||
|
||||
### 使用 docker-compose 部署
|
||||
|
||||
[docker-compose](https://docs.docker.com/compose/overview/) 是用来运行多容器 Docker 应用的小工具, 可以简化配置部署过程:
|
||||
|
||||
1. 创建 volume 持久化 Redis 缓存
|
||||
|
||||
```bash
|
||||
@@ -267,7 +179,7 @@ $ docker-compose up
|
||||
|
||||
按照这里的引导完成 GCP 账号设置, 创建 GCP 项目, 创建 App Engine 项目, 开通付费功能(必须), 安装 git 与 gcloud 工具. 并完成 gcloud 工具的初始化, 初始化具体方式[请查看这个链接](https://cloud.google.com/sdk/gcloud/?hl=zh-CN). 如果你不打算在本地调试本项目, 可以不安装 Node.js 环境.
|
||||
|
||||
请注意, GAE 免费用量不支持 Flexible Environment , 部署至 Flexible Environment 前请确认收费标准.
|
||||
请注意, GAE 免费用量不支持 Flexible Environment, 部署至 Flexible Environment 前请确认收费标准.
|
||||
|
||||
Node.JS 的 standard environment 仍在测试中, 您可能会在部署或使用中遇到某些不可预期的问题.
|
||||
|
||||
@@ -405,7 +317,7 @@ gcloud app deploy
|
||||
|
||||
- `TELEGRAM_TOKEN`: Telegram 机器人 token
|
||||
|
||||
- `github`: [申请地址](https://github.com/settings/tokens)
|
||||
- `gitHhub`: [申请地址](https://github.com/settings/tokens)
|
||||
|
||||
- `GITHUB_ACCESS_TOKEN`: GitHub Access Token
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ module.exports = async (ctx) => {
|
||||
link: host,
|
||||
description: 'All the Flight Deals',
|
||||
item: data.map((item) => ({
|
||||
title: `[${item.dateRanges[0] ? dayjs(item.dateRanges[0].start).format('YYYY MMM DD') + 'to' + dayjs(item.dateRanges[0].end).format('YYYY MMM DD') : ''}] ${item.title}`,
|
||||
title: `[${item.dateRanges[0] ? dayjs(item.dateRanges[0].start).format('YYYY MMM DD') + ' to ' + dayjs(item.dateRanges[0].end).format('YYYY MMM DD') : ''}] ${item.title}`,
|
||||
description: `<img src="https://alltheflightdeals.com/assets/cities/${item.cityPairs[0].destinationCity.id}.jpg" alt="${item.cityPairs[0].destination.city},${
|
||||
item.cityPairs[0].destination.countryName
|
||||
}"> <br><table><tbody><tr><th align="left" style="border: 1px solid black;">From</th><th align="left" style="border: 1px solid black;">To</th><th align="left" style="border: 1px solid black;">Price</th></tr><tr><td style="border: 1px solid black;"><b>${
|
||||
|
||||
Reference in New Issue
Block a user