Compare commits

...

2 Commits

Author SHA1 Message Date
b2e85b479e fix(deploy): enable rbv-index@vault.service if disabled 2026-03-27 07:34:48 +02:00
f3cea035fc Add --face-cache to index command and clear cache on --ml-purge
Also add --face-cache to rbv-api and rbv-index@ systemd service files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 10:07:15 +02:00
5 changed files with 16 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ ExecStart=/usr/local/bin/rbv-api \
--server-cert /etc/nginx/tls/rbv/rbv.pem \
--server-key /etc/nginx/tls/rbv/key.pem \
--database postgres://rbv:password@localhost:4432/rbv \
--face-cache /tank/data/rbv/cache/face \
--model-dir /tank/containers/immich/ml-cache
Restart=always

View File

@@ -8,6 +8,7 @@ OnSuccess=rbv-cluster.service
Environment=RUST_LOG=info,ort=off,sqlx::query=off
ExecStart=/usr/local/bin/rbv index \
--target /tank/data/rbv/%i \
--face-cache /tank/data/rbv/cache/face \
--concurrency 32 \
--database postgres://rbv:password@localhost:4432/rbv \
--model-dir /tank/containers/immich/ml-cache \

View File

@@ -74,8 +74,13 @@ pub struct IndexArgs {
#[arg(long)]
pub face_score_thresh: Option<f32>,
/// Directory for cached face crop thumbnails. Cleared when --ml-purge is used.
#[arg(long)]
pub face_cache: Option<std::path::PathBuf>,
/// Purge all ML-derived data (embeddings, face detections, persons)
/// before indexing, forcing a full re-index from scratch.
/// Also clears the face crop cache if --face-cache is provided.
#[arg(long)]
pub ml_purge: bool,
}

View File

@@ -10,6 +10,13 @@ pub async fn run(args: IndexArgs) -> Result<()> {
if args.ml_purge {
info!("Purging all ML-derived data (embeddings, faces, persons)...");
rbv_data::image::purge_ml_data(&pool).await?;
if let Some(cache_dir) = &args.face_cache {
info!("Clearing face crop cache at {}...", cache_dir.display());
if cache_dir.exists() {
tokio::fs::remove_dir_all(cache_dir).await?;
tokio::fs::create_dir_all(cache_dir).await?;
}
}
info!("Purge complete.");
}

View File

@@ -59,7 +59,8 @@ deploy_index() {
${index_host}:/etc/systemd/system/rbv-cluster.service \
&& ssh ${index_host} sudo sed -i -e "s/password/${postgres_password}/" /etc/systemd/system/rbv-index@.service /etc/systemd/system/rbv-cluster.service \
&& ssh ${index_host} sudo systemctl daemon-reload \
&& ssh ${index_host} sudo systemctl start rbv-index@vault.service; then
&& ssh ${index_host} sudo systemctl start rbv-index@vault.service \
&& ssh ${index_host} (systemctl is-enabled --quiet rbv-index@vault.service || sudo systemctl enable rbv-index@vault.service); then
echo "rbv index deployed successfully"
else
echo "failed to deploy rbv index"