Skip to main content

PostgreSQL Demo

PostgreSQL Demo logo
PostgreSQL Demov1.0.0

Deploys PostgreSQL and creates a sample database with seed data

A minimal UIS template that deploys PostgreSQL and creates a sample tasks table with seed data. Shows the full uis template flow from registry to deployed, configured service. Use this to verify your UIS setup or as a starting point for your own stack templates.

Install:uis template install postgresql-demo
Maintainers: terchristerchris
ENVIRONMENT

What gets set up

When you install this template, the following are configured for you:

Provided to your cluster
  • Open-source relational database
    • Databasedemo_db
    • Userdemo_app
    • Port-forwardhost.docker.internal:35432
    • Namespacedefault
    • Helm chartbitnami/postgresql
Schema applied to the database

Install

Install this stack into your local UIS environment. Provisions the services defined above and seeds them with any init data.

Then run:

uis template install postgresql-demo

Verify the database

uis connect postgresql demo_db

Inside psql, run: SELECT * FROM tasks; You should see 3 seeded rows. Type \q to exit.

ARCHITECTURE

Architecture

These diagrams are auto-generated from the template's metadata. Click any diagram to enlarge.

Overview

Template README

A minimal UIS stack template that deploys PostgreSQL and creates a sample database with seed data. Use it to verify your UIS setup, or as a starting point for your own UIS stack templates.

What it deploys

  • PostgreSQL (via UIS) — deployed to the cluster if not already running

What it configures

  • A per-app user (derived from app_name param)
  • A database (from database_name param)
  • The init SQL — creates a tasks table with 3 seed rows

Before you start

This template uses UIS. Verify the UIS provision-host container is running:

docker ps --filter name=uis-provision-host --format '{{.Status}}'

You should see Up X minutes. If not, start UIS from the urbalurba-infrastructure repo. Inside DCT (devcontainer-toolbox v1.7.34 or later) you also have the uis shim, which lets you run UIS commands directly.

Install

uis template install postgresql-demo

This works from inside the DCT devcontainer (via the uis shim), from the host (via ./uis from the urbalurba-infrastructure repo), and from inside the UIS provision-host. Same command, three contexts.

With custom params:

uis template install postgresql-demo --param app_name=myapp --param database_name=mydb

What you get

After install, uis template install returns JSON with connection details (passwords are randomly generated — your actual values will be different):

{
"status": "ok",
"service": "postgresql",
"local": {
"host": "host.docker.internal",
"port": 35432,
"database_url": "postgresql://demo_app:Xa7mP9...@host.docker.internal:35432/demo_db"
},
"cluster": {
"host": "postgresql.default.svc.cluster.local",
"port": 5432
},
"database": "demo_db",
"username": "demo_app",
"password": "Xa7mP9...",
"secret_name": "<repo>-db",
"secret_namespace": "<repo>"
}

The local URL works from your DCT devcontainer (Flask, psql, etc.) via the host port-forward. The cluster connection is what K8s pods use — UIS also creates a Kubernetes Secret in your app's namespace so deployments can read it via secretKeyRef.

Verify it worked

The simplest way to inspect the seeded data:

uis connect postgresql demo_db

Inside psql:

SELECT * FROM tasks;
\q

You should see 3 rows. Re-running uis template install postgresql-demo is safe — it detects the existing database and returns already_configured.

Try this with

Once PostgreSQL is running and you've installed this demo template, scaffold a Flask app on top with the consumer-side template:

dev-template python-basic-webserver-database

That template's dev-template-configure step will create its own per-app database (separate from demo_db) and write DATABASE_URL to .env for local dev. Run the app with uv run python app/app.py and curl /tasks to see the full producer/consumer chain working end-to-end.

Extending this template

This template is the minimum viable example. To build your own:

  1. Copy this folder as a starting point
  2. Edit template-info.yaml — change id, name, add more services to provides
  3. Add more init files in config/ (SQL, Authentik blueprints, Grafana dashboards)
  4. Reference UIS stacks (like observability) in provides.stacks to include multi-service stacks

See the contributor docs for the full template authoring guide.