> ## Documentation Index
> Fetch the complete documentation index at: https://vexidata.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Fly.io

> Connect your Fly.io PostgreSQL database to VexiData.

## Prerequisites

* A [Fly.io](https://fly.io) account with a Fly Postgres app
* A [VexiData](https://vexidata.com) account

## Enable external access

Fly Postgres is **not publicly accessible by default**. You must allocate a public IP address to your Postgres app before VexiData can connect.

```bash theme={null}
fly ips allocate-v4 -a your-pg-app-name
```

After allocating an IP, your Postgres app will be accessible at `your-pg-app-name.fly.dev` on port `5432`.

## Connect Fly.io to VexiData

<Steps>
  <Step title="Get your connection details">
    Your credentials were shown when you created the Postgres app with `fly pg create`. If you need to retrieve them:

    ```bash theme={null}
    fly ssh console -a your-pg-app-name -C "env" | grep DATABASE_URL
    ```

    Extract the parameters from the connection string:

    | Parameter    | Example                    |
    | ------------ | -------------------------- |
    | **Host**     | `your-pg-app-name.fly.dev` |
    | **Port**     | `5432`                     |
    | **Database** | Your database name         |
    | **Username** | `postgres`                 |
    | **Password** | Your operator password     |
  </Step>

  <Step title="Add the connection in VexiData">
    1. Go to [Data Sources](https://vexidata.com/data-sources) in VexiData
    2. Click **PostgreSQL** to open the connection form
    3. Fill in the details:

    | Field            | Value                                                          |
    | ---------------- | -------------------------------------------------------------- |
    | **Display Name** | A name to identify this connection (e.g., "Fly.io Production") |
    | **Host**         | `your-pg-app-name.fly.dev`                                     |
    | **Port**         | `5432`                                                         |
    | **Database**     | Your database name                                             |
    | **Schema**       | `public` (default)                                             |
    | **Username**     | `postgres`                                                     |
    | **Password**     | Your operator password                                         |
  </Step>

  <Step title="Test and save">
    Click **Test & Save Connection**. VexiData will verify it can reach your database. Once connected, your schema will be analyzed automatically.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection timed out">
    * Make sure you've allocated a public IPv4 address with `fly ips allocate-v4 -a your-pg-app-name`
    * Verify your Postgres app is running: `fly status -a your-pg-app-name`
    * The `.fly.dev` hostname must resolve — check with `fly ips list -a your-pg-app-name`
  </Accordion>

  <Accordion title="Authentication failed">
    * Retrieve your credentials by SSHing into the app: `fly ssh console -a your-pg-app-name -C "env"`
    * Look for `OPERATOR_PASSWORD` in the environment variables
  </Accordion>

  <Accordion title="No tables visible after connecting">
    * Confirm your tables are in the `public` schema. If they're in a custom schema, update the **Schema** field in VexiData
    * Make sure you're connecting to the correct database name
  </Accordion>
</AccordionGroup>
