Operational Runbooks
Standard operational procedures for deploying, maintaining, and troubleshooting gmessages-rag.
Runbook 1: Initial Deployment
- Configure environment variables in
.env. - Start containers:
docker compose up -d --build. - Verify database initialization via
docker logs gmessages-rag. - Navigate to
http://<host>:8090/pairto authenticate with Google Messages.
Runbook 2: Session Re-Authentication
When tokens expire or a device is unlinked:
- An alert is sent via configured Apprise/ntfy endpoints.
- Tap the link in the notification or open
http://<host>:8090/pair. - Import fresh Google session cookies and approve the Gaia emoji challenge on your phone.
- The daemon resumes synchronization immediately without data loss.
Runbook 3: Backfilling Conversation History
To backfill historical messages for a specific conversation:
- Open the Web Dashboard or invoke the MCP tool
manage_tracked_contact. - Specify the
conversation_idand action"backfill". - The daemon paginates via
libgm.FetchMessagesup to the configured batch limit. - Messages and media are deduplicated and indexed transactionally.
Runbook 4: Live End-to-End Smoke Test (HARN-04)
Before trusting a real account in production, validate the full provider handoff once.
Prerequisites:
- A dedicated session file (never the daemon's
SESSION_PATH). - A reachable PostgreSQL
DATABASE_URL. - Outbound network access to Google Messages.
- The paired phone in hand to approve the Gaia emoji and send a test message.
Procedure:
- Run the gated test:bash
GM_ALLOW_NETWORK=1 LIVE_GM_TEST=1 \ SESSION_PATH=/tmp/live-smoke-session.json \ DATABASE_URL='postgres://...' \ go test -tags live -race -v -timeout 5m -run TestLiveSmoke_EndToEnd ./internal/gm/ - Approve the emoji printed in the test log on your phone.
- Send one message from the paired phone within the 2-minute window.
- Confirm the test logs
Live smoke test completedand exitsPASS. - Inspect the database for the ingested message, then delete the temporary session file.
Failure triage:
timed out waiting for an inbound message-> send a message during the window, or confirm the phone is still paired.Gaia pairing should complete after operator approval-> re-run and approve the emoji promptly; check for revoked sessions.session file must be 0600-> the session path is on a filesystem that ignores POSIX modes; use a local path.
Runbook 5: Running DB Integration Tests Locally (DB-07)
The internal/db suite (sessions, RRF/HNSW, FTS, dossiers, receipts) skips itself unless a Postgres+pgvector database is reachable. To run it locally:
- Start an ephemeral pgvector instance:bash
docker run -d --name gmtest-db -p 5432:5432 \ -e POSTGRES_USER=rcsrag -e POSTGRES_PASSWORD=changeme -e POSTGRES_DB=gmessages_test \ pgvector/pgvector:pg17 - Wait for readiness, then run the integration target:bash
export DATABASE_URL='postgres://rcsrag:changeme@localhost:5432/gmessages_test?sslmode=disable' make test-integration - Expected:
internal/dbcoverage ≥ 75% and total suite coverage ≥ 75%. - Tear down:
docker rm -f gmtest-db.
CI runs the same suite against a services.postgres container in Stage 2, so a SQL regression fails the build.