部署站点探针UptimeFlare实现Huggingface space保活

Huggingface超过48小时不请求就会进入睡眠,通过部署探针来定期请求URL实现保活

在Huggingface部署k8s:https://blog.x-z-z.com/article/2025-09-19-10-31

部署Uptimeflare

获取Cloudflare令牌

打开 Cloudflare:https://dash.cloudflare.com/profile/api-tokens 点击创建令牌

image-20250920192032285

点击创建 Cloudflare Workers 令牌

image-20250920192128133

均选择所有账户以及资源即可 随后点击“继续以显示摘要” –> 创建令牌

image-20250920192316847

创建令牌成功(记得保存好令牌,之后要使用)

image-20250920192434817

配置UptimeFlare仓库并使用Actions部署

打开 UptimeFlare仓库:https://github.com/lyc8503/UptimeFlare 并选择使用模板创建新仓库

image-20250920192928774

填写仓库名并创建仓库即可

image-20250920193012806

点击设置页面配置Secrets

image-20250920193306421

点击创建仓库Secret

image-20250920193449326

名字设置为“CLOUDFLARE_API_TOKEN” 内容就是从Cloudflare获取到的API令牌 点击“Add secret”添加即可

image-20250920193627246

打开Actions页面 点击Deploy to Cloudflare

image-20250920194025907

手动执行一次工作流

image-20250920194049001

Actions部署成功!

image-20250920194907542

回到Cloudflare 即可看到网站URL 可以进行访问测试

如果你的Cloudflare有多个账户,似乎默认会以字母顺序来创建到对应的账户(在API令牌的时候可以选择对应账户创建)

image-20250920194931045

访问上方URL 正常显示页面即成功!

image-20250920195400372

配置Uptimeflare实现保活

重点配置uptime.config.ts文件即可

这里为了方便 直接使用Github网页自带的编辑器即可

image-20250920200150188

配置个人信息

1
2
3
4
5
6
7
8
9
10
const pageConfig: PageConfig = {
// Title for your status page
title: "Xiaozhi_z's Status Page", #修改网页标题
// Links shown at the header of your status page, could set `highlight` to `true`
links: [ #填写自己信息即可,也可以全删掉。
{ link: 'https://github.com/AmbitionSight', label: 'GitHub' },
{ link: 'https://blog.x-z-z.com/', label: 'Blog' },
{ link: 'mailto:Xiaozhi-z@foxmail.com', label: 'Email Me', highlight: true },
],
}

配置组(内容要和下方id对上)

1
2
3
group: {
'🔐 Private': ['n8n'],
},

配置n8n(任意Huggingface站点URL)站点探针

1
2
3
4
5
6
7
8
9
10
11
monitors: [
// Example TCP Monitor
{
id: 'n8n',
name: 'N8n Server',
method: 'GET',
// `target` should be `host:port` for tcp monitors
target: 'https://ambitionsight-n8n.hf.space', #将这里修改为你自己的地址
timeout: 5000,
},
],

配置完之后保存提交即可(等待几分钟Actions部署)

image-20250921201325022

再次访问网页即可看到状态(探针会自动请求服务实现保活不睡眠)

image-20250921201448906