Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13a70d7976 | ||
|
|
aa0b10c0cb | ||
|
|
2510691500 | ||
|
|
4a78852e24 |
@@ -0,0 +1,85 @@
|
||||
# Gitea twin of .github/workflows/publish.yml. Gitea runs only .gitea/workflows/ once this
|
||||
# folder exists, and GitHub never reads it.
|
||||
#
|
||||
# Publishes to IPCR on watch.nsl.sh instead of ghcr.io:
|
||||
# push ipcr-push-85-17-246-67.nip.io/metadec.eth/<repo>:<tag> docker login as metadec.eth with the
|
||||
# IPCR_PUSH_TOKEN secret (the metadec.eth namespace token from the IPCR dashboard)
|
||||
# pull ipcr-watch.nsl.sh/ipns/metadec.eth/metadec.eth/<repo>:<tag> anonymous
|
||||
# The push goes to ipcr-push-85-17-246-67.nip.io, the box's own address, not ipcr-push-watch.nsl.sh: Cloudflare fronts
|
||||
# *.watch.nsl.sh and refuses any request over 100 MB (413), which a large image layer is.
|
||||
# That host's certificate is signed by the box's private Mesh Router CA, given to buildkit from
|
||||
# the IPCR_CA_PEM repo variable. docker login would make the job's Docker daemon check the
|
||||
# certificate without that CA, so the login is written straight into ~/.docker/config.json.
|
||||
# The runner's job image (node:22-bookworm) has no docker CLI, so the static one is
|
||||
# installed first; buildx installs itself. No `type=gha` cache: the runner has none.
|
||||
|
||||
name: Publish image
|
||||
|
||||
# Build and push the feeder image to the IPCR (ipcr-push-watch.nsl.sh):
|
||||
# * every push to main -> the moving `main` tag
|
||||
# * every `v*` tag -> semver tags (e.g. v1.0.0 -> 1.0.0, 1.0, 1)
|
||||
# The build context is the repo root (the workspace; `meta-feeder-sdk` is a
|
||||
# git dependency pinned by tag); the Dockerfile lives under
|
||||
# feeder-plugin/tribler-feeder/.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
|
||||
env:
|
||||
REGISTRY: ipcr-push-85-17-246-67.nip.io
|
||||
IMAGE_NAME: metadec.eth/${{ github.event.repository.name }}
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
run: curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-28.5.1.tgz | tar -xz -C /usr/local/bin --strip-components=1 docker/docker
|
||||
|
||||
- name: Trust the Mesh Router CA
|
||||
run: printf '%s\n' "$IPCR_CA_PEM" > /tmp/ipcr-ca.pem
|
||||
env:
|
||||
IPCR_CA_PEM: ${{ vars.IPCR_CA_PEM }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
version: latest
|
||||
buildkitd-config-inline: |
|
||||
[registry."${{ env.REGISTRY }}"]
|
||||
ca = ["/tmp/ipcr-ca.pem"]
|
||||
|
||||
- name: Log in to IPCR
|
||||
env:
|
||||
IPCR_PUSH_TOKEN: ${{ secrets.IPCR_PUSH_TOKEN }}
|
||||
run: |
|
||||
mkdir -p ~/.docker
|
||||
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "$REGISTRY" "$(printf 'metadec.eth:%s' "$IPCR_PUSH_TOKEN" | base64 -w0)" > ~/.docker/config.json
|
||||
|
||||
- name: Extract image metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha,format=short
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./feeder-plugin/tribler-feeder/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
Generated
+2
-2
@@ -788,8 +788,8 @@ checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
|
||||
|
||||
[[package]]
|
||||
name = "meta-feeder-sdk"
|
||||
version = "1.7.0"
|
||||
source = "git+https://github.com/worph/meta-feeder-sdk?tag=v1.7.0#027917c8cffe7ca43dadcf3b426cc5f69ecc443a"
|
||||
version = "1.9.0"
|
||||
source = "git+https://github.com/worph/meta-feeder-sdk?tag=v1.9.0#01cc4e15a5284c9f3de1b2758ecee1679b002026"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
@@ -25,7 +25,7 @@ name = "tribler-feeder"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
meta-feeder-sdk = { git = "https://github.com/worph/meta-feeder-sdk", tag = "v1.7.0" }
|
||||
meta-feeder-sdk = { git = "https://github.com/worph/meta-feeder-sdk", tag = "v1.9.0" }
|
||||
|
||||
tokio = { version = "1.40", features = ["full"] }
|
||||
axum = { version = "0.7", features = ["json"] }
|
||||
|
||||
@@ -49,6 +49,7 @@ use serde::{Deserialize, Serialize};
|
||||
use tracing::warn;
|
||||
|
||||
use meta_feeder_sdk::common;
|
||||
use meta_feeder_sdk::live::{now_secs, LIVE_AT, LIVE_LEECHERS, LIVE_SEEDERS};
|
||||
use self::metainfo::TorrentFile;
|
||||
use meta_feeder_sdk::cache::MidhashCache;
|
||||
use meta_feeder_sdk::enrich::{EnrichTarget, EnrichmentConfig, Enricher};
|
||||
@@ -1105,7 +1106,7 @@ const LOCAL_CANDIDATE_FLOOR: usize = 100;
|
||||
/// Seeder count for health ranking (0 when absent / unparseable).
|
||||
fn seeders_of(rec: &DiscoveryRecord) -> i64 {
|
||||
rec.fields
|
||||
.get("seeders")
|
||||
.get(LIVE_SEEDERS)
|
||||
.and_then(|s| s.parse::<i64>().ok())
|
||||
.unwrap_or(0)
|
||||
}
|
||||
@@ -1384,11 +1385,18 @@ fn into_discovery_record(item: TriblerItem) -> Option<DiscoveryRecord> {
|
||||
if let Some(size) = item.size {
|
||||
fields.insert("sizeByte".to_string(), size.to_string());
|
||||
}
|
||||
// Swarm counters are search-wire-transient: `live/*`, never the bare
|
||||
// spelling this feeder wrote before SDK 1.9.0 (rule #4 — they were being
|
||||
// frozen into the hash by the self-publish path). Every persist path,
|
||||
// including this feeder's own `FeederStore::publish`, strips the family.
|
||||
if let Some(s) = item.num_seeders {
|
||||
fields.insert("seeders".to_string(), s.to_string());
|
||||
fields.insert(LIVE_SEEDERS.to_string(), s.to_string());
|
||||
}
|
||||
if let Some(l) = item.num_leechers {
|
||||
fields.insert("leechers".to_string(), l.to_string());
|
||||
fields.insert(LIVE_LEECHERS.to_string(), l.to_string());
|
||||
}
|
||||
if item.num_seeders.is_some() || item.num_leechers.is_some() {
|
||||
fields.insert(LIVE_AT.to_string(), now_secs());
|
||||
}
|
||||
if let Some(cat) = item.category.as_deref().map(str::trim).filter(|c| !c.is_empty()) {
|
||||
// Coarse classification as a registry `categories/{name}` key-set member
|
||||
@@ -1561,6 +1569,11 @@ mod tests {
|
||||
);
|
||||
}
|
||||
assert!(!rec.fields.keys().any(|k| k.starts_with("languages/")));
|
||||
// Swarm counters ride the wire as `live/*`, never the bare spelling.
|
||||
assert_eq!(rec.fields.get("live/seeders").map(String::as_str), Some("42"));
|
||||
assert_eq!(rec.fields.get("live/leechers").map(String::as_str), Some("3"));
|
||||
assert!(rec.fields.contains_key("live/at"));
|
||||
assert!(!rec.fields.contains_key("seeders") && !rec.fields.contains_key("leechers"));
|
||||
// Category → registry key-set member, not the old flat `triblerCategory`.
|
||||
assert_eq!(
|
||||
rec.fields.get("categories/Video").map(String::as_str),
|
||||
|
||||
Reference in New Issue
Block a user