nitro icon indicating copy to clipboard operation
nitro copied to clipboard

feat: coolify preset

Open justserdar opened this issue 1 year ago โ€ข 3 comments

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

โ“ Type of change

Docs and Preset for Coolify.

  • [ x ] โœจ New feature (a non-breaking change that adds functionality)
  • [ x ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)

๐Ÿ“š 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

  • [X] I have linked an issue or discussion.
  • [X] I have updated the documentation accordingly.

justserdar avatar Oct 01 '24 20:10 justserdar

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.

sandros94 avatar Oct 02 '24 10:10 sandros94

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.

pi0 avatar Oct 02 '24 11:10 pi0

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

  • [x] Append 'start' script.
  • [ ] Solution for handling the build output directory.

Docs:

  • [x] Steps to get started in Coolify using Nixpacks (server)
  • [ ] Steps to get started in Coolify using Nixpacks (static)
  • [ ] Steps to get started in Coolify using Docker (server/static)

Would love feedback/input.

justserdar avatar Oct 06 '24 13:10 justserdar