-
Notifications
You must be signed in to change notification settings - Fork 110
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
dev-ml/ollama: a separate ollama user #210
Conversation
i had to do some tricky stuff i tried it in a vm it works fine now
i also recorded a quick demo in a vm 2024-07-10.00-53-38.mp4 |
Hi, thanks for your contributions, I do not know these GROUP_ID stuff, but greping |
Thank you I'll take a looksie |
125 was free in both guru and gentoo, I checked also pentoo and a few others. But I'm unaware if there is a proper convention around user and group ids. |
@MrRoy hi, can you please help here? |
I'm currently investigating this as part of a code review. |
Nice catch @vitaly-zdanevich Users and group IDs outside of the official ::gentoo repository need to use ID
Looking at other guru ebuilds, we find that only
|
It's written in the eclass documentations for
|
I changed them, I'll now check if it still works as intended |
It seems to work as intended if there any other issues please tell me 2024-07-10.19-17-56.mp4 |
acct-user/ollama/metadata.xml
Outdated
</maintainer> | ||
<use> | ||
<flag name="nvidia">Add support of nvidia</flag> | ||
<flag name="amd">Add support of amd</flag> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed here?
acct-group/ollama/metadata.xml
Outdated
<use> | ||
<flag name="nvidia">Add support of nvidia</flag> | ||
<flag name="amd">Add support of amd</flag> | ||
</use> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use
is for the ebuild, not for acct-group, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I'll sort it out rn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should i change the description or no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'll drop the description, I took a look at the other acct-user/group packages they didn't use a description tag
Ok, is it ready to merge? |
I think so everything works as intended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Commits to (official) Gentoo ebuild repositories should adhere to GLEP 66.
To do so without much headache, follow the GURU contribution guide (create an OpenPGP key, setup the repo's git config and commit via dev-util/pkgdev
).
And please change one package per commit, i.e.
acct-group/ollama: new package
acct-user/ollama: new package
dev-ml/ollama: support unprivileged ollama user
@@ -0,0 +1,9 @@ | |||
# Copyright 1999-2024 Gentoo Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright 1999-2024 Gentoo Authors | |
# Copyright 2024 Gentoo Authors |
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> | ||
<pkgmetadata> | ||
<maintainer type="person" proxied="yes"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the proxied
attribute.
|
||
DESCRIPTION="A user for ollama" | ||
ACCT_USER_ID=122 | ||
ACCT_USER_SHELL=/bin/false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line in favor of the default /sbin/nologin
.
ACCT_USER_ID=122 | ||
ACCT_USER_SHELL=/bin/false | ||
ACCT_USER_HOME=/usr/share/ollama | ||
ACCT_USER_HOME_PERMS=0755 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACCT_USER_HOME_PERMS=0755 | |
ACCT_USER_HOME_PERMS=0700 |
Seems to work correctly and follows the principle of least privilege :)
touch /var/log/ollama.log | ||
chown ollama:ollama /var/log/ollama.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this function below src_install
to reflect the correct phase function order and edit it like this
touch /var/log/ollama.log | |
chown ollama:ollama /var/log/ollama.log | |
touch /var/log/ollama.log || die | |
fowners ollama:ollama /var/log/ollama.log |
acct-group/ollama | ||
acct-user/ollama |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move these dependencies to RDEPEND
and also add them to IDEPEND
(because of fowners
in pkg_preinst
).
@@ -0,0 +1,15 @@ | |||
# Copyright 1999-2024 Gentoo Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright 1999-2024 Gentoo Authors | |
# Copyright 2024 Gentoo Authors |
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> | ||
<pkgmetadata> | ||
<maintainer type="person" proxied="yes"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<maintainer type="person" proxied="yes"> | |
<maintainer type="person"> |
This is not a proxy-maint package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the description
, use
and upstream
tags. These belong to dev-ml/ollama
, not to the user and group packages, like @vitaly-zdanevich pointed out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same applies here.
@vitaly-zdanevich Thanks for (mostly) applying my suggestions. It would have been nice to give @CreeperMain a chance to author these changes, though ;)
|
Thank you I'll keep that in mind next time |
Alright than I'm glad that a nonprivileged user was implemented into this package, should I close this pull request now? |
No need, it'll get closed automatically once ec9321f gets merged into |
@vitaly-zdanevich Hello, I played around with the ollama package recently but i noticed that ollama serve in /etc/init.d/ollama (the daemon) ran that command as root. So i decided per the official documentation https://github.com/ollama/ollama/blob/main/docs/linux.md to implement a separate ollama user, my reasoning for this was for sandboxing's sake. Because I'm new to writing ebuilds and largely inexperienced please if you are in the position to check whether the user id I used is already used by anything, it's a simple change if its already is use by some other package.
PS: Yes this is my second pull request I messed up the first one