Database Migration
Goal: Initialize the database schema and create the application user (run exactly once, before any services start)
Prerequisites
Before proceeding, confirm:
✓ Environment Configuration Step 2 completed with Phase 1 (superuser) credentials in .env
✓ PostgreSQL database created in Database Setup
✓ You are on the host where Docker is installed
Step 1: Verify Superuser Credentials in .env
Run:
cat config/.env | grep DB_USER
cat config/.env | grep DB_PASSWORDStep 2: Ensure Docker Is Ready
Docker group membership from Server Infrastructure Setup only takes effect in a new shell session. Prepare Docker for this session:
Success: docker run hello-world completes without error
Failure: If docker run hello-world still fails, log out and back in (instead of using newgrp docker), then retry
Step 3: Run the Migration
Run:
Step 4: Verify Migration Succeeded
Wait 1–2 minutes, then run:
Success:
Exit code is
0Logs show "Successfully applied X migration(s)" and application user created
Status shows
Exited (0)
Failure: Non-zero exit code, error messages, or Exited (1). See Migration failed in Troubleshooting. Do not proceed until this succeeds.
Step 5: Update .env to Application User Credentials (Phase 2)
The Flyway migration created the application user. Update .env with the application user credentials:
Set these two values in the file:
Last updated