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

Self-hosted not unrestricted​ #6641

Open
1 task
deckerjulian opened this issue Apr 19, 2024 · 23 comments
Open
1 task

Self-hosted not unrestricted​ #6641

deckerjulian opened this issue Apr 19, 2024 · 23 comments

Comments

@deckerjulian
Copy link

What happened?

The Github README names:
"Self-Host
Begin with Docker to deploy your own feature-rich, unrestricted version of AFFiNE. Our team is diligently updating to the latest version. For more information on how to self-host AFFiNE, please refer to our documentation."

but after deploying the self-hosted Version and login I see a "Free" Label beside the Username having all restrictions like 10GB and only 3 members per Workspace. How to get the unrestricted self-hosted Version?

Distribution version

macOS x64 (Intel)

What browsers are you seeing the problem on if you're using web version?

No response

Are you self-hosting?

  • Yes

Relevant log output

No response

Anything else?

No response

@affine-issue-bot
Copy link

Issue Status: 🆕 *Untriaged

*🆕 Untriaged

The team has not yet reviewed the issue. We usually do it within one business day.
Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md

This is an automatic reply by the bot.

@pengx17
Copy link
Collaborator

pengx17 commented Apr 24, 2024

We will provide more options to config these settings in the future.

@StudyingLover
Copy link

When will provide more options? 😭 We deploy self-hosted version. My team is more than 10 people, but pro user only invite 10 people to a workspace.

@Macbook-Specter
Copy link

Hello, how to lift the 10GB restriction?
I have self-host and limit storage.

@StudyingLover
Copy link

@Macbook-Specter #6156 (comment) Maybe it useful for you. You can change storageQuota I think. (btw, I never try)

@Macbook-Specter
Copy link

@StudyingLover Thank you very much

@deckerjulian
Copy link
Author

deckerjulian commented May 20, 2024

Hey,

for everyone wanted to change limitations on a self-hosted instance until there's an update in the future to do this with a gui:

  • Enter Docker PostgreSQL Server
    docker exec -it affine_postgres psql -U affine
  • List possible feature id's
    select id, feature, configs from features;
  • List users with id's
    select * from users;
  • List features assigned to users
    select * from user_features;
  • assigne for example 'pro_plan_v1' to the user
    feature_id = YOUR FEATURE ID YOU WANT TO ASSIGN (get it from 'List possible feature id's')
    user_id = YOUR USER ID YOU WANT TO CHANGE (get it from 'List users with id's')
    update user_features set feature_id = 35 where user_id = 'xxxxxx-xxxx-xxxxxxx-xxxx-xxxxxxxxxxxxxx';

@deckerjulian
Copy link
Author

For everyone need more than the pro plan limitations:
It is also possible to update the feature configs to change limitations like members for e.x.

update features set configs = '{"name":"Pro","blobLimit":104857600,"storageQuota":107374182400,"historyPeriod":2592000000,"memberLimit":100,"copilotActionLimit":10}' where id = 14;

Just restart the docker container afterwards. Now the limit of the members should be 100.

@lennon101
Copy link

update features set configs = '{"name":"Pro","blobLimit":104857600,"storageQuota":107374182400,"historyPeriod":2592000000,"memberLimit":100,"copilotActionLimit":10}' where id = 14;

Thannks for this, but where do I run this command? Can you please provide a little more detail? Is there a docker compose environment variable that I can add to edit this setting? or needs to be done via the terminal only?

@deckerjulian
Copy link
Author

update features set configs = '{"name":"Pro","blobLimit":104857600,"storageQuota":107374182400,"historyPeriod":2592000000,"memberLimit":100,"copilotActionLimit":10}' where id = 14;

Thannks for this, but where do I run this command? Can you please provide a little more detail? Is there a docker compose environment variable that I can add to edit this setting? or needs to be done via the terminal only?

Hey there,
changes have to be done in the PostgreSQL Database. Access is possible with the commands mentioned above:

Enter Docker PostgreSQL Server
docker exec -it affine_postgres psql -U affine
List possible feature id's
select id, feature, configs from features;

@svenseeberg
Copy link

svenseeberg commented Sep 15, 2024

update features set configs = '{"name":"Pro","blobLimit":104857600,"storageQuota":107374182400,"historyPeriod":2592000000,"memberLimit":100,"copilotActionLimit":10}' where id = 14;

Thannks for this, but where do I run this command? Can you please provide a little more detail? Is there a docker compose environment variable that I can add to edit this setting? or needs to be done via the terminal only?

As the back end is not Open Source, this is AFAICT an infringement of the Terms of Service, you need to agree to. They specifically state in section 8:

Circumvent, disable, or otherwise interfere with security-related features of the Services, including features that prevent or restrict the use or copying of any Content or enforce limitations on the use of the Services and/or the Content contained therein.

Can someone confirm this?

@ccrvlh
Copy link

ccrvlh commented Oct 10, 2024

Hm, @svenseeberg good catch. Can't confirm from a legal perspective, but seems workspace quota fits this use case
as it is a feature that enforces limitations.

I just wish the description of the project was different.

Privacy first, open-source, customizable and ready to use.

Doesn't seem to be a precise description of the project, nor the repository.

@kendofriendo
Copy link

update features set configs = '{"name":"Pro","blobLimit":104857600,"storageQuota":107374182400,"historyPeriod":2592000000,"memberLimit":100,"copilotActionLimit":10}' where id = 14;

Thannks for this, but where do I run this command? Can you please provide a little more detail? Is there a docker compose environment variable that I can add to edit this setting? or needs to be done via the terminal only?

As the back end is not Open Source, this is AFAICT an infringement of the Terms of Service, you need to agree to. They specifically state in section 8:

Circumvent, disable, or otherwise interfere with security-related features of the Services, including features that prevent or restrict the use or copying of any Content or enforce limitations on the use of the Services and/or the Content contained therein.

Can someone confirm this?

That license also states:

This EE License applies only to the part of this Software that is not
distributed as part of AFFiNE Community Edition

And at the bottom of the distro:

AFFiNE Community Edition (CE) is the current available version, it's free for self-host under the MIT license.

Thus, the restriction does not apply here since it is included with the community edition. The restriction is, imo, clearly intended to prevent subscribers of the enterprise edition, or users of the "basic" edition from manually editing the backend to remove restrictions without paying for them.

An admin at on their community site says in response to asking about self-hosted file-size limits:

With the initial versions there are some limits on the accounts, I believe they are similar to the Pro account in terms of restrictions.

Before the full administration panel or other management settings come out you may have luck editing some of the config files.

@kendofriendo
Copy link

Also, you may want to use the 'insert' command instead of 'update', since this will replace the features you already have; i.e. if you use it to assign yourself the pro license, you will no longer be an admin. If you want to remain admin and add features to your account:

insert into user_features (id, user_id, feature_id, reason, created_at, expired_at, activated) values (3, 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx', 16, 'selfhost', DEFAULT, DEFAULT, 't');

Change the 3 to be n+1 where n is the current highest id in the user_features table. Change the 16 to be the id of whatever feature_id you're trying to add. 'selfhost' can be whatever, it's an arbitrary field for the reason column. Make sure the last one is 't' to make sure the feature is activated.

@snmnr
Copy link

snmnr commented Nov 15, 2024

  • update user_features set feature_id = 35 where user_id = 'xxxxxx-xxxx-xxxxxxx-xxxx-xxxxxxxxxxxxxx';

I can use this method to change the configuration, the capacity limit can see the change, but the upload limit is still 10M

@4lador
Copy link

4lador commented Dec 28, 2024

Also, you may want to use the 'insert' command instead of 'update', since this will replace the features you already have; i.e. if you use it to assign yourself the pro license, you will no longer be an admin. If you want to remain admin and add features to your account:

insert into user_features (id, user_id, feature_id, reason, created_at, expired_at, activated) values (3, 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx', 16, 'selfhost', DEFAULT, DEFAULT, 't');

Change the 3 to be n+1 where n is the current highest id in the user_features table. Change the 16 to be the id of whatever feature_id you're trying to add. 'selfhost' can be whatever, it's an arbitrary field for the reason column. Make sure the last one is 't' to make sure the feature is activated.

I tried that but it don't work, what i did was creating a new user in admin panel (then i was sure to still have my admin user) and then UPDATING the user_features and then it works

@gamedevkirk
Copy link

gamedevkirk commented Jan 6, 2025

That license also states:

This EE License applies only to the part of this Software that is not
distributed as part of AFFiNE Community Edition

And at the bottom of the distro:

AFFiNE Community Edition (CE) is the current available version, it's free for self-host under the MIT license.

Thus, the restriction does not apply here since it is included with the community edition. The restriction is, imo, clearly intended to prevent subscribers of the enterprise edition, or users of the "basic" edition from manually editing the backend to remove restrictions without paying for them.

An admin at on their community site says in response to asking about self-hosted file-size limits:

With the initial versions there are some limits on the accounts, I believe they are similar to the Pro account in terms of restrictions.
Before the full administration panel or other management settings come out you may have luck editing some of the config files.

It seems like there are a lot of assumptions being made here, which I suspect may be contrary to the author's intent. Specifically:

This EE License applies only to the part of this Software that is not distributed as part of AFFiNE Community Edition

This is very misleading on its own. The very next line of text tells you to read the TOS for details, where it states:

All content that resides under the "packages/backend/server" directory of this repository, if that directory exists, is licensed under the license defined in "packages/backend/server/LICENSE".

Based on this wording, the "community edition" seems to exclude all of its server components from the MIT license.

This seems extra tricky because we can't reasonably identify a line in the sand after spinning up the docker containers. Bypassing the application-server logic and modifying the DB directly could still be considered out of bounds, IMO, since all the database deployment, management, etc. lives within the restricted directory.

INAL, but this is enough of a gray area for me to nope-out until someone with authority makes an official statement green-lighting this. Call me overly cautious.


Edit: This thread has a comment from one of the maintainers which indicates the user limit is intentional, and additional users will require paid licenses.

#6299

According to our expectations, the selfhost version should have unlimited file storage, and a reasonable maximum number of collaborators. We haven't decided on the number limit yet, but it may be 3 or higher. (enough for personal use)
In addition, we are also preparing a paid selfhost plan for enterprises or studios, which can support more collaborators and we can make some profits.

I also came across the following thread where the maintainer indicates that commercial use under an unlicensed self-hosted version is prohibited.

#6646

All code except the backend is under the MIT license, you can make any changes you want. The backend code is also MIT for personal use, but you can't use it for busniess.

Funnily enough, this isn't even called out in the license document for the backend.
The backend license instead links to a separate TOS on their website, which they can change whenever they'd like (very cool). I'm not even sure this is permitted under GitHub's TOS, but don't quote me on that.

https://affine.pro/terms#subscription

We reserve the right, in our sole discretion, to make changes or modifications to these Legal Terms from time to time.

It's only once you follow the breadcrumbs through all 3 licensing documents do you actually find the prohibition on commercial-use.

Calling this an open-source project is extremely generous, when the entire backend is decidedly not.

@batchor
Copy link

batchor commented Jan 17, 2025

@pengx17 @himself65

Despite it being 2025, this issue remains unresolved. It's awkward for self-hosted services to have such limitation.

It would not be that hard to lift the restriction and make it configurable.

@batchor
Copy link

batchor commented Jan 17, 2025

Everybody here, try https://github.com/outline/outline. This would be a more transparent alternative that we can trust on.

@batchor
Copy link

batchor commented Jan 17, 2025

When will provide more options? 😭 We deploy self-hosted version. My team is more than 10 people, but pro user only invite 10 people to a workspace.

Maybe 10 years later. It's already 2025.

@himself65
Copy link
Contributor

@pengx17 @himself65

Despite it being 2025, this issue remains unresolved. It's awkward for self-hosted services to have such limitation.

It would not be that hard to lift the restriction and make it configurable.

Thanks for ping me, but I haven't maintain this repo for ~2 years. but IMO I think it's expected that a company need earn money and have some restrictions in any ways

@Felitendo
Copy link

@pengx17 @himself65

Despite it being 2025, this issue remains unresolved. It's awkward for self-hosted services to have such limitation.

It would not be that hard to lift the restriction and make it configurable.

You can get around these weird limitations via editing the database. Just search on their discord for "phpmyadmin" or "database" and you will find tutorials on that. If you want, you can message me on Discord then I'll walk you through: @Felitendo

@batchor
Copy link

batchor commented Jan 18, 2025

@pengx17 @himself65
Despite it being 2025, this issue remains unresolved. It's awkward for self-hosted services to have such limitation.
It would not be that hard to lift the restriction and make it configurable.

You can get around these weird limitations via editing the database. Just search on their discord for "phpmyadmin" or "database" and you will find tutorials on that. If you want, you can message me on Discord then I'll walk you through: @Felitendo

Is there any way hacking into the source code to change the quota limitation?

Editing the database does impact future users. I have to edit the database whenever there are new users coming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 *Untriaged
Development

No branches or pull requests