nitrojs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.build
MIT License
6.16k stars 507 forks source link

feat: coolify preset #2767

Open justserdar opened 1 month ago

justserdar commented 1 month ago

A Nitro Coolify preset to standardise and improve security when deploying to Coolify. Attached issue 2762.

โ“ Type of change

Docs and Preset for Coolify.

๐Ÿ“š Description

As discussed earlier over multiple channels with pi0 this is the right step moving forward. Requesting feedback, the preset now correctly adds the start script to the output package.json.

๐Ÿ“ Checklist

sandros94 commented 1 month ago

Currently I wouldn't call this a Coolify preset but rather a Nixpacks preset, since it has more to do with the latter compared to Coolify.

In particular, because if someone during a Coolify deployment picks a different Build Pack, this preset will be just useless or might become counterproductive in future versions. image

To add onto this, since we are talking to a dedicated Nixpacks preset, we could create a dedicated nixpacks.toml or nixpacks.json configuration file solely for proper Nitro/Nuxt deployments. Coping into the final image only the required folders and files (eg: .output).

While this is still not as optimized Dockerfile+Alpine images, it is still an improvement. With a downside that I still have no idea how to handle additional folders like content from @nuxt/content.

pi0 commented 1 month ago

Thanks for your pull-request dear @justserdar and feedback @sandros94.

Few notes:

  1. Please read nitro core principles in detail i have tried to explain.
  2. 2762 is requires nitro + "coolify" recommended deployment method regardless of details. nixpacks/decker could be another preset we extend from but it is a detail.

  3. We still have to find a way to deploy build output directory. Not project root. Build output is generated from framework output. nuxt or nuxt content generated their artifacts is within this directory.
justserdar commented 3 weeks ago

As we take this step by step, I feel the PR is currently at the point of: Preset:

Docs:

Would love feedback/input.