Skip to main content

Metabase App Database Connection Values

✅ Solution Implemented

A second socat instance has been added to forward port 5433 to the application database. This allows Metabase to connect to both:

  • Port 5432: Metabase metadata database (automatic)
  • Port 5433: Application database (for your FlowPOS data)

For Staging Environment

Use these exact values in the Metabase UI when adding your FlowPOS app database:

Connection Values

Display name: FlowPOS Staging DB (or any name you prefer)

Host: 127.0.0.1

Port: 5433Important: Use port 5433, not 5432!

Database name: flowpos_staging

Username: flowpos_staging

Password: [Your password from Doppler/backend secrets]

Schemas: All (or public if you want only the public schema)

Use a secure connection (SSL): ❌ Unchecked (disabled)

Use an SSH-tunnel: ❌ Unchecked (not needed)

For Production Environment

Same as staging, but use:

  • Port: 5433
  • Database name: flowpos_production
  • Username: flowpos_production
  • Password: [Your production password]

Getting the Password

The password for the database user should be in your backend's Doppler secrets or GitHub secrets as part of the DATABASE_URL_STAGING or DATABASE_URL_PRODUCTION connection string.

To extract it:

# Staging
doppler secrets get DATABASE_URL_STAGING --project flowpos-workspace --config staging --plain

# Production
doppler secrets get DATABASE_URL_PRODUCTION --project flowpos-workspace --config production --plain

How It Works

  1. Dockerfile now includes a start_socat() function that can forward multiple ports
  2. Port 5432 → Metabase metadata database (required for Metabase to run)
  3. Port 5433 → Application database (for querying your FlowPOS data)
  4. Workflow passes CLOUD_SQL_INSTANCE_APP environment variable to enable the second socat instance

Testing the Connection

After deployment:

  1. Go to Metabase UI → SettingsAdminDatabasesAdd Database
  2. Fill in the values above
  3. Click "Test Connection"
  4. You should see: ✅ "Successfully connected to the database."

Troubleshooting

If the connection fails:

  • Verify CLOUD_SQL_INSTANCE_APP is set in the Cloud Run service environment variables
  • Check Metabase logs for socat startup messages
  • Ensure both Cloud SQL instances are added to --add-cloudsql-instances in the deployment
  • Verify the password is correct