Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: coolify preset #2767

Draft
wants to merge 3 commits into
base: v2
Choose a base branch
from
Draft

Conversation

justserdar
Copy link

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

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

@justserdar justserdar requested a review from pi0 as a code owner October 1, 2024 20:05
@pi0 pi0 marked this pull request as draft October 1, 2024 21:26
@sandros94
Copy link

sandros94 commented Oct 2, 2024

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
Copy link
Member

pi0 commented Oct 2, 2024

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. preset and docs for coolify #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.

playground/nitro.config.ts Outdated Show resolved Hide resolved
@justserdar
Copy link
Author

justserdar commented Oct 6, 2024

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

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

Docs:

  • 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.


## Set up your web app

In your project, set Nitro preset to `coolify`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, we should instruct the build commands to use SERVER_PRESET=coolify environment variable.


```js
export default {
nitro: {
Copy link
Member

@pi0 pi0 Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This config works in nuxt only + it is boilerplate (ie: provider fixed in project)

@pi0 pi0 changed the title Coolify preset feat: coolify preset Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants