There’s two feature I would like to see in App Platform. To resume it’s a good integration with NX workspace/monorepo.

  • Fetch only once npm dependencies for all components in a monorepo.
    I’m using a NX monorepo for a Angular and multiple NestJS projects. I see that during build/deploy in App Platform, npm dependencies are fetched for each components which impact build/deploy performances and reduce a lot build minutes.

  • Tell App Platform to build/deploy only some components.
    All components are actually rebuilt/redeployed on each push, is it possible to tell App Platform to not rebuild/redeploy some component in some conditions ? Nx provide a nice feature which allow us to only run command over affected projects it could be awesome to use it in App Platform.

Thanks !

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

Hi @scorsi, thank you for the feedback! I have logged it in our internal feature tracker.

For the second suggestion, how would you want to select which components to rebuild?

  • Hi ! Thanks for your answer.
    What if there’s a rebuild_cmd which should exit with status 0 in case of success and other return status is for false ?
    Or maybe with the doctl like doctl apps create-deployment {app_id} --components=front,api-gateway,service-user ? :)

  • Hi !

    I came back to that feature, do you have any news about it ? Can it see the day ?

  • Hello @kamaln7 do you have any news about a monorepository integration ? I’m looking forward for this.

    • Hi @scorsi! Sorry for the delay. We still have this on the roadmap, but I don’t have a time estimate unfortunately.

      You can use the source_dir option to start the build in a subdirectory (see this example). With source_dir, the directory you choose will act as the “root directory” for the build. That way, yarn install or npm install will only be run for the component that you specify. You will still have access to the entirety of your git repo during the build, so you can use them in your build command. However, the runtime image will only contain the contents of the subdirectory and not the whole repo—I’m not sure if that will work with NX/Lerna.

      If you do try that out, please let me know how it goes.

      • This wont work as there’s only one package.json file with all dependencies for each apps and libs (Angular/Nest/…). Also /apps/api can depends on /libs/feature-user for exemple.
        And the output directory is /dist/apps/api (we can move the directory in /apps/api/dist but this is not supposed to work like that.
        The main issue is : we have 10+ apps in the monorepo and for each of them, dependencies are fetched (which take a lot of time) but it’s unnecessary as all dependencies are shared between all apps.

        I supposed that the only one working solution is the one we choose: we build/test in GitHub Actions, building and pushing Docker images to DOCR and tell DOAP to use them.
        So only affected apps by a commit are rebuilt and redeployed to DOAP. Our CI/CD is optimized and ran only once for the whole monorepo and all apps. We gain general buildtime, reduced from 100+ minutes in DOAP for a small change (10+ minutes for each 10+ apps) to only 5 minutes for GHA->DOCR->DOAP.

        • Hi, I have the same issue. Did you solve to deploy a nx monorepo with backend and frontend?

          • Hello, yes we found a solution but we finally leave DOAP and DO in general.
            In a GitHub Actions pipeline we git pull a « myproject-output » repository in /dist, then we build only affected apps (we added a step to delete all files in the folder to be sure). Then we commit/push the changes on dist to the other repository. We did connect DOAP to that output repository with sourcedir for each built app. You will have to « generatePackageJson » in your Nx file to have a package.json next to the output of you app. Warning, some dependencies may be missing in the generated package so you will have to add them. We achieve that using a nx plug-in we specially created.
            Initially, we did push the node
            modules to the output repository instead to add dependencies to the package json file to simplify the process but DOAP don’t handle it with source_dir… (to edit the package json and add your reps, pretty simple: open the generated package json file, open the main package json file, copy the version of the dependencies you want from the main to the generated and rewrite the file, it’s json so very easy to do in js)