nebari-dev / jhub-apps

Application creator and general launcher for JupyterHub
https://jhub-apps.nebari.dev/
BSD 3-Clause "New" or "Revised" License
27 stars 12 forks source link

Deploy app from git repository #445

Closed aktech closed 2 months ago

aktech commented 3 months ago

Reference Issues or PRs

Implements #422

This PR implements an endpoint named: /app-config-from-git/ this will be used by frontend to fetch the app deployment details from the git repository. This would let the frontend pre-fill the app creation form. After this frontend will make the app deployment request on the same /server endpoint with git repo's extra details.

What does this implement/fix?

Put a x in the boxes that apply

Testing

Documentation

Access-centered content checklist

Text styling

Non-text content

Any other comments?

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jhub-apps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 7:30pm
jhub-apps-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2024 7:30pm
aktech commented 2 months ago

Thanks a lot for the thorough review @krassowski

the cloned repository is deleted after the configuration is fetched

Yes, correct.

this uses jhsingle-native-proxy implementation for cloning thus we have less control over it and get more reliant on jhsingle-native-proxy which is not actively developed as of lately

Yes, correct. It's not actively maintained at the moment, but we rely on it heavily at the moment. The plan is we may either replace it with some other solution (maybe oauth2proxy) or fork and maintain jhsingle-native-proxy in future, but when? we don't know yet, depends on priorities.

it means that the spawn time will increase, especially for larger repositories

Yep, the best we can do is to clone with depth=1, which we already do.

it may make it harder to support private repositories as we would need to pass the PAT down to the spawner too

It's kind of supported via: https://@github.com/username/repo.git (not that it's a priority in the PR)

In jupyter-gallery we would already have the repository cloned; in a future PR we may want to consider exposing an endpoint that allows to create an app directly using the config provided in the body of a POST request. This is why I am suggesting to rename AppConfigFromGit to AppConfigFromCondaProject or AppConfigFromConfigFile if the url attribute is not needed (as then we could reuse the response model for the logic of that proposed future endpoint).

That makes sense.

Implicit assumptions as of this PR:

1 repository = 1 app

Not necessarily, as config_directory argument can be specified for various apps, like example:

repositories are public

The support for private repository isn't priority in the PR but it can be supported via specifying the url like: https://@github.com/username/repo.git

repositories are small enough to not timeout during spawn and to not timeout when fetching the config

Yes, correct