Templates

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:

Tool Call
(
  : "postgres",
  : "my-db"
)
{
  "services": [object Object],
  "outputs": [object Object]
}

Or via the CLI:

ink template deploy postgres --name my-db

Auto-generated credentials

VariableValue
POSTGRES_USERpostgres
POSTGRES_PASSWORDAuto-generated at deploy time
POSTGRES_DBpostgres

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/dbname

The 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 pg
import 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-binary
import os
import psycopg2

conn = psycopg2.connect(os.environ["DATABASE_URL"])
cursor = conn.cursor()
cursor.execute("SELECT * FROM users")

Specs

PropertyValue
EnginePostgreSQL 17
Imagepostgres:17
Port5432
Volume/var/lib/postgresql/data
Default Memory512Mi
Default vCPU0.5

On this page