-
Notifications
You must be signed in to change notification settings - Fork 0
Databases and Storage
NEXUS AI supports deployment-attached database services, standalone managed databases, external database connections, persistent filesystem volumes, and S3-compatible buckets. These are separate resource types with different lifecycle rules.
| Resource | Use it when |
|---|---|
| Deployment service | The database or cache should be provisioned beside a docker deployment |
| Standalone managed database | Several deployments need a separately managed database, or a cloud provider database is required |
| External DB source | You already have PostgreSQL/Supabase or another supported external database and want safe query/schema tools |
| Volume | The app needs a persistent filesystem path such as /data
|
| Bucket | The app uses object keys and an S3-compatible SDK |
Create services with a source deployment:
nexus deploy source \
--repo https://github.com/you/app.git \
--provider docker \
--services postgresql,redis \
--waitSupported sidecar types and conventional internal ports:
| Service | Internal hostname | Port |
|---|---|---|
| PostgreSQL | postgresql |
5432 |
| MySQL | mysql |
3306 |
| MongoDB | mongodb |
27017 |
| Redis | redis |
6379 |
NEXUS AI injects connection variables into the app and any configured worker. Use internal hostnames for container-to-service traffic, not published host ports.
Discover services later with:
nexus db services
nexus db services <deployment-name-or-id>Standalone databases can be NEXUS AI local databases or provider-backed managed services where the organization has configured AWS, Google Cloud, or Azure.
nexus managed-db list
nexus managed-db create app-db --engine postgres --local
nexus managed-db connection app-db
nexus managed-db attach app-db --deployment <deployment-id>
nexus managed-db query app-db "SELECT now()"Use nexus managed-db create --help for provider, engine, version, region, credential, and size options available in the installed CLI.
Attach/detach controls which deployment receives connection configuration. Redeploy after changing a database attachment.
For Cloud Run, App Runner, or Container Apps, request a supported managed database:
nexus deploy source \
--repo https://github.com/you/app.git \
--provider gcp_cloud_run \
--create-db postgres \
--db-region us-central1 \
--wait--services postgres and --create-db postgres converge on a managed database for cloud providers. On docker, --services creates a sidecar.
Deployment-service backups support PostgreSQL, MySQL, MongoDB, and Redis using engine-appropriate tools. Backups are organization scoped and tracked separately from deployment releases.
nexus db services app
nexus db backup <service-id>
nexus db backups <service-id>
nexus db backup-download <service-id> <backup-id> --out ./backup.dumpAdditional workflows:
# Upload an existing dump so NEXUS AI can restore it
nexus db backup-upload <service-id> ./backup.dump
# Restore in place (destructive to current data)
nexus db restore <service-id> <backup-id> --yes
# Restore into another compatible service in the same organization
nexus db restore-to <target-service-id> <backup-id> --yes
# Daily schedule
nexus db backup-schedule <service-id> --enableEngines must match for cross-service restore. Create a fresh backup before migrations, and test restores rather than assuming a backup is usable.
Standalone databases use snapshot commands:
nexus managed-db snapshot app-db
nexus managed-db snapshots app-db
nexus managed-db restore app-db --snapshot <snapshot-id> --name restored-dbStandalone restore creates a new database instead of overwriting the source.
The dashboard and MCP API can register external database sources, inspect schema, preview SQL, execute approved queries, and propose database fixes from error logs.
For Supabase PostgreSQL, use the Session Pooler on port 5432. The username normally follows postgres.<project-ref> and SSL mode should be require.
Safety controls include:
- one SQL statement per request;
- read-only transactions for SELECT;
- statement timeouts and row caps;
- confirmation for data-changing queries;
- blocking dangerous operations such as
DROP DATABASE, role creation, server-side program execution, or unbounded UPDATE/DELETE; - audit records that avoid storing raw SQL where possible.
Schema-aware AI proposals must still be reviewed before apply.
Volumes are organization-scoped filesystem storage attached to one deployment at a mount path.
nexus volume create app-data --display-name "App data"
nexus volume attach <volume-id> <deployment-id> --mount /data
nexus deploy redeploy <deployment-id> --wait
nexus volume refresh-usage <volume-id>Key behavior:
- attach/detach requires redeployment to change the running container;
- data survives container replacement and deployment restart;
- a volume must be detached before deletion;
- multiple replicas should not assume a volume behaves like a distributed filesystem;
- use buckets for horizontally scaled shared object data.
Buckets are organization-scoped object storage and can attach to multiple deployments.
nexus bucket create user-uploads
nexus bucket attach <bucket-id> <deployment-id>
nexus deploy redeploy <deployment-id> --waitManage objects:
nexus bucket files <bucket-id> --prefix uploads/
nexus bucket upload <bucket-id> ./report.pdf --key reports/report.pdf
nexus bucket download <bucket-id> reports/report.pdf --out ./report.pdf
nexus bucket rm <bucket-id> reports/report.pdf --yesRetrieve or rotate scoped credentials:
nexus bucket credentials <bucket-id>
nexus bucket rotate-credentials <bucket-id> --yesCredential reads and rotation are sensitive and audit logged. Redeploy every attached application after rotation so it receives the new S3_* variables.
Before deleting a database, volume, bucket, or deployment:
- list attachments and dependent deployments;
- create and download a recent backup when data matters;
- verify the restore procedure;
- detach the resource where required;
- understand whether provider-side resources will also be deleted;
- use
--yesonly after confirming the resolved resource ID.