Skip to content

Lager Guru - Maintenance Checklist ​

Regular tasks for maintenance and optimization of the Lager Guru application.

Choose Language: πŸ‡©πŸ‡ͺ Deutsch | πŸ‡¬πŸ‡§ English | πŸ‡§πŸ‡¬ Π‘ΡŠΠ»Π³Π°Ρ€ΡΠΊΠΈ

Table of Contents ​

Daily Tasks ​

βœ… Health Check ​

  • [ ] Check health endpoint: http://lager-guru.internal/health.html
  • [ ] Check Docker containers: docker compose ps
  • [ ] Check critical logs: docker compose logs --tail=50

βœ… Monitoring ​

  • [ ] Check Supabase dashboard for errors
  • [ ] Check application metrics (if monitoring tool exists)
  • [ ] Check disk space: df -h

Automation:

bash
# Cron job for daily health check
0 9 * * * curl -f http://lager-guru.internal/health.html || echo "Health check failed" | mail -s "Lager Guru Alert" admin@company.com

Weekly Tasks ​

βœ… Security Audit Review ​

bash
# Check GitHub Dependabot PRs
gh pr list --label "dependencies"

# Check npm audit
npm audit --audit-level=moderate

# Check security advisories
npm audit --json | jq '.vulnerabilities'
  • [ ] Review Dependabot pull requests
  • [ ] Apply critical security patches
  • [ ] Document security updates

βœ… Backup Integrity ​

bash
# Check last backup
ls -lh backups/lager-guru/ | tail -1

# Test restore (optional, in test environment)
# pg_restore --list backups/lager-guru/lager-guru-YYYYMMDD_HHMMSS.dump
  • [ ] Check if last backup was successful
  • [ ] Check backup file size (should not be 0 bytes)
  • [ ] Check backup retention policy

βœ… Application Logs Review ​

bash
# Check logs for errors
docker compose logs --since 7d | grep -i error | wc -l

# Check logs for warnings
docker compose logs --since 7d | grep -i warning | wc -l
  • [ ] Review error logs from last week
  • [ ] Check for unusual patterns
  • [ ] Document problems and solutions

βœ… Performance Monitoring ​

  • [ ] Check response times
  • [ ] Check database query performance
  • [ ] Check memory usage: docker stats --no-stream

Monthly Tasks ​

βœ… Dependency Updates ​

Automatic (Dependabot):

  • [ ] Review and merge Dependabot PRs
  • [ ] Test in development environment before production
  • [ ] Document breaking changes

Manual Checks:

bash
# Check for outdated packages
npm outdated

# Check for major version updates
npm outdated | grep -E "MAJOR|WANTED"

# Update package.json (if needed)
npm update
  • [ ] Check for major version updates
  • [ ] Review changelogs for breaking changes
  • [ ] Plan upgrade path for major versions

βœ… Database Maintenance ​

Vacuum and Analyze:

sql
-- Check database size
SELECT pg_size_pretty(pg_database_size('postgres'));

-- Check tables with bloat
SELECT 
  schemaname, tablename,
  pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename)) AS size
FROM pg_tables
WHERE schemaname = 'public'
ORDER BY pg_total_relation_size(schemaname||'.'||tablename) DESC;

-- Vacuum (automatic in Supabase, but can be checked)
VACUUM ANALYZE;

-- Check statistics
ANALYZE;
  • [ ] Check database size growth
  • [ ] Check for table bloat
  • [ ] Execute VACUUM ANALYZE (if not automatic)
  • [ ] Check index usage

Index Optimization:

sql
-- Check for unused indexes
SELECT 
  schemaname, tablename, indexname, idx_scan, idx_tup_read, idx_tup_fetch
FROM pg_stat_user_indexes
WHERE idx_scan = 0
ORDER BY pg_relation_size(indexrelid) DESC;

-- Check slow queries (if pg_stat_statements exists)
SELECT query, calls, total_time, mean_time
FROM pg_stat_statements
ORDER BY mean_time DESC
LIMIT 10;

βœ… Audit Log Review ​

sql
-- Check audit logs for last month
SELECT 
  changed_by,
  table_name,
  action,
  COUNT(*) as changes,
  MAX(changed_at) as last_change
FROM public.audit_log
WHERE changed_at >= NOW() - INTERVAL '1 month'
GROUP BY changed_by, table_name, action
ORDER BY changes DESC;
  • [ ] Review audit logs for anomalies
  • [ ] Check for unauthorized changes
  • [ ] Document important changes
  • [ ] Archive old audit logs (if necessary)

βœ… Backup Retention ​

bash
# Check backup retention
find backups/lager-guru/ -name "*.dump*" -mtime +30 -ls

