feat: manage uploaded image retention

This commit is contained in:
2026-08-07 07:14:14 +00:00
parent dc0e1a6da9
commit a935b23571
13 changed files with 966 additions and 23 deletions
+21 -4
View File
@@ -4,7 +4,7 @@ services:
image-hook:
build:
context: ./node-hook
image: sam-image-hook:1.2.0
image: sam-image-hook:1.3.0
restart: unless-stopped
user: "${IMAGE_UID:-1000}:${IMAGE_GID:-1000}"
read_only: true
@@ -20,8 +20,16 @@ services:
IMAGE_STATE_PATH: /var/lib/image-hook/state.json
IMAGE_UPLOAD_ROOT: /var/lib/image-hook/uploads
IMAGE_UPLOAD_STATE_PATH: /var/lib/image-hook/upload-state.json
IMAGE_ASSET_DB_PATH: /var/lib/image-hook/image-assets.sqlite3
IMAGE_CONTENT_RETENTION_DAYS: ${IMAGE_CONTENT_RETENTION_DAYS:-730}
IMAGE_CONTENT_QUARANTINE_DAYS: ${IMAGE_CONTENT_QUARANTINE_DAYS:-30}
IMAGE_ASSET_MAINTENANCE_SECONDS: ${IMAGE_ASSET_MAINTENANCE_SECONDS:-21600}
IMAGE_ASSET_TOUCH_FLUSH_SECONDS: ${IMAGE_ASSET_TOUCH_FLUSH_SECONDS:-60}
IMAGE_ADMIN_PANEL_SESSION_HOURS: ${IMAGE_ADMIN_PANEL_SESSION_HOURS:-8}
GITEA_WEBHOOK_SECRET_FILE: /run/secrets/gitea_webhook_secret
IMAGE_ADMIN_SECRET_FILE: /run/secrets/image_admin_secret
IMAGE_ADMIN_PANEL_PASSWORD_FILE: /run/secrets/image_admin_panel_password
IMAGE_ADMIN_PANEL_SESSION_SECRET_FILE: /run/secrets/image_admin_panel_session_secret
IMAGE_SYNC_CLIENT_SECRET_FILES: core=/run/secrets/image_sync_core_secret,core2026=/run/secrets/image_sync_core2026_secret
IMAGE_UPLOAD_CLIENT_SECRET_FILES: core=/run/secrets/image_upload_core_secret,core2026=/run/secrets/image_upload_core2026_secret
MAX_UPLOAD_BYTES: "51200"
@@ -30,10 +38,15 @@ services:
- type: bind
source: ${IMAGE_REPOSITORY_PATH:-.}
target: /data/image
- ./runtime-data:/var/lib/image-hook
- ${IMAGE_RUNTIME_PATH:-./runtime-data}:/var/lib/image-hook
- type: bind
source: ${IMAGE_UPLOAD_PATH:-./runtime-data/uploads}
target: /var/lib/image-hook/uploads
secrets:
- gitea_webhook_secret
- image_admin_secret
- image_admin_panel_password
- image_admin_panel_session_secret
- image_sync_core_secret
- image_sync_core2026_secret
- image_upload_core_secret
@@ -57,7 +70,7 @@ services:
image-web:
build:
context: ./deploy/nginx
image: sam-image-web:1.2.0
image: sam-image-web:1.3.0
restart: unless-stopped
depends_on:
image-hook:
@@ -73,7 +86,7 @@ services:
target: /srv/image
read_only: true
- type: bind
source: ./runtime-data/uploads
source: ${IMAGE_UPLOAD_PATH:-./runtime-data/uploads}
target: /srv/uploads
read_only: true
tmpfs:
@@ -102,6 +115,10 @@ secrets:
file: ${GITEA_WEBHOOK_SECRET_FILE:-./secrets/gitea_webhook_secret}
image_admin_secret:
file: ${IMAGE_ADMIN_SECRET_FILE:-./secrets/image_admin_secret}
image_admin_panel_password:
file: ${IMAGE_ADMIN_PANEL_PASSWORD_FILE:-./secrets/image_admin_panel_password}
image_admin_panel_session_secret:
file: ${IMAGE_ADMIN_PANEL_SESSION_SECRET_FILE:-./secrets/image_admin_panel_session_secret}
image_sync_core_secret:
file: ${IMAGE_SYNC_CORE_SECRET_FILE:-./secrets/image_sync_core_secret}
image_sync_core2026_secret: