PostgreSQL
Deploy PostgreSQL 17 with persistent storage — one command, auto-generated credentials
Ink deploys PostgreSQL 17 as a container service with a persistent volume. Your agent provisions the database using the postgres template, and Ink returns generated credentials plus a connection string.
Deploying
Your agent uses the template_deploy MCP tool:
template_deploy(
"template": "postgres",
"name": "my-db"
){
"services": [object Object],
"outputs": [object Object]
}Or via the CLI:
ink template deploy postgres --name my-dbAuto-generated credentials
| Variable | Value |
|---|---|
POSTGRES_USER | postgres |
POSTGRES_PASSWORD | Auto-generated at deploy time |
POSTGRES_DB | postgres |
Passwords are randomly generated. The agent receives them as outputs — no manual password management required.
Persistent storage
A persistent volume is attached at /var/lib/postgresql/data (10 Gi default). Data survives container restarts and redeployments.
Connecting
After deployment, template_deploy returns a connection_string output in the format:
postgresql://user:pass@hostname:5432/dbnameThe response also includes service endpoints. Sibling services in the same project can use the returned internal endpoint; external clients should use the returned connection string and generated password.
Client libraries
Node.js
npm install pgimport pg from 'pg';
const pool = new pg.Pool({
connectionString: process.env.DATABASE_URL,
});
const result = await pool.query('SELECT * FROM users');Python
pip install psycopg2-binaryimport os
import psycopg2
conn = psycopg2.connect(os.environ["DATABASE_URL"])
cursor = conn.cursor()
cursor.execute("SELECT * FROM users")Specs
| Property | Value |
|---|---|
| Engine | PostgreSQL 17 |
| Image | postgres:17 |
| Port | 5432 |
| Volume | /var/lib/postgresql/data |
| Default Memory | 512Mi |
| Default vCPU | 0.5 |