Nx: [DISCUSSION]: deploying an NX monorepo, CI/CD and documentation.

Created on 17 Oct 2020  路  8Comments  路  Source: nrwl/nx

Description


Having a read though the documentation there seems to be a real lack of examples and best practices on how to deploy your shiny new project and searching around for articles is a sea of outdated or hacky looking workarounds.

I would like to discuss how the community is deploying their repos and some best practice input from the Dev team and then either help write some docs or at least curate them into an article. I am really enjoying developing with nx but I find the docs lacking.

A secondary thing would be some examples of CI/CD configs for the main providers for different configs.

Lastly, is there a NestJS version of these angular.json deployers

Suggested areas of documentation

preparing to deploy

  • environment files or .env for api url
  • deployment types

    • docker

    • ui from backend

    • ui and backend separately

Configuring the deployer

running your first deploy

NX CICD Pipeline by example

question / discussion

All 8 comments

Hello! Any update on this?

No, I was hoping for some discussion with the community. I have got mine deploying via circle ci to heroku for the nestjs api and netlify for the angular front end but it feels a little hacky.

Thank you for your response. I tried deploying my express app to Heroku but the main issue is that we don't have a package.json for the built Node apps and that's really hard to maintain especially with Docker. Hopefully, we'll see better documentation soon since I have not yet seen a real world deployable and stable solution to tackle this issue.

My current approach is to send the whole NX project to Heroku and then Taylor the build and deploy npm commands to only deploy the nest backend

I also do the same thing but it's just CI/CD commands stacked together just to deploy and this whole process feels wrong for some reason because if any update and symlinks are added to the project, this whole chain won't work anymore and we have to write another stack of CI/CD. Hopefully, we find a real solution soon because this project has increased our productivity so much and it's such a shame if we cannot deploy stuff properly.

If I'm not mistaken, a similar pain point was raised in this issue https://github.com/nrwl/nx/issues/3817

Yes. Unfortunately that's the same issue.

I too am trying to use nx with Heroku and running into issues. So far im trying to follow this guide which basically involves building docker first then pushing to heroku: https://hackmd.io/US2eky6lSMecuHxegFZCbA?view but it doesnt seem to work for me

Just a quick edit I was able to follow a suggestion on this discussion: https://github.com/nrwl/nx/issues/1777 which mentioned using https://github.com/vercel/ncc which seems to work pretty well

Was this page helpful?
0 / 5 - 0 ratings