How to Connect Your Self-Hosted Postgres Database to Indiequery
Connect your self-hosted PostgreSQL database to Indiequery to query and explore data through a web interface. Whether you're running Postgres in Docker, on a VPS, or locally for development, you can connect in minutes with the right connection details.
What You Need
Before connecting your self-hosted Postgres database to Indiequery, you'll need:
- Your database host (IP address or domain name)
- Port number (default is
5432) - Database name
- Username with appropriate permissions
- Password for that user
- Network access configured (firewall rules, security groups, etc.)
If you're running Postgres locally or behind a firewall, you'll need to ensure Indiequery's IP address (
91.98.141.61) can reach your database.
Connect from Docker
Most developers run Postgres in Docker for local development or production deployments. Here's how to find your connection details.
For Docker Compose:
If you're using Docker Compose, check your docker-compose.yml file for the Postgres service configuration:
services:
postgres:
image: postgres:15
environment:
POSTGRES_DB: myapp
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
ports:
- "5432:5432"
From this configuration:
- Host - Your server's public IP address or domain
- Port -
5432(the first port in5432:5432) - Database - Value of
POSTGRES_DB(e.g.,myapp) - Username - Value of
POSTGRES_USER(e.g.,myuser) - Password - Value of
POSTGRES_PASSWORDFor standalone Docker containers:
Run docker ps to find your Postgres container, then inspect it:
docker inspect <container_id> | grep -i postgres
Or check environment variables directly:
docker exec <container_id> env | grep POSTGRES
Network access:
If your Docker Postgres is running on a VPS or cloud server, ensure port 5432 is exposed to the internet and your firewall allows incoming connections from 91.98.141.61. If running locally, Indiequery won't be able to connect directly - see the Local Development section below.
Connect from VPS or Bare Metal Server
If Postgres is installed directly on your VPS or server (not in Docker), you'll need to configure network access.
Find your connection details:
Check your PostgreSQL configuration file (usually /etc/postgresql/<version>/main/postgresql.conf) for the port:
grep "^port" /etc/postgresql/15/main/postgresql.conf
Your database name, username, and password depend on how you set up Postgres. If you're not sure, connect locally and check:
sudo -u postgres psql -c "\l" # List databases
sudo -u postgres psql -c "\du" # List users
Configure network access:
By default, Postgres only accepts local connections. Edit postgresql.conf to listen on all interfaces:
listen_addresses = '*'
Then edit pg_hba.conf (usually /etc/postgresql/<version>/main/pg_hba.conf) to allow connections from Indiequery's IP:
# Allow Indiequery access
host all all 91.98.141.61/32 md5
Restart Postgres after making changes:
sudo systemctl restart postgresql
Firewall rules:
Open port 5432 in your firewall for Indiequery's IP. For Ubuntu with ufw:
sudo ufw allow from 91.98.141.61 to any port 5432
For cloud providers (AWS, DigitalOcean, etc.), add an inbound rule in your security group allowing TCP port 5432 from 91.98.141.61.
Security note: Restricting access to specific IP addresses (like Indiequery's IP) is much safer than opening port 5432 to the entire internet.
Connect from Local Development
If Postgres is running on your local machine (laptop, desktop), Indiequery cannot connect directly because your database isn't exposed to the internet.
Two options:
Option 1: Deploy to a server - The simplest approach is to connect Indiequery to a staging or production database that's hosted on a VPS or cloud platform. Use your local database for development, and Indiequery for production/staging queries.
Option 2: SSH tunnel - Advanced users can set up an SSH tunnel through a server that acts as a bridge between Indiequery and your local database. This requires a public server with SSH access and some networking knowledge. This approach is not officially supported but may work if you need it.
For most developers, using Indiequery with production or staging databases (not local development databases) provides the best experience.
Add Connection in Indiequery
Once you've configured network access and found your connection details, connect to Indiequery:
- Go to app.indiequery.com and click Add Database Connection
- Host - Your server's IP address or domain name
- Port - Enter
5432(or your custom port) - Database - Your database name
- Username - Your Postgres username
- Password - Your Postgres password
- Require SSL - Check this if you've configured SSL (recommended for production)
- Name your connection (e.g., "Production Server")
- Click Add Connection Indiequery tests the connection automatically. If successful, you're ready to query your self-hosted database.
SSL/TLS Encryption
For production databases, enable SSL to encrypt data in transit between Indiequery and your database. This prevents passwords and query results from being transmitted in plain text.
Enable SSL in Postgres:
Edit postgresql.conf:
ssl = on
ssl_cert_file = '/path/to/server.crt'
ssl_key_file = '/path/to/server.key'
Restart Postgres and check the "Require SSL" box when connecting in Indiequery.
For development or internal networks, SSL may be optional, but it's strongly recommended for any database exposed to the internet.
Common Connection Issues
"Connection timed out" or "Connection refused"
Verify your firewall allows connections from 91.98.141.61 on port 5432. Check that Postgres is listening on 0.0.0.0 (all interfaces) in postgresql.conf, not just localhost. Confirm your server's public IP or domain is correct.
"Authentication failed"
Double-check your username and password. Verify pg_hba.conf allows md5 or scram-sha-256 authentication for the user. Postgres usernames and passwords are case-sensitive.
"Database does not exist"
Check available databases by connecting locally: psql -U postgres -l. Database names are case-sensitive.
"SSL required" or "SSL connection error"
If Postgres requires SSL but you didn't check "Require SSL" in Indiequery, the connection will fail. Either enable SSL in Indiequery or disable ssl in postgresql.conf (not recommended for production).
"No route to host"
Your database server may not be reachable from Indiequery's IP. Verify your server's public IP is correct and that it's not behind a NAT or private network without proper port forwarding.
Network Security Best Practices
When exposing a self-hosted database to the internet:
- Restrict IP access - Only allow Indiequery's IP (
91.98.141.61) in your firewall andpg_hba.conf - Use strong passwords - Generate long, random passwords for database users
- Enable SSL - Encrypt connections to prevent eavesdropping
- Disable public access to superuser - Create a dedicated user with limited permissions for Indiequery
- Regular backups - Always maintain backups before making configuration changes
Never expose Postgres to the entire internet (
0.0.0.0/0) unless absolutely necessary and properly secured.
Next Steps
Once connected, you can:
- Browse tables and schemas in the schema explorer
- Run SQL queries with autocomplete
- Create charts and visualizations
- Save queries for reuse
- Build dashboards
- Export results to CSV, JSON, or Markdown Navigate to the query editor and start exploring your self-hosted database.