Troubleshooting#
The piler container stops at the start#
From 2.4.0 the piler container (Docker) checks the archive database (MySQL)
and the search index (Manticore) before it starts. They must either both be
empty, which is a new installation, or both have the archive: every tenant
in tenant_settings (on a multi-node setup: the default tenant) must have
its Manticore table. If only one of them has it, the container stops with an error and
creates or changes nothing. A restart or a reboot doesn't lose data, so
something happened outside piler, and you decide what to do.
The log of the container (docker compose logs piler) shows what was found
on each side:
[entrypoint] ERROR: the archive database has tenants or archived emails, but tables of their search index are missing: piler piler_audit piler_cat1 piler_note1 piler_tag1
[entrypoint] Found: MySQL mysql, database piler: row of the default tenant: yes, archived emails: yes, provisioned tenants: 1
[entrypoint] Found: Manticore manticore:9306: table piler: missing, missing tables: piler piler_audit piler_cat1 piler_note1 piler_tag1
Check these first. Fixing any of them brings the archive back as it was:
- The volumes are the ones of this installation:
docker volume ls, and thevolumes:of the compose file. A volume made again with the same name is empty. MANTICORE_HOSTand the MySQL settings in the compose file point to the servers of this installation.- The data directory of Manticore (
data_dirinmanticore.conf) is on its volume.
When Manticore doesn't answer within two minutes (MANTICORE_WAIT_SECONDS,
default 120), the container stops with Manticore not available, and the
restart policy starts it again. Raise it for a large index that takes longer
to load. Manticore may list its tables a bit after it answers, so a missing
table is looked for again for 30 seconds (MANTICORE_TABLE_WAIT_SECONDS)
before the container stops.
The audit, tag, note and category tables of the default tenant (piler_audit,
piler_tag1, piler_note1, piler_cat1) are checked like its search index:
one of them missing stops the container too.
Search index missing#
The archive database has the emails, but the Manticore tables are gone. The emails and attachments are fine. What only Manticore holds is lost with the tables:
- the search index, which a reindex rebuilds from the emails
- the audit log
- the tags and the notes of the users
- the vectors of the semantic search
Only a backup brings back the audit log, the tags and the notes.
With a backup of the search index#
piler-backup.sh of the examples backs up the Manticore tables. Restore only
them, then reindex the emails archived after the backup:
- Stop piler and Manticore:
docker compose stop piler manticore - Extract the backup:
../../../scripts/piler-backup.sh extract <id> /tmp/restore -
Copy the tables into the Manticore volume, as
piler-backup.sh restoredoes for a whole installation.ls /tmp/restore/var/lib/manticore/piler-backup/shows the name of the backup:docker compose run --rm --no-deps -v /tmp/restore/var/lib/manticore/piler-backup:/work:ro --entrypoint sh manticore -c \ 'set -e; b=/work/<backup name>; cp -a $b/data/. /var/lib/manticore/; cp $b/config/var/lib/manticore/manticore.json /var/lib/manticore/; if [ -n "$(ls -A $b/state)" ]; then cp -a $b/state/. /var/lib/manticore/; fi; chown -R manticore:manticore /var/lib/manticore' -
docker compose start manticore piler, and remove/tmp/restore: it holds the emails of the backup, not encrypted. - Reindex the emails archived after the backup, as below, with
-startthe first id that isn't in the index.
Without a backup: empty tables and a reindex#
The audit log, the tags and the notes from before are lost. Record it, following your compliance rules.
-
Create the empty tables of the default tenant. The container doesn't start, so run
create-tenant.shwith its entrypoint overridden:docker compose run --rm --no-deps --entrypoint "" piler \ su -s /bin/bash piler -c 'touch /var/piler/tenant/piler && /usr/libexec/piler/create-tenant.sh'On a multi-tenant installation, touch a file for every tenant in
/var/piler/tenant/(thetenant_idoftenant_settings) in the same command: their tables are gone too. -
Start piler:
docker compose start piler. The tables are there, so it starts, and the new emails are indexed again. -
Reindex the emails. The ids are those of the
metadatatable of the tenant:docker compose exec piler mariadb --defaults-file=/etc/piler/.my.cnf -N piler -e 'select max(id) from metadata' docker compose exec piler su -s /bin/bash piler -c 'reindex -tenantid piler -start 1 -stop <max id> -progress'A multi-tenant installation reindexes every tenant, with the ids of its database (
piler_<tenant>). A large archive takes hours: the search finds the emails as the reindex gets to them.
Archive database empty#
The search index has documents, but the archive database has no emails, nor the row of the default tenant. The database is the archive: what is lost with it is the list of the emails, the users and the settings. The emails and attachments are still in the store, but piler can't find them without the database.
Restore the database from a backup. With piler-backup.sh, restore the
installation onto a new host, or on empty volumes: see
Restore on a new host. The
emails archived after the backup are not in the database then.
Don't let piler start on the empty database: it would be a new, empty archive next to the old index.