# Check backup count
ls -1 backups/lager-guru/ | wc -l
  • [ ] Check backup retention policy
  • [ ] Delete old backups (according to retention policy)
  • [ ] Archive critical backups (off-site)

Quarterly Tasks ​

βœ… Security Updates ​

Node.js and Base Images:

bash
# Check Node.js version
node --version

# Check Docker base image versions
docker images | grep node
docker images | grep nginx

# Check for security advisories
npm audit
docker scout cves hashmatrix/lager-guru:latest
  • [ ] Check for Node.js security updates
  • [ ] Update Docker base images (node:18-alpine, nginx:stable-alpine)
  • [ ] Check for OS-level vulnerabilities
  • [ ] Apply security patches

βœ… Performance Optimization ​

Database Performance:

sql
-- Check for missing indexes
EXPLAIN ANALYZE SELECT * FROM public.shipments WHERE driver_id = '...';

-- Check query performance
SELECT 
  query, 
  calls, 
  total_time, 
  mean_time,
  max_time
FROM pg_stat_statements
WHERE mean_time > 100
ORDER BY mean_time DESC
LIMIT 20;
  • [ ] Review database query performance
  • [ ] Optimize slow queries
  • [ ] Add indexes where necessary
  • [ ] Check for query plan changes

Application Performance:

bash
# Check bundle size
npm run build
du -sh dist/

# Check for large dependencies
npx bundle-phobia [package-name]
  • [ ] Check bundle size growth
  • [ ] Optimize code splitting
  • [ ] Remove unused dependencies
  • [ ] Check for performance regressions

Annual Tasks ​

βœ… Major Version Upgrades ​

Node.js:

bash
# Check current version
node --version

# Check LTS schedule
# https://nodejs.org/en/about/releases/
  • [ ] Plan upgrade to latest LTS
  • [ ] Test in development environment
  • [ ] Document breaking changes
  • [ ] Plan migration window

βœ… Architecture Review ​

  • [ ] Review application architecture
  • [ ] Identify technical debt
  • [ ] Plan refactoring initiatives
  • [ ] Check alignment with best practices

Security Updates ​

Automated Security Scanning ​

GitHub Dependabot:

  • Automatically checks for vulnerabilities
  • Creates PRs for security updates
  • Configuration: .github/dependabot.yml

npm audit:

bash
# Check for vulnerabilities
npm audit

# Fix automatically (if safe)
npm audit fix

# Fix with breaking changes
npm audit fix --force  # be careful!

Security Patch Priority ​

  1. Critical - Apply immediately
  2. High - Apply within 1 week
  3. Moderate - Apply within 1 month
  4. Low - Apply at next planned update

Dependency Upgrades ​

Upgrade Strategy ​

  1. Minor/Patch Updates:

    • Automatic via Dependabot
    • Test in development
    • Merge to production
  2. Major Updates:

    • Manual review of changelog
    • Test in separate branch
    • Plan migration window
    • Document breaking changes

Upgrade Checklist ​

  • [ ] Review changelog
  • [ ] Check for breaking changes
  • [ ] Test in development environment
  • [ ] Review code for deprecated APIs
  • [ ] Update documentation
  • [ ] Deploy to production
  • [ ] Monitor for errors

Database Maintenance ​

Regular Tasks ​

Vacuum:

sql
-- Automatic in Supabase, but settings can be checked
SHOW autovacuum;

Analyze:

sql
-- Updates statistics for query planner
ANALYZE public.shipments;
ANALYZE public.zones;
ANALYZE public.profiles;

Index Maintenance:

sql
-- Check for unused indexes
SELECT * FROM pg_stat_user_indexes WHERE idx_scan = 0;

-- Rebuild indexes (if necessary)
REINDEX TABLE public.shipments;

Log Rotation ​

Docker Logs ​

bash
# Set up Docker log rotation
# In docker-compose.yml:
logging:
  driver: "json-file"
  options:
    max-size: "10m"
    max-file: "3"

Application Logs ​

Nginx Logs:

bash
# Set up log rotation for Nginx
# /etc/logrotate.d/nginx
/var/log/nginx/*.log {
    daily
    rotate 7
    compress
    delaycompress
    missingok
    notifempty
    create 0640 www-data adm
    sharedscripts
    postrotate
        [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
    endscript
}

Backup Verification ​

Backup Testing ​

bash
# Test backup restore (in test environment)
pg_restore --list backups/lager-guru/lager-guru-YYYYMMDD_HHMMSS.dump

# Check backup integrity
pg_restore --schema-only backups/lager-guru/lager-guru-YYYYMMDD_HHMMSS.dump | head -20

Backup Retention ​

  • Daily backups: Keep last 7 days
  • Weekly backups: Keep last 4 weeks
  • Monthly backups: Keep last 12 months
  • Yearly backups: Keep for 7 years

Last Updated: 2025-11-05

Released under Commercial License