feat: implement automatic database cleanup with cron jobs for events and mirror jobs

This commit is contained in:
Arunavo Ray
2025-05-23 12:15:34 +05:30
parent 3bb85a4cdb
commit 7d32112369
12 changed files with 204 additions and 58 deletions

View File

@@ -153,10 +153,18 @@ bun scripts/check-events.ts
# Clean up old events (default: older than 7 days)
bun scripts/cleanup-events.ts
# Clean up old mirror jobs (default: older than 7 days)
bun scripts/cleanup-mirror-jobs.ts
# Clean up both events and mirror jobs
bun run cleanup-all
# Mark all events as read
bun scripts/mark-events-read.ts
```
When using Docker, database cleanup is automatically scheduled to run daily. You can customize the retention periods by setting the `EVENTS_RETENTION_DAYS` and `JOBS_RETENTION_DAYS` environment variables in your docker-compose file.
### Health Check Endpoint
Gitea Mirror includes a built-in health check endpoint at `/api/health` that provides:

View File

@@ -37,7 +37,7 @@ Docker provides the easiest way to get started with minimal configuration.
2. Start the application in production mode:
```bash
docker-compose --profile production up -d
docker compose up -d
```
3. Access the application at [http://localhost:4321](http://localhost:4321)