amplication / amplication

🔥🔥🔥 The Only Production-Ready AI-Powered Backend Code Generation
https://amplication.com
Other
15.07k stars 1.47k forks source link

Add Health Check(s) to @amplication/server #2192

Closed timothy-amplication closed 2 years ago

timothy-amplication commented 2 years ago

It's good practice to include a health check with your services. This is specifically important when deploying to systems like Kubernetes where it can handle traffic routing based on healthy endpoints/services.

NestJS has this already figured out and provides a set of Health Checks available.

Some health-checks @amplication/server could benefit from is...

  1. HttpHealthIndicator - A basic HTTP endpoint to report that the server is listening on a port, running, and accepting requests.
  2. TypeOrmHealthIndicator / SequelizeHealthIndicator - Reports that the server is connected to external database(s) - Useful in case the server can no longer connect to the DB and Kubernetes can stop routing traffic to the service.
  3. DiskHealthIndicator - Reports when Disk Space for a specific volume/mount is low - Could be useful for Amplication - maybe not?
mshidlov commented 2 years ago

@timothy-amplication, this looks great. I added it to Amplication board and milestone 0.11.2.

As for the HttpHealthIndicator in the docs, it looks like it performs health checks on an external endpoint, and for the DB connection, we are using Prisma and not TypeORM\Sequelize.

A basic HTTP endpoint to report that the server is listening on a port, running, and accepting requests is what we need. So no additional 3rd party library is required, just an endpoint that returns HTTP 204 (empty response).

We added to the generated app a few weeks ago exactly those endpoints. please look on it here.

What do you think will be a good solution for it?

timothy-amplication commented 2 years ago

@mshidlov Let me do a little bit more research on this topic (specific to the NestJS ecosystem and their best-practices) and get back to you on what I'd think a good solution is. I'll most likely scope this out after https://github.com/amplication/amplication/issues/2165 and https://github.com/amplication/amplication/issues/2164 are completed.

yuval-hazaz commented 2 years ago

@mshidlov is this still open? would you like to move forward with the approach we implemented in the generated app?

mshidlov commented 2 years ago

@yuval-hazaz yes this is still open and yes we can continue with the approach we implemented in the generated app

rizwan-io commented 2 years ago

Hey, @souravjain540 Can you please assign this issue to me?

souravjain540 commented 2 years ago

Sure! @rizdev99.

souravjain540 commented 2 years ago

@rizdev99 are you working on it?

rizwan-io commented 2 years ago

yes @souravjain540 , I'm still working on it. I am not able to find my way through it. If someone else is up for this then you can unassign me from this issue. I might need to level up my skills

yuval-hazaz commented 2 years ago

@rizdev99 thanks for your efforts! let us know if you still want to work on it, and we will have someone to help you moving forward

rizwan-io commented 2 years ago

thanks @yuval-hazaz I know it's been a lot of time for this small issue. I have joined the discord channel so I'll be looking over there for help. Also, I'll try to commit the changes by this weekend, If not I am not able to do so then I'll unassign myself and will pass this opportunity to someone else

rizwan-io commented 2 years ago

i unassigned myself as im not able to proceed thank you

fosa-ij commented 2 years ago

Hi, good day. so I'm looking to contribute to this project but need to know the exact skills required for this project, as I'm not so sure.

nya1 commented 2 years ago

Hi, good day. so I'm looking to contribute to this project but need to know the exact skills required for this project, as I'm not so sure.

Hello, you can checkout the CONTRIBUTING.md file to learn more about the tech stack used by Amplication, I think a knowledge of NestJS and Typescript is needed. If the issue is still up for grabs I would gladly work on it.

fosa-ij commented 2 years ago

@nya1 okay, thanks a lot I appreciate. Seems I might have to look elsewhere as I have no knowledge of either skill I'm focused on MERN stack.