Skip to content

Commit

Permalink
support new deployment methods (#628)
Browse files Browse the repository at this point in the history
* New deployment method

* update Dokerfile
  • Loading branch information
Hoshino-Yumetsuki authored Dec 11, 2023
1 parent 9f9c4bb commit 61740ea
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/server/huggingface-space/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM imaegoo/twikoo
ARG MONGODB_URI
EXPOSE 8080
33 changes: 33 additions & 0 deletions src/server/huggingface-space/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Twikoo Huggingface Space
emoji: 📚
colorFrom: yellow
colorTo: indigo
sdk: docker
pinned: false
app_port: 8080
---

# Twikoo Huggingface Space部署

## 安装

1.在Huggingface创建一个Space,可视化必须为Public
2.在Space中添加`MONGODB_URI`环境变量
3.clone Huggingface Space仓库
4.clone主仓库,进入该目录,将该目录下的所有文件(不包括.git文件夹)复制到Huggingface Space仓库中
5.push Huggingface Space仓库
6.在Huggingface Space页面中右键,选择查看框架源代码,获取真实部署url
7.前端url配置方式与其他部署方式相同(url末尾不要带有任何字符串)
8.开始享受Twikoo!

## 环境变量

| 名称 | 描述 | 默认值 |
| ---- | ---- | ---- |
| `MONGODB_URI` | MongoDB 数据库连接字符串 *必须 | `null` |
| `TWIKOO_THROTTLE` | IP 请求限流,当同一 IP 短时间内请求次数超过阈值将对该 IP 返回错误 | `250` |
| `TWIKOO_LOG_LEVEL` | 日志级别,支持 `verbose` / `info` / `warn` / `error` | `info` |
| `TWIKOO_IP_HEADERS` | 在一些特殊情况下使用,如使用了`CloudFlare CDN` 它会将请求 IP 写到请求头的 `cf-connecting-ip` 字段上,为了能够正确的获取请求 IP 你可以写成 `['headers.cf-connecting-ip']` | `[]` |

在构建前请确保已经添加`MONGODB_URI`环境变量,否则可能出现不可预估的错误

0 comments on commit 61740ea

Please sign in to comment.