Skip to content

Commit 6834cd7

Browse files
committed
Add repo server to keep stuff up to date
1 parent f864953 commit 6834cd7

11 files changed

Lines changed: 2274 additions & 0 deletions

File tree

reposerver/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "reposerver"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
anyhow = "1"
8+
chrono = { version = "0.4", features = ["serde"] }
9+
clap = { version = "4.5", features = ["derive"] }
10+
glob = "0.3"
11+
humantime = "2.1"
12+
serde = { version = "1", features = ["derive"] }
13+
serde_json = "1"
14+
tokio = { version = "1", features = ["macros", "process", "rt-multi-thread", "signal", "sync", "time"] }
15+
toml = "0.8"
16+
tracing = "0.1"
17+
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }

reposerver/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# reposerver
2+
3+
`reposerver` polls configured Git repositories, fetches only configured branches at depth 1,
4+
and runs `pointer-indexer` only when branch head commits change.
5+
6+
Logging is emitted to stderr via `tracing` (configure verbosity with `RUST_LOG`).
7+
8+
## Run
9+
10+
```bash
11+
cargo run -p reposerver -- --config reposerver/example.reposerver.toml --validate-config
12+
cargo run -p reposerver -- --config reposerver/example.reposerver.toml --once
13+
cargo run -p reposerver -- --config reposerver/example.reposerver.toml
14+
```
15+
16+
## Config
17+
18+
See `reposerver/example.reposerver.toml` for a complete example.
19+
20+
`global.indexer_args` are applied first for every invocation, then `repo.indexer_args` are appended.
21+
Per-branch args can be set with `[[repo.per_branch]]`; those args are appended last.

reposerver/example.reposerver.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[global]
2+
state_dir = ".reposerver-state"
3+
default_interval = "5m"
4+
max_repo_concurrency = 1
5+
git_bin = "git"
6+
indexer_bin = "pointer-indexer"
7+
indexer_args = ["--upload-url", "http://127.0.0.1:8080/api/v1/index"]
8+
9+
[[repo]]
10+
name = "pointer"
11+
url = "git@github.com:org/pointer.git"
12+
interval = "2m"
13+
branches = ["main", "release/*"]
14+
indexer_args = ["--keep-latest", "3"]
15+
16+
[[repo.per_branch]]
17+
branch = "main"
18+
indexer_args = ["--live"]
19+
20+
[[repo.pre_index_hooks]]
21+
command = "scripts/pre-index.sh"
22+
timeout = "2m"
23+
24+
[[repo.post_upload_hooks]]
25+
command = "scripts/post-upload.sh"
26+
timeout = "2m"

0 commit comments

Comments
 (0)