Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add digitalocean-labs/do-app-platform-skills --skill "postgres"
Install specific skill from multi-skill repository
# Description
Configure DigitalOcean Managed Postgres with bindable variables or schema isolation. Use when setting up databases, creating users, managing permissions, configuring multi-tenant schemas, or troubleshooting database connectivity on App Platform.
# SKILL.md
name: postgres
version: 1.0.0
min_doctl_version: "1.82.0"
description: Configure DigitalOcean Managed Postgres with bindable variables or schema isolation. Use when setting up databases, creating users, managing permissions, configuring multi-tenant schemas, or troubleshooting database connectivity on App Platform.
related_skills: [designer, networking]
deprecated: false
Postgres Skill
Configure DigitalOcean Managed Postgres databases with proper security isolation and production-ready defaults.
Quick Decision
Need multiple isolated schemas in one database?
βββ YES β Path B (Schema Isolation)
βββ NO β Path A (Bindable Variables) β
RECOMMENDED
Path A: Bindable Variables (Recommended)
Use when: Single app per database, standard CRUD applications.
Quick Start
# 1. Create cluster + user via doctl (DO stores password internally)
doctl databases create my-app-db --engine pg --region nyc3 --size db-s-1vcpu-2gb
CLUSTER_ID=$(doctl databases list --format ID,Name --no-header | grep my-app-db | awk '{print $1}')
doctl databases db create $CLUSTER_ID myappdb
doctl databases user create $CLUSTER_ID myappuser
# 2. Grant permissions (REQUIRED - users have no access by default!)
# Run: scripts/grant_permissions.sql as doadmin
# 3. Reference in app spec
# .do/app.yaml
databases:
- name: db
engine: PG
production: true
cluster_name: my-app-db
db_name: myappdb
db_user: myappuser
services:
- name: api
envs:
- key: DATABASE_URL
scope: RUN_TIME
value: ${db.DATABASE_URL}
Full guide: See path-a-bindable-vars.md
Path B: Schema Isolation
Use when: Multi-tenant SaaS, multiple apps sharing one cluster, schema-level isolation needed.
Quick Start
# Hands-free setup (requires gh CLI)
./scripts/secure_setup.sh \
--admin-url "$ADMIN_URL" \
--app-name myapp \
--schema myapp \
--repo owner/repo
Password flows directly to GitHub Secrets β never displayed.
Full guide: See path-b-schema-isolation.md
Available Bindable Variables
| Variable | Example |
|---|---|
${db.DATABASE_URL} |
postgresql://user:pass@host:25060/db?sslmode=require |
${db.HOSTNAME} |
my-db-do-user-123.db.ondigitalocean.com |
${db.PORT} |
25060 |
${db.USERNAME} |
myappuser |
${db.PASSWORD} |
(auto-populated) |
${db.DATABASE} |
myappdb |
${db.CA_CERT} |
(certificate content) |
Scripts
| Script | Purpose |
|---|---|
scripts/secure_setup.sh |
Hands-free Path B setup with GitHub Secrets |
scripts/create_schema_user.py |
Create isolated schema + user |
scripts/list_schemas_users.py |
Audit existing schemas/users |
scripts/generate_connection_string.py |
Build connection strings |
Reference Files
- path-a-bindable-vars.md β Full Path A workflow, connection pools, multi-app setup
- path-b-schema-isolation.md β Full Path B workflow, multi-tenant patterns
- orm-configurations.md β Prisma, SQLAlchemy, Drizzle, TypeORM configs
- database-migrations.md β Alembic, Prisma Migrate, Drizzle Migrate
- doctl-reference.md β All
doctl databasescommands - troubleshooting.md β Common errors and fixes
- bundled-scripts.md β Script usage documentation
Common Issues (Quick Fixes)
| Error | Fix |
|---|---|
| "permission denied for schema" | Run permission SQL as doadmin |
| "relation does not exist" | Check search_path or use schema-qualified names |
| "too many connections" | Create connection pool via doctl |
| "SSL connection required" | Add ?sslmode=require to connection string |
| Bindable vars not populated | Verify production: true and names match exactly |
Full troubleshooting: See troubleshooting.md
Integration with Other Skills
- β designer: Add database block to app spec
- β deployment: GitHub Actions workflow with DATABASE_URL secret
- β devcontainers: Local Postgres with prod parity
- β troubleshooting: Debug container for connectivity testing
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.