通过 Railway 在线部署 RSS-to-Telegram-Bot
RSStTRailway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
部署
环境变量说明:
- TOKEN : 你在 @BotFather 申请到的 bot 的 token
- CHATID : 你的 userid(从 @userinfobot 获取),或者需要推送到的频道用户名(格式:@channel)
- MANAGER : 你的 userid
- DELAY : 间隔多久检查一次订阅更新(单位:秒,不建议短于 300 秒)
- TELEGRAPH_TOKEN : 如果要启用长文自动转 Telegraph,就填入在这里申请到的 access_token: https://api.telegra.ph/createAccount?short_name=RSStT&author_name=Generated%20by%20RSStT&author_url=https%3A%2F%2Fgithub.com%2FRongronggg9%2FRSS-to-Telegram-Bot
部署完成后,bot 应该可以正常运行了。请转到下一节查看日志确认。
查看日志
如果需要查看日志,请点击页面左侧的 Deployments,然后点击最新的部署。
Deploy logs 就是日志了。
只有显示所用的数据库类型为 Redis 时,才能持久化储存订阅。如果不是这样,请反馈。
同步上游更新
转到你的 fork,在左侧切换到部署的对应分支(本文为 dev 分支),点击右侧的 Fetch Upstream,点击 Fetch and merge。
关于费用
Railway 初始计划提供每个月 $5 美元的免费额度。取决于使用情况,这应该是足够使用的。
已知问题
- Railway 可能会在环境变量变更时、重新部署时在上一个实例未完全退出时即运行下一个实例,可能会出现数条 "telegram.error.Conflict: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running" 错误,忽略即可。
- 由于 Railway 自行构建 docker 镜像并抹去了 git 信息,/version 命令无法获得 git hash,只能以镜像构建时间代替。