Use the database in the example app spec
complete
P
Phillip Stromberg
In https://docs.digitalocean.com/products/app-platform/reference/app-spec/ you define a Postgres database called postgres-db, but never reference it anywhere in the services. Is the
databases: - name:
field supposed to be the hostname? Should I put "postgres-db" in my "DB_HOST" environment variable for my app? Should I put "postgres-db:25060" or whatever if the managed database doesn't use the standard port? It doesn't seem to be working with the normal public DNS hostname of my database so I guess it's not that.Dan Finn
marked this post as
complete
Kate Erickson
Thank you for taking the time to share your feedback. You were right that the app spec defined a database but didn’t show how a service uses it, and that the docs didn’t clearly tie the database name to bindable variable usage.
The docs have been updated and the app spec example now shows a service using the database (e.g. web-service env vars like DB_HOST and DATABASE_URL set to bindable variables), and a new section explains the pattern. The docs also clarify that the database name is the component name for bindable variables (e.g. ${postgres-db.HOSTNAME}), not the hostname.
Thanks again for pointing out this gap. We appreciate it!