Question

Why is the Managed MongoDB showing as "failed to build" in App Platform?

Posted January 7, 2022 102 views
Initial Server SetupDigitalOcean App PlatformDigitalOcean Managed MongoDB Database

I’m trying to deploy an App based on a docker image that I have. I need to connect it to an external mongo database so I set up a managed MongoDb and then added it as a component of the App.

Unfortunately, in the component settings all I see is:

Connection details are unavailable while the database is being provisioned.

In the deployment logs all I see is this:

Error: Database Not Available
Component Issues

db-wibble failed to build

I’ve tried to use the ${db-wibble.DATABASE_URL} env variable as the connection string for my app, but I don’t think it’s even getting as far as setting up the database (whatever that entails, as I can already connect to the managed DB directly). So the app never starts because it can’t connect to the database.

When adding the database component I recall seeing a warning that doing so would add a doapps user to the database, but no such user has been created.

What’s going on? Why does the App Platform seem to be broken here, and how can I fix this?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello @jhannapearce ,

Currently, DATABASE_URL (or any other database bind variables) is not available during build. We plan on supporting build time access to databases soon though we don’t have any ETA.

Please change the scope of the Database variables to

databases:
- engine: PG
name: db
num_nodes: 1
size: db-s-dev-database
version: "12"
name: portal
region: nyc
services:
- dockerfile_path: Dockerfile
envs:
- key: DATABASE_URL
scope: RUN_TIME
value: ${db.JDBC_DATABASE_URL}
- key: DATABASE_USERNAME
scope: RUN_TIME
value: ${db.USERNAME}
- key: DATABASE_PASSWORD
scope: RUN_TIME
value: ${db.PASSWORD}

This should work! Hope this helps!

Cheers,
Sri Charan