Skip to content

Rename default tenant in single-tenant instance #15

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
benoitblanc opened this issue Mar 27, 2025 · 9 comments
Closed

Rename default tenant in single-tenant instance #15

benoitblanc opened this issue Mar 27, 2025 · 9 comments

Comments

@benoitblanc
Copy link
Member

Hi,

I was trying to deploy qwc-docker with a single tenant but I would like to set its name to something different than default.

I have set env var QWC_TENANT to mytenant. But I saw that having a tenant_name is one of conditions to consider multitenancy https://github.com/qwc-services/qwc-services-core/blob/master/qwc_services_core/tenant_handler.py#L25 so then I need to deal with TENANT_ACCESS_COOKIE_PATH and/or OVERRIDE_ACCESS_COOKIE_PATH and/or TENANT_PATH_PREFIX to be able to use qwc-services with renamed single tenant.

I finally set TENANT_PATH_PREFIX to '' and it seems to work fine.

I did not test the whole application but my first error when renaming the tenant name (only by setting QWC_TENANT) was at the login page. qwc-db-auth service can not load style file because url_for is prefixing static URL with JWT_ACCESS_COOKIE_PATH. (e.g try to access to /mytenant/style/style.css).

I was wondering some questions:

  • do we consider that renaming tenant with QWC_TENANT and having tenant_name is really a multitenancy case ?
  • is there another way to deal with default tenant renaming ?

Thanks for your inputs.

Benoît

@manisandro
Copy link
Member

Wouldn't it be sufficient to make DEFAULT_TENANT configurable by Env-var?

@benoitblanc
Copy link
Member Author

Indeed, I would say it is the simplest way. #16

Thanks

@benoitblanc
Copy link
Member Author

I have added a PR to set version to 1.4.5. Then I need to update all QWC Services to use this new version.

As I am not familiar with uv yet, I have seen that I have to run the following command to upgrade qwc-services-core version:

uv lock --upgrade-package qwc-services-core==1.4.5

Could you please confirm ? May we document this in the project ?

I will submit all the PRs then.

Thanks

@manisandro
Copy link
Member

Sorry seeing this now. You can use the justfile [1] and then in the dir of the service you want to update (say qwc-map-viewer), run

just upgrade-all

This will upgrade the uv.lock and the requirements.txt. Then, you can run just release vYYYY.MM.DD to set and tag a new version.

[1] upgrade-all

@benoitblanc
Copy link
Member Author

Thanks, I have started to do it more manually 😅 with uv lock --upgrade-package qwc-services-core, editing version in pyproject.toml and uv lock --upgrade-package qwc-map-viewer.

I will continue with your method with other services.

@benoitblanc
Copy link
Member Author

@manisandro I think I have submitted all the PRs to upgrade qwc-services-core to 1.4.5 by using just (and my commands in previous comment) in all the services.

Tags are not pushed, I could push them once PRs are merged in master/main. I will try to submit some other commands later in justfile which could be useful.

@manisandro
Copy link
Member

Thanks. On my part feel free to merge and tag!

@benoitblanc
Copy link
Member Author

I think all tags have been pushed.

@manisandro
Copy link
Member

Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants