Skip to content

Latest commit

 

History

History
87 lines (63 loc) · 1.69 KB

File metadata and controls

87 lines (63 loc) · 1.69 KB

pgtrace setup guide

Quick setup guide for testing pgtrace.

Prerequisites

  • PostgreSQL (via docker-compose or local installation)
  • Rust toolchain (cargo, rustc)
  • Elixir/Mix (for Phoenix server)

Database Setup

  1. Start PostgreSQL containers:
docker-compose up -d postgres-store
docker-compose up -d postgres-source  # Optional, for testing agent
  1. Run migrations:
export PGPASSWORD=postgres

# Core migrations
psql -h localhost -p 5433 -U postgres -d pgtrace_store -f store/migrations/001_init.sql
psql -h localhost -p 5433 -U postgres -d pgtrace_store -f store/migrations/002_rollup_tables.sql
psql -h localhost -p 5433 -U postgres -d pgtrace_store -f store/migrations/003_roles_grants.sql
psql -h localhost -p 5433 -U postgres -d pgtrace_store -f store/migrations/004_retention_helpers.sql

Or run all at once:

for file in store/migrations/*.sql; do
  psql -h localhost -p 5433 -U postgres -d pgtrace_store -f "$file"
done

Build Agent

cd agent
cargo build --release

Configuration example: agent/pgtrace-agent.yaml.example

Build CLI

cd cli
cargo build --release

Set environment variable for store database:

export PGTRACE_STORE_DSN="postgres://postgres:postgres@localhost:5433/pgtrace_store"

Setup Phoenix Server

cd server
mix deps.get
mix compile

Update database connection in server/config/config.exs if needed.

Verify Setup

  1. Check database tables:
psql -h localhost -p 5433 -U postgres -d pgtrace_store -c "\dt pgtrace.*"
  1. Run CLI doctor command:
cd cli
cargo run -- doctor
  1. Check server health (once running):
curl http://localhost:4000/api/v1/health