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

User storage quota enforcement #841

Closed
justinwb opened this issue Oct 4, 2018 · 21 comments
Closed

User storage quota enforcement #841

justinwb opened this issue Oct 4, 2018 · 21 comments
Assignees
Labels
inrupt-sprint Issues that Inrupt plans to work on in near future
Milestone

Comments

@justinwb
Copy link
Contributor

justinwb commented Oct 4, 2018

Need ability to do in-line enforcement of per user storage quotas.

@justinwb justinwb added this to To do in Node Solid Server via automation Oct 4, 2018
@melvincarvalho
Copy link
Contributor

So, this can happen at the OS level, at the node application level, or with a process sitting in the middle. A combination of 3 of these can happen too.

We should perhaps work on some generic helper scripts to analyze existing pods, in a way that gives a sys admin the stats they need, without compromising any user privacy.

@melvincarvalho
Copy link
Contributor

Examples

  • A script to find out the number of accounts on a pod.

  • A script to find out the total, mean, median, min and max disk usage on a pod, without revealing the username

  • A script to count the number of accounts above accounts above a certain quota

This could lead to setting sensible limits, based on the server capabilities, and leading to defaults that can be communicated to the user.

In a previous system, we had a little bar on the dashboard, showing your total disk allowance, and how full you are. That could work quite well.

@kjetilk kjetilk self-assigned this Oct 17, 2018
@kjetilk kjetilk moved this from To do to In progress in Node Solid Server Oct 17, 2018
@kjetilk
Copy link
Member

kjetilk commented Oct 17, 2018

Starting on this now, but since we are now just doing urgent things, my plan is to record a quota in the users database, and find something that works like UNIX du, and show the user a bar with their allowance, and then do something in the write operations to stop them from exceeding it.

@melvincarvalho
Copy link
Contributor

And excellent start. Can we do this in RDF?

@csarven
Copy link
Member

csarven commented Oct 17, 2018

One way to generalise this issue would be to have server-centric resources that can include desired content.

@kjetilk
Copy link
Member

kjetilk commented Oct 17, 2018

Oh, yes, @csarven . But right now, we're not looking to generalize, that's for later, we're just fighting fires now :-)

@kjetilk
Copy link
Member

kjetilk commented Oct 17, 2018

Let me see, @melvincarvalho !

@melvincarvalho
Copy link
Contributor

melvincarvalho commented Oct 17, 2018

<#me>  solid : quotaMax    1000000 # bytes
<#me>  solid : balancerRemaining   500000 # bytes

Could be roughly what we need.

It's also close to how I've modeled payments, so we could at some point integrate payemnts and quotas, is why I ask ...

EDIT : our previous PHP servers had a working quota bar on the user dashboards, so that might provide some insights.

@kjetilk
Copy link
Member

kjetilk commented Oct 17, 2018

Ah, great!

But that should not be writeable to the user, so where do I store it? Somewhere in settings, with an ACL that grants only read access?

But how we go for MBs as the smallest unit of quota?

@melvincarvalho
Copy link
Contributor

@kjetilk where is user specific stuff written?

Note : it doesnt have to be STORED in RDF, but it can still be modeled in RDF.

Yeah I guess we have a posix vocab already, I wonder if there's something reusable there like blocks. Getting down to the byte level would be cool, but how wide is the int that stores it?

@kjetilk
Copy link
Member

kjetilk commented Oct 17, 2018

Yeah, but I figured if is stored as RDF, I can do it right away, otherwise you'd need to file a feature request. :-)

So, the obvious place to store it in the current arch is in the users part of the key-value store and implement it in the UserAccount class, which is what I started doing. But it is certainly also an option to store in a file in settings along with prefs.ttl et al... I don't know what would be involved to do that, but I'll check it out. I hope you don't mind me taking the path of least resistance right now :-) That path will not be taken frequently, once we get head above water.

@melvincarvalho
Copy link
Contributor

I hope you don't mind me taking the path of least resistance right now

Of course!

Any future unexpected reuse is a bonus.

I suggest writing out the design before diving in, would be useful.

So, the obvious place to store it in the current arch is in the users part of the key-value store and implement it in the UserAccount class, which is what I started doing

Yes, so we need an ephemeral value showing how much disk is left.

And we need either a server wide quota limit, or a per user quota limit, or a default than can be upped (say for different tiered usage)

@melvincarvalho
Copy link
Contributor

Just sprung to mind. @megoth did a cool thing yesterday where he created a file that he could read, but not write to (in his own space). Perhaps this is the path to creating system files.

We have a file in /profile/ something like quota.ttl and set the acl to read only so only the system can write to it. Just an idea (thinking outside the box).

@melvincarvalho
Copy link
Contributor

melvincarvalho commented Oct 17, 2018

profile probably the wrong place for it`

maybe .system or .well-known/solid/

@kjetilk
Copy link
Member

kjetilk commented Oct 17, 2018

Yes, that was what I had in mind. But settings seems even better.

So, I found the posix-stat, which has size, but I would have preferred a datatype, e.g.

<#me> solid:nvmQuota "25"^^ex:megabyte .

@dmitrizagidulin
Copy link
Contributor

created a file that he could read, but not write to (in his own space).

That seems.. problematic :) Are we really going to store files over which the user has no control, in their data space, DRM-style?

@dmitrizagidulin
Copy link
Contributor

Hmm. On second thought, I guess we do need to store system-controlled data eventually. (To record the author, access logs, etc.) Never mind :)

@megoth
Copy link
Contributor

megoth commented Oct 18, 2018

Does it need to be stored in their data space though? We could manage a separate data space where system-controlled data are stored, couldn't we? Just so that we don't mix system-controller and user-controller files.

@kjetilk kjetilk added inrupt-planning Issues that Inrupt will consider when planning development cycles inrupt-sprint Issues that Inrupt plans to work on in near future and removed inrupt-planning Issues that Inrupt will consider when planning development cycles labels Nov 2, 2018
@kjetilk kjetilk added this to To do in NSS-5.0.0 via automation Nov 6, 2018
@kjetilk kjetilk moved this from To do to In progress in NSS-5.0.0 Nov 6, 2018
@kjetilk kjetilk added this to the 5.0.0 milestone Nov 6, 2018
@kjetilk kjetilk moved this from In progress to Needs review in NSS-5.0.0 Nov 8, 2018
@kjetilk kjetilk moved this from In progress to Needs review in Node Solid Server Nov 9, 2018
@kjetilk kjetilk moved this from Needs review to Reviewer approved in Node Solid Server Nov 12, 2018
@kjetilk
Copy link
Member

kjetilk commented Nov 12, 2018

Given the review in #911, this now only relies on solid/vocab#35

@kjetilk kjetilk moved this from Needs review to Reviewer approved in NSS-5.0.0 Nov 12, 2018
@Ryuno-Ki
Copy link

Yeah I guess we have a posix vocab already, I wonder if there's something reusable there like blocks. Getting down to the byte level would be cool, but how wide is the int that stores it?

Something I've learned while putting Gentoo on a Raspberry Pi: There's aa difference between size (in bytes) and number of inodes (in an ext4 filesystem).

That is, du (iirc) can still report free space while du -i tells you that your disk is full. I can look up details if you need. Maybe another issue? :-)

@kjetilk
Copy link
Member

kjetilk commented Nov 15, 2018

That is, du (iirc) can still report free space while du -i tells you that your disk is full. I can look up details if you need.

That's not necessary. It uses https://www.npmjs.com/package/get-folder-size , we take what we get from there.

@kjetilk kjetilk moved this from Reviewer approved to Released in Node Solid Server Nov 20, 2018
@kjetilk kjetilk moved this from Reviewer approved to Done in NSS-5.0.0 Nov 20, 2018
@kjetilk kjetilk closed this as completed Nov 27, 2018
Node Solid Server automation moved this from Released to Done Nov 27, 2018
@bourgeoa bourgeoa removed this from Done in NSS-5.0.0 Apr 26, 2022
@bourgeoa bourgeoa removed this from Done in Node Solid Server Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inrupt-sprint Issues that Inrupt plans to work on in near future
Projects
None yet
Development

No branches or pull requests

7 participants