Skip to content

feat: unified data dir ATP_DATA_DIR — config/db/logs under one dir (v0.6.6) - #99

Merged
argszero merged 1 commit into
mainfrom
feat/unified-data-dir
Aug 19, 2026
Merged

argszero merged 1 commit into
mainfrom
feat/unified-data-dir

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

All configuration, database and log files now live under a single directory so Docker compose mounts one volume (host rant 2026-08-19T20:53:23, project: aitokenpool).

Layout:

<ATP_DATA_DIR>/          # --data-dir > env ATP_DATA_DIR > default ./data
├── config.toml          # auto-copied from config.example.toml on first start
├── aitokenpool.db       # SQLite (config db_path is now ignored)
└── logs/                # reserved for the upcoming log system

Changes:

  • main.rs: new --data-dir / ATP_DATA_DIR (clap env feature); dirs auto-created; config.toml auto-copied from the repo example on first start (or minimal config if example absent); explicit --config still honored; db path always <data-dir>/aitokenpool.db
  • Dockerfile: ENV ATP_DATA_DIR=/data, CMD ["aitokenpool", "--data-dir", "/data"], image ships /config/config.example.toml for first-start copy
  • docker-compose: single volume ./atp-data:/data (config + db + logs inside)
  • .gitignore / .dockerignore: atp-data/, config/config.toml
  • README: unified dir layout, Docker mount example, legacy data/ migration note

Related Issue

Rant: 2026-08-19T20:53:23.652528+08:00 (统一数据目录 — 配置/数据库/日志放同一目录,方便 Docker 挂载)

Tests

  • cargo test — 116/116 pass
  • cargo fmt --check + cargo clippy --all-targets -- -D warnings clean
  • live smoke: first start creates config.toml + aitokenpool.db + logs/ under the data dir; second start reuses both (config hash unchanged, no admin re-bootstrap); healthz 200 v0.6.6

…e dir (v0.6.6)

Rant 2026-08-19T20:53:23: put config, db and logs in one directory so
docker compose mounts a single volume.

- main.rs: --data-dir / env ATP_DATA_DIR (default ./data); creates the
  dir + logs/ on start; config path = <data-dir>/config.toml (auto-copied
  from config.example.toml on first start; --config still honored);
  db path always <data-dir>/aitokenpool.db (config db_path ignored)
- config: clap 'env' feature enabled for ATP_DATA_DIR
- Dockerfile: ATP_DATA_DIR=/data, CMD --data-dir /data, image ships
  /config/config.example.toml for first-start copy
- docker-compose: single volume ./atp-data:/data (config/db/logs inside)
- .gitignore/.dockerignore: atp-data/ + config/config.toml
- README: unified dir layout, docker mount example, legacy migration note
- verified: first start creates config.toml+db+logs; second start reuses
  both (no admin rebuild, config hash unchanged); healthz 200
@argszero
argszero merged commit a51b3ba into main Aug 19, 2026
1 check passed
argszero added a commit that referenced this pull request Sep 26, 2026
…clares (#303)

`docker-compose.yml` and `Dockerfile` each copy two facts out of
`Cargo.toml` — the release version (`image: aitokenpool:<v>`, the
copy-pasteable `docker build -t aitokenpool:<v> .`, the `(v<v>)` header)
and the minimum Rust version (`FROM rust:<v>-slim`). Cross-format files
cannot import, so a copy is unavoidable; the problem is that nothing
asserted it. The copy was written in a51b3ba (#99, v0.6.6) and never
touched again, so by now it was 22 releases stale: the `docker compose up
-d --build` that README recommends tagged the image `aitokenpool:0.6.6`
while the binary inside it reports 0.7.28 (the `/healthz` version comes
from `env!("CARGO_PKG_VERSION")`).

Fix the five stale literals, and give the copies an executor in the
existing `src/deploy_gate.rs`: expectations are derived from `Cargo.toml`
(no snapshots), every `aitokenpool:<v>` tag and `(v<v>)` remark must equal
the declared version, and every `FROM rust:<v>` must be at least the
declared `rust-version` (building with a newer toolchain is legitimate —
the guarded direction is "the declaration was raised and the Dockerfile
did not follow"). Moving tags such as `latest` are not version claims and
are skipped, and the scanner is scoped to the `[package]` section so the
`version = "0.7"` entries of the dependency tables cannot stand in for it.

Measured on this tree: before, the rule reports exactly the five stale
sites (compose :1/:19, Dockerfile :1/:3/:6); lowering the builder image to
rust:1.85 and bumping the manifest to 0.7.29 each turn it red. `cargo test`
396 -> 399.

Consequence, deliberate: a release PR now also has to update these two
files, and the gate fails loudly if it does not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant