hyperonym / basaran

Basaran is an open-source alternative to the OpenAI text completion API. It provides a compatible streaming API for your Hugging Face Transformers-based text generation models.
MIT License
1.29k stars 80 forks source link

build(snap): add snap packaging #150

Closed artivis closed 1 year ago

artivis commented 1 year ago

This PR adds snap packaging which (eventually) allows to easily install the app on dozens on Linux distro,

sudo snap install basaran

Run it then with,

$ basaran
start listening on 0.0.0.0:8080

The snap sets by default,

They all can be overloaded by the user through the usual environment variables.

Together with the packaging comes a new workflow that runs the packaging and push the artifacts to the store. This being said, you would have to create an account on the store and generate a access token.

Note that I could only test it on my laptop (no discrete gpu) and thus may require some tweaking.

codecov-commenter commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (6647066) 94.54% compared to head (34f67b2) 94.54%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #150 +/- ## ======================================= Coverage 94.54% 94.54% ======================================= Files 7 7 Lines 330 330 ======================================= Hits 312 312 Misses 18 18 ``` Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperonym). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperonym)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

fardeon commented 1 year ago

Thank @artivis, this looks great! We will find a Linux machine with discrete GPUs to test it.

artivis commented 1 year ago

Thanks for the quick review. I fixed the default branch in the snap ci workflow.

peakji commented 1 year ago

Hi @artivis ! Sorry to bother you again, but we need some help regarding snap.

After this PR is merged, we did some cleanup to only build and publish on release. The first run of the workflow went smoothly, and I could see the package uploaded and waiting for release on the snapcraft web interface. However, the workflow has been failing since then, and we're a bit lost...

This is our first time to publish a package on snapcraft, and we appreciate your guidance! 🙏

artivis commented 1 year ago

Hey there no problem.

Looking at the failing job, it seems that you had a heavy hand while cleaning up. Indeed the variable "$grade" isn't defined anymore (unbound varible).

This being said, my bad for not giving you more context for this PR.

Snaps come with a whole release management system baked in. One can manage several releases of one's app depending on the status of the development stable/candidate/beta/edge.

To publish to stable/candidate, the snap grade must be marked as 'stable'. That's what's happening here on: the snap is marked as 'stable' solely on tags, therefore preventing to push ongoing developments to the stable/candidate releases.

Similarly, the ci originally built the snap for all change pushed to the master branch, but would push on-going development (no-tag) to edge and tags to candidate. The promotions edge->beta & candidate->stable are then expected to be done manually on the store web page after rigorous testing ;)

That's really one release management schema, others are definitely possible.

If you have further questions, feel free to ping me :)

peakji commented 1 year ago

Thank you for such a detailed response!

Looking at the failing job, it seems that you had a heavy hand while cleaning up. Indeed the variable "$grade" isn't defined anymore (unbound varible).

Oh I see! I thought the grade in snapcraft.yaml can be used as a variable. 😂

The promotions edge->beta & candidate->stable are then expected to be done manually on the store web page after rigorous testing ;)

This design is great! I'll test it on the web interface. We plan to gradually optimize our release process after implementing the chat API.