Closed SSmale closed 2 years ago
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
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
Is there any example of guidance here by nrwl on how to deploy these apps?
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
If we missed this issue please reply to keep it active.
a reply from a maintainer with their recommendations would be great
any update on it?
Some best practices or some basic guidance would be nice here :)
I ended up deploying the front-end to Netlify and the back-end to Heroku off of the same repo.
Basically, configure two different commands in package.json
to build stuff. For me, the front-end command was this:
"build:ranker:prod": "node node_modules/nx/bin/nx build ranker --configuration=production --prod"
The back-end APIs were:
"serve:api:prod": "node node_modules/nx/bin/nx serve api"
Depending on where you host your FE or BE, you may have to edit your boot files (e.g., for Heroku it was Procfile
) to start the app.
Is there any documentation with an example how to deploy Nextjs application under NX workspace to Netlify?
I had the same, question, I really love the structure of NX, and i think is a impressive tool, but I'm trying to include three different front-end projects, which I am have the deploys through circleci, directly to S3, using the feature static sites from AWS, the three front-end projects are working with similar components and look and feel, all projects are reactJS applications, but is really necessary to include the continues integration. @johnaagudelo0820
Same problem over here โ๏ธI try to provision different systems via gitlab ci, and it would be awesome to have some best practice documented. All I can, I'm able to find, seems kinda hacky and unreliable. If there's someone interested, I would be happy to help and share my experiences.
Same here! I was able to setup CD to Kubernetes with Helmfile and GitHub Actions. If there is a place for it, I would be happy to share.
A description and a link to a gist/repo would be great!
I copy-pasted the relevant files and part of the workspace.json into a gist. Will provide a full repo when I find some time. ๐
https://gist.github.com/steinroe/4628bcf86c8ca24279b2a57663088659
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
It would be good for a maintainer to weigh in and give their opinion
On 20 Jul 2021, at 01:04, github-actions[bot] @.***> wrote:
๏ปฟ This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
โ You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I had the same problem and solved it with a custom repository for every app distribution/drop. With Github Action i push the subfolder on the repos and can use heroku pipelines for CI/Review Apps and Github Actions for Lint/Test.
The problem with heroku specific files like Procfile or the engine in package.json are solved with a custom executor: https://gist.github.com/egorderg/122a6a93d225b958bf870979d1174710 In the buildTarget you can reference your original build (i've changed it from build to build-raw). Currently the executor copies the Procfile, overrides scripts in package.json and sets the nodeVersion in engines.
Maybe this solution helps people who are struggling with the same problems.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
This issue is still relevant and should still be open.
+1
Agreed with the above. I'm having a lot of trouble running nx affected deploy
with the --parallel
flag enabled. For context, the deploy includes FE (sync build output with S3) and BE (build and push docker image to ECR + update ECS). In my research, I see some articles and blog posts about deploying FE apps but there seems to be quite a void for deploying with Docker and ECS.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
Up
@cristianPerez
Hi CristanPerez. Do you find any solution about your scenario? i want to migrate to nx workspace but i thing I'll have the same problem you have, how to config CI CD to each of my app to diferents domains inside AWS S3.
We gave up on nx alone and instead use npm workspaces + nx (buildable + publishable). External packages are installed using npm workspace for each project which ensured each projects package.json contains all external dependencies needed. This gets copied to dist folder on build as well as packaged during cd.
This is the only way I have found it to be sane. Anything else without a tailed package.json for each deployable project will bloat your deployment with a bunch of dependencies that application doesn't need.
You will find a decent amount of close tickets like this with no clear direction from the Nx team which is disappointing but its open source so ..... Even Nx's own projects have their own package.json with their dependencies. See https://github.com/nrwl/nx/tree/master/packages/tao, https://github.com/nrwl/nx/tree/master/packages/node and others.
In short, npm/yarn workspaces + Nx (buildable + publishable) will make your life easier than just Nx.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! ๐
I just containerize nest applications with the "@nx-tools/nx-docker:build" executer. Then i deploy that container to aws ecs. Its works really well! This will deploy any app i want with docker. The only requirement is that it needs to have some sort of server, like express or i use nestjs. You can also use nginx, but at that point, just use netlify.
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
Configuring the deployer
running your first deploy
NX CICD Pipeline by example