Skip to content

Dawarich

Self-Hosted Location History

Dawarich is a self-hosted alternative to Google Location History (Timeline). It stores GPS location data, visualises trips on a map, and gives full control over personal location history without relying on third-party cloud services.

Why Choose Dawarich

  • Privacy first - location data stays on your own server
  • Google Takeout import - migrate existing location history easily
  • OwnTracks & Overland support - works with popular mobile tracking apps
  • Trip detection - automatically groups location points into trips
  • Statistics & heatmaps - visualise visited places over time

Install

Infrastructure Configuration

Infrastructure as Code

The canonical configuration is maintained at Benoit/OpenTofu.

The Dawarich VM is provisioned with OpenTofu. Two extra block volumes are attached: one for Docker data and one for /opt where Dawarich lives.

OpenTofu configuration
resource "incus_storage_volume" "dawarich_var_lib_docker" {
  name         = "dawarich_var_lib_docker"
  pool         = incus_storage_pool.default.name
  content_type = "block"
  config = {
    "size" = "50GiB"
  }
}

resource "incus_storage_volume" "dawarich_opt" {
  name         = "dawarich_opt"
  pool         = incus_storage_pool.default.name
  content_type = "block"
  config = {
    "size" = "10GiB"
  }
}

resource "incus_instance" "dawarich" {
  name  = "dawarich"
  image = "images:ubuntu/24.04"
  type  = "virtual-machine"

  config = {
    "limits.cpu"    = 2
    "limits.memory" = "4GiB"
  }

  device {
    name = "root"
    type = "disk"
    properties = {
      size = "25GiB"
      path = "/"
      pool = incus_storage_pool.default.name
    }
  }

  device {
    name = "var_lib_docker"
    type = "disk"
    properties = {
      # Mount manually inside the VM: path = "/var/lib/docker"
      source = incus_storage_volume.dawarich_var_lib_docker.name
      pool   = incus_storage_pool.default.name
    }
  }

  device {
    name = "opt"
    type = "disk"
    properties = {
      # Mount manually inside the VM: path = "/opt"
      source = incus_storage_volume.dawarich_opt.name
      pool   = incus_storage_pool.default.name
    }
  }
}

Manual mount required

The var_lib_docker and opt block volumes are attached to the VM but not auto-mounted. After the VM first boots, format and mount them manually before installing Docker or cloning Dawarich.

Deploy Infrastructure

Apply OpenTofu configuration
tofu apply

Inside the VM: Format and Mount Volumes

After the first boot, identify the two attached block devices and set them up:

Format and mount the volumes

Format and mount block volumes
mkfs.ext4 /dev/sdb && mkfs.ext4 /dev/sdc
mkdir -p /var/lib/docker /opt
mount /dev/sdb /var/lib/docker
mount /dev/sdc /opt

Persist mounts across reboots

Add fstab entries
echo '/dev/sdb /var/lib/docker ext4 defaults 0 2' >> /etc/fstab
echo '/dev/sdc /opt ext4 defaults 0 2' >> /etc/fstab

Inside the VM: Docker and Dawarich

Install Docker

Install Docker via official convenience script
curl -fsSL https://get.docker.com | sh

Clone the Dawarich repository

Clone Dawarich into /opt
git clone https://github.com/Freika/dawarich.git /opt/dawarich

Configure environment

Create .env and set passwords
cd /opt/dawarich/docker
cp .env.example .env

# Generate and set a random database password
DB_PASS=$(openssl rand -hex 16)
sed -i "s/^POSTGRES_PASSWORD=.*/POSTGRES_PASSWORD=$DB_PASS/" .env
sed -i "s/^DATABASE_PASSWORD=.*/DATABASE_PASSWORD=$DB_PASS/" .env

# Generate and set the Rails secret key
sed -i "s/^SECRET_KEY_BASE=.*/SECRET_KEY_BASE=$(openssl rand -hex 64)/" .env

# Set application host (keep APPLICATION_PROTOCOL=http, TLS is terminated by HAProxy)
sed -i 's/^APPLICATION_HOSTS=.*/APPLICATION_HOSTS=dawarich.benoit.jp.net/' .env

Keep RAILS_ENV=development

The Dawarich project recommends using the development environment for self-hosted deployments. Do not switch to production.

Adjust TIME_ZONE and other settings in .env as needed.

Start Dawarich

Start all containers
cd /opt/dawarich/docker
docker compose up -d

Related Documentation: