# Database Setup Guide ## Current Issue The setup is failing with database authentication error (28P01). This means: - The database password in `.env` doesn't match your PostgreSQL password, OR - PostgreSQL is not running, OR - The database `sankofa` doesn't exist ## Quick Fix ### Option 1: Use Interactive Setup (Recommended) ```bash cd /home/intlc/projects/Sankofa/api ./scripts/setup-with-password.sh ``` This script will: 1. Prompt you for your actual PostgreSQL password 2. Update `.env` automatically 3. Run all setup steps ### Option 2: Manual Setup #### Step 1: Find Your PostgreSQL Password If you don't know your PostgreSQL password, you can: **Option A**: Reset postgres user password ```bash sudo -u postgres psql ALTER USER postgres PASSWORD 'your_new_password'; \q ``` **Option B**: Check if you have a password in your system ```bash # Check common locations cat ~/.pgpass 2>/dev/null # or check if you have it saved elsewhere ``` #### Step 2: Update .env Edit `.env` and set the correct password: ```bash cd /home/intlc/projects/Sankofa/api nano .env # or use your preferred editor ``` Set: ```env DB_PASSWORD=your_actual_postgres_password NODE_ENV=development ``` #### Step 3: Create Database (if needed) ```bash # Connect to PostgreSQL sudo -u postgres psql # Create database CREATE DATABASE sankofa; # Exit \q ``` #### Step 4: Run Setup ```bash ./scripts/setup-sovereign-stack.sh ``` ## Verify Database Connection Test your connection manually: ```bash psql -h localhost -U postgres -d sankofa ``` If this works, your password is correct. If it fails, update your password. ## Common Solutions ### Solution 1: Use Default PostgreSQL Setup If PostgreSQL was just installed, you might need to set a password: ```bash sudo -u postgres psql ALTER USER postgres PASSWORD 'dev_sankofa_2024'; \q ``` Then update `.env`: ```env DB_PASSWORD=dev_sankofa_2024 ``` ### Solution 2: Use Peer Authentication (Local Development) If you're running as the postgres user or have peer authentication: ```bash # Try connecting without password sudo -u postgres psql -d sankofa # If that works, you can use empty password or configure .env differently ``` ### Solution 3: Check PostgreSQL Status ```bash # Check if PostgreSQL is running sudo systemctl status postgresql # Start if not running sudo systemctl start postgresql # Enable on boot sudo systemctl enable postgresql ``` ## After Database is Configured Once your `.env` has the correct password: ```bash cd /home/intlc/projects/Sankofa/api ./scripts/setup-sovereign-stack.sh ``` Or use the interactive script: ```bash ./scripts/setup-with-password.sh ``` ## Next Steps After successful setup: 1. ✅ All 9 services will be registered 2. ✅ Phoenix publisher will be created 3. ✅ You can query services via GraphQL 4. ✅ Services appear in marketplace