Nest: More docs for deployment

Created on 23 Apr 2018  路  17Comments  路  Source: nestjs/nest

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ ] Feature request
[ X] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Missing deployment process and setup production environments in documentation.

Expected behavior

More documentations for deployment process and setup production environment.

What is the motivation / use case for changing the behavior?

Every good framework in its documentation has a description how to the correct way setup production environment and setup deployment process.

question 馃檶

Most helpful comment

@weeco +1
Exactly, I don't think that it's supposed to be a part of the framework documentation. However, I have a plan to write a set of articles. One of them will cover deployment stuff for sure, promise. 馃檪

All 17 comments

The docs have it's own repository here: https://github.com/nestjs/docs.nestjs.com

Can you also explain what you'd expect for the deployment docs? Is it just about the environment variables for different environments or are you also talking about Dockerizing + deploying with kubernetes?

Even though I'd be interested in how Kamil would handle the deployment for his Nest applications, personally I don't believe it is supposed to be part of the framework documentation. There are many different deployment possibilities and the topic Docker + Kubernetes is possibly too expensive and also out of scope. On the other hand this framework is supposed to give you a clear direction on how to do things properly (which I love about NestJs), hence I can understand your request.

@weeco +1
Exactly, I don't think that it's supposed to be a part of the framework documentation. However, I have a plan to write a set of articles. One of them will cover deployment stuff for sure, promise. 馃檪

@kamilmysliwiec waiting for your promise

Need documentation for deployment process please

Yeah, I find myself struggling on this as well... I've really enjoyed developing my app in NestJS, but am finding things to be a little less rosy in regards to actually doing a production deployment of my app now..

When using TSC to perform a prod build, simply deploying dist isn't enough - as there are many node_module dependencies that one has to resolve... A possible workaround is to 'nest new' a new project up and then use those node modules in your hosted project, but of course this includes a lot of dev-centric deps, which is undesired...

I've also been considering rolling up the external dependencies into a bundle so that they can be part of the deployment package, but officially recommended guidance would be preferred to stumbling through.

I could write a little guide how to dockerize your application and how to deploy it in a dedicated server / vps running Linux. I think that would help most users here. I could tease kubernetes or server less even though either of these would be a bit out of scope in my oppinion (see my previous comment).

What do you think kamil?

I can probably help write some docs for deploying with Docker to ElasticBeanstalk on AWS (with or without CircleCI integration) as we are using a Nest server in production like that right now.

Yeah, I've been able to fumble through a deployment today with iisnode...

Essentially the process was to setup the output of dist as an application in IIS and then coerce the iisnode express example's web.config to match my app's routes.. From there, I had to hit it with a request and wait for an error - then npm install that dependency it was complaining about to my app's directory...

Still would like a more contained approach that didn't involve npm installing a bunch of dependencies, so I may still look at creating a bundle for all of those deps to ease the deployment process, as this service will be installed in a lot of client sites...

I wanted to write an article for a long time how I managed to create a monorepo (similar structure like #1060 ) using NestJS and deploy all packages to NPM, Dockerhub and LXD using Circle CI with my LXDHub project and also how I deployed it in the end on an Openstack VM and Azure VM. It is a huge topic and really hard to write down, but I try to push it if you're interested in that.

But what it all boils down to is: just use Docker(-compose). It will solve all your CI / CD problems somehow ;)

Soooo is this "dockerized kubes deployment" documentation going to happen? 馃槃 <3

I believe adding a documentation how to properly dockerize your application is enough. Then you can follow any kubernetes tutorial. Kubernetes doesn't care which technology under the hood is used as long as it runs inside of a docker container

Sweet! Looking forward to seeing the docs I'll start trying to dockerize myself until then

Dockerizing Nest is just like with any other Node application.
For development usage you'd just use nodemon with the legacy flag, so it can restart your server inside the docker container.
For production usage, I'd suggest googling how to properly build a docker image for a Nodejs app.

I'm still having troubles deploying my application to production. I'm having troubles in the build process. I think that it's required to have this process of deployment and build into the documentation, my humble opinion.

However, I have a plan to write a set of articles. One of them will cover deployment stuff for sure, promise.

@kamilmysliwiec have any of these articles been written? I think people are looking for an article like this:

https://dev.to/antogarand/deploying-a-nestjs-application-on-aws-beanstalk-4no1

That covers the fact that the package.json isn't included in the dist folder, and that it needs to get copied to the server, and production dependencies need to be installed-

Yeah, I find myself struggling on this as well... I've really enjoyed developing my app in NestJS, but am finding things to be a little less rosy in regards to actually doing a production deployment of my app now..

When using TSC to perform a prod build, simply deploying dist isn't enough - as there are many node_module dependencies that one has to resolve... A possible workaround is to 'nest new' a new project up and then use those node modules in your hosted project, but of course this includes a lot of dev-centric deps, which is undesired...

I've also been considering rolling up the external dependencies into a bundle so that they can be part of the deployment package, but officially recommended guidance would be preferred to stumbling through.

@kamilmysliwiec This is the primary reason why deployment docs are needed, I don't use docker or kubernetes, I'm still learning about it (we all at different stages of knowledge so forgive me that I'll learn eventually), After being drawn to this project from the ng-conf talk, working through some quirks of the framework, I'm struggling to deploy my app because I assumed dist was enough and now there's no docs :|

Please, docs for bare minimum would be amazing.

Just for reference

Angular:

Screenshot from 2019-07-26 00-08-45

Vue:

Screenshot from 2019-07-26 00-12-31

Nuxt:

Screenshot from 2019-07-26 00-13-24

Next:

Screenshot from 2019-07-26 00-14-19

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings