Database Setup
PostgreSQL Installation
Option 1: Docker Compose (Recommended)
docker compose up -d postgresOption 2: Local PostgreSQL
macOS
brew install postgresql@15
brew services start postgresql@15Ubuntu/Debian
sudo apt update
sudo apt install postgresql-15 postgresql-contrib
sudo systemctl start postgresqlCreate Database and User
-- Connect as postgres user
sudo -u postgres psql
-- Create database
CREATE DATABASE ansibleinspec;
-- Create user
CREATE USER ansibleinspec WITH PASSWORD 'your_secure_password';
-- Grant privileges
GRANT ALL PRIVILEGES ON DATABASE ansibleinspec TO ansibleinspec;
-- Exit
\qConfiguration
Environment Variables
Connection String Format
Database Migrations with Alembic
Initialize Alembic
Configure Alembic
Create Initial Migration
Apply Migrations
View Migration History
Hybrid Storage Configuration
Enable Hybrid Mode
Storage Backends
Migration from File Storage
Step 1: Backup Existing Data
Step 2: Initialize Database
Step 3: Migrate Data
Step 4: Enable Hybrid Mode
Step 5: Monitor Validation Period
Monitoring and Validation
Check Consistency
View Validation Status
Cutover Criteria
Cutover to Database-Only
Manual Cutover
Automatic Cutover
Rollback to File Storage
Performance Tuning
Connection Pooling
Indexes
Query Optimization
Backup and Recovery
Automated Backups
Restore from Backup
Troubleshooting
Connection Refused
Permission Denied
Migration Failures
High Latency
Security Best Practices
References
Last updated