Dawarich: Location History Tracker
Overview
Dawarich is a self-hosted, privacy-first alternative to Google Maps Timeline. It records, processes, and visualizes location history using an offline-first mobile app and a background-processing queue on the server.
Because the server runs on a specific schedule (7:30 AM–10:00 AM, 12:00 PM–2:00 PM, 6:00 PM–12:00 AM), the mobile clients are configured to cache location points locally while the server is offline and batch-upload them once the server powers back on.
Deployment Details
Dawarich is deployed via Docker Compose using the official production configuration. The stack relies on deep automated health checks to ensure the database and Redis cache boot fully before the main application starts.
Core Components: PostgreSQL (PostGIS), Redis, Web App, Sidekiq (Background worker).
Web Interface: Available locally on port 51101.
Environment Configuration: All database credentials, secrets, and timezone configurations (Asia/Kolkata) are stored locally in the .env file within the deployment directory.
Backup Strategy
Docker named volumes (like the PostgreSQL database) reside outside the /home directory and are actively written to, making direct file-level backups unsafe.
To ensure compatibility with the system's Kopia backup routine, the database is safely dumped to the home directory daily.
Backup Method: A Cron job executes pg_dump inside the database container.
Cron Schedule: 0 20 * * * (8:00 PM daily, ensuring the server is online).
Export Destination: ~/docker/dawarich/dawarich_backups/dawarich_latest.dump
Long-Term Storage: Kopia automatically picks up the .dump file from the home directory during its standard run.
Mobile App Configuration Profile
To balance accurate route mapping with mobile battery preservation, the tracking app is configured with the following parameters:
Distance Filter: 30–50 meters (prevents GPS drift from logging stationary points).
Time Filter: 15–30 seconds.
Accuracy: High / Balanced (Avoid "Highest" or Navigation mode, which keeps the GPS radio continuously active).
Track Breaking: 15–30 minutes (splits travel into distinct "trips" when stopped at a location).
iOS Specifics: "Significant Location" tracking can be enabled to further reduce battery by relying on cell-tower handoffs instead of pure GPS, at the cost of slight mapping precision between points.
Troubleshooting & Maintenance
Initial Boot / Rebuilding: If the stack is rebuilt, it takes roughly 2 to 3 minutes for the dawarich_db and dawarich_redis containers to report as healthy. The dawarich_app container will not start its initialization until this happens.
Fragmented Data: Raw imports from Google Takeout or Strava may initially appear chaotic. The Sidekiq background worker processes, deduplicates, and filters these points into clean tracks over time.
Database Corruption: If the dawarich_db_data volume is corrupted during a failed boot, completely bring down the stack and wipe the volumes (docker compose down -v) before restarting to allow a clean PostgreSQL initialization.