Question

How to use App Platform when all components are in a singe repository

Posted October 10, 2020 1.3k views
DigitalOcean App Platform

I have an app where the API app and front-end app are in subfolders of the project repository because I use Docker Compose when developing. When I tried to add to the App Platform, I received the error that it could not detect how to build and didn’t let me give it any guidance.

Apps Platform seems like exactly what I need for this project, but I don’t like the idea of splitting the project up into 2 repositories (would break Compose, etc.). Can I reorganize my project to make it auto-detectable, or use the App Spec YAML in way that lets me keep my project in one repository?

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

@drewsign 👋

You can do this today using doctl and a custom app spec, but we don’t expose a way to do it in the UI just yet.

We have a sample monorepo app and spec here: https://github.com/digitalocean/sample-monorepo/blob/main/.do/app.yaml — Notably, the source_dir field on component specs can be used to reference a sub-directory in your repo.

You can submit the spec using:

doctl apps create --spec .do/app.yaml

Check out the spec reference for more about what can be configured through it.

  • The github link leads to a 404. I’m also looking to test out the app platform and would benefit from this example.

  • Hey @snormoredo, I’ve been trying to get this to work with a flask app nested in a monorepo and an app spec based on the link you provided.

    When deploying, the build seems to be working fine (all requirements installed, the built Docker image is pushed to the container registry), but my deploy always breaks after that with a ‘bash: gunicorn: command not found’ error.

    I copied the flask app into its own separate repo and was able to push that successfully to the App Platform, which makes me think this is specifically related to the monorepo setup.

    I’ve been stuck on this for a week now, and not getting any help from DO support. Any thoughts or tips?

    backend-staging | 14:53:39        Successfully installed Flask-1.1.2 Flask-Admin-1.5.7 Flask-Cors-3.0.9 Flask-SQLAlchemy-2.4.4 Jinja2-2.11.2 Mako-1.1.3 MarkupSafe-1.1.1 SQLAlchemy-1.3.22 WTForms-2.3.3 Werkzeug-1.0.1 alembic-1.4.3 certifi-2020.12.5 chardet-4.0.0 click-7.1.2 gunicorn-20.0.4 idna-2.10 itsdangerous-1.1.0 marshmallow-3.10.0 psycopg2-binary-2.8.6 python-dateutil-2.8.1 python-editor-1.0.4 python-http-client-3.3.1 requests-2.25.1 sendgrid-6.5.0 six-1.15.0 starkbank-ecdsa-1.1.0 urllib3-1.26.2
    backend-staging | 14:53:52 
    backend-staging | 14:53:52 => Uploading the built Docker image to the container registry
    backend-staging | 14:58:29 bash: gunicorn: command not found