-
Notifications
You must be signed in to change notification settings - Fork 51
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
docker-setup with Multi-Tree support fails to start the web container #510
Comments
Ok, I think that's a problem with our compose examples for multi-tree. Please try adding |
Thank you! With the I'm still a bit lost on how to continue from here. Opening the service in the browser gives me the login form, but I don't have a user yet. The user registration doesn't work and from the documentation I know that it can't work in multi-tree mode and I should disable it. The "first-run wizard" that's mentioned in the documentation is not shown. https://www.grampsweb.org/multi-tree/ says that users are tied to trees. If I want to create a tree, it is recommended to do that via the web api. But to do that, I need a JWT, which I get by authorizing as a user. That's a chicken and egg issue for me :D |
It should show the first run wizard. Please check the container logs. |
These are the logs of a fresh gramps instance that I started and opened in the browser:
So it seems like the database is not created correctly. |
Did you specify
|
I had not specified I now added this to the compose.yml: I then ran
I tried the command with and without the |
Next try: docker-compose run --entrypoint="" --rm -w /app/src grampsweb python3 -m gramps_webapi --config /app/config/config.cfg user migrate Thanks for bearing with me 😅 |
Ha, that's weird because it means creating the user worked, but fetching a token didn't work, and the Javascript functions for both operations use the same variables for the username and password. If you can start over and monitor the API calls in the browser dev console, that would be useful. Perhaps it's some weird special character issue, but I wouldn't see why... |
I just realized I didn't mention this before: I tried the default compose.yml for a single-tree setup and there everything worked out of the box, with the same username and password that I tried for the multi-tree setup. So I don't think it's a special character issue. |
Ok I think I know what's happening. In the multi-tree setup, the first run wizard creates a site admin, not a tree owner. But the site admin does not have a tree. You would first have to create a tree, or to assign the admin to a specific tree. In a multi-tenant setup, the site admin might anyway just be a service account that is used to create new trees and manage trees, without being itself associated with a tree. Of course, the UI for that doesn't make sense right now and needs to be changed - I'll open an issue in the frontend repo. Your next step is to create a new tree via the API by posting to |
(Thanks by the way for the detailed logs, very helpful!) |
For posting to Do I need to copy the token from the web session, for creating the first tree? I expected that the call to |
Right 🤦♂️ I take that back:
Your logs showed you got a 403 permission denied when trying to fetch a token with username/password, which should work regardless of tree. I will try to reproduce this later, there must be a bug somewhere. |
@strombringer did you manage to create a tree via the api endpoint? |
@Corepex no, I didn't. After the last test in April, I switched to single-tree mode and the setup wizard worked for that. I'll try again when a bugfix is available, though it's not high priority for me. |
FYI, I am running a multi tree setup and creating new trees via the API all the time, so there could be a bug, but it's not obvious to me what it is as I'm not affected by it. |
@DavidMStraub services:
grampsweb: &grampsweb
image: ghcr.io/gramps-project/grampsweb:v24.10.0
restart: always
ports:
- "80:5000" # host:docker
environment:
GRAMPSWEB_TREE: "*" # will create a new tree if not exists
GUNICORN_NUM_WORKERS: 2
GRAMPSWEB_SECRET_KEY: "__top_secret__"
GRAMPSWEB_REGISTRATION_DISABLED: "True"
GRAMPSWEB_MEDIA_PREFIX_TREE: "True"
GRAMPSWEB_CELERY_CONFIG__broker_url: "redis://grampsweb_redis:6379/0"
GRAMPSWEB_CELERY_CONFIG__result_backend: "redis://grampsweb_redis:6379/0"
GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://grampsweb_redis:6379/1
depends_on:
- grampsweb_redis
volumes:
- gramps_users:/app/users # persist user database
- gramps_index:/app/indexdir # persist search index
- gramps_thumb_cache:/app/thumbnail_cache # persist thumbnails
- gramps_cache:/app/cache # persist export and report caches
- gramps_secret:/app/secret # persist flask secret
- gramps_db:/root/.gramps/grampsdb # persist Gramps database
- gramps_media:/app/media # persist media files
- gramps_tmp:/tmp
grampsweb_celery:
<<: *grampsweb # YAML merge key copying the entire grampsweb service config
ports: []
container_name: grampsweb_celery
depends_on:
- grampsweb_redis
command: celery -A gramps_webapi.celery worker --loglevel=INFO --concurrency=2
grampsweb_redis:
image: docker.io/library/redis:7.2.4-alpine
container_name: grampsweb_redis
restart: always
volumes:
gramps_users:
gramps_index:
gramps_thumb_cache:
gramps_cache:
gramps_secret:
gramps_db:
gramps_media:
gramps_tmp:
{"password":"pwd","email":"[email protected]","full_name":"fn"}
{"error": {"code": 403, "message": "Forbidden"}} Could you share your steps setting up a multi tree instance? python3 -m gramps_webapi --config /app/config/config.cfg user add --role 5 username password it had the same outcome |
Ok, the error is issued by this function: https://github.com/gramps-project/gramps-web-api/blob/master/gramps_webapi/api/util.py#L590-L592. So the prolem is that it's not possible to fetch a token with an account that doesn't have a tree ID, but the admin account created in the multi-tree setup doesn't have one. I have to think about what the best solution is. Maybe to create a new tree for the admin. The solution for you right now is to use the command line as you did, but add the |
Thanks for the tip ⚡, this got the ball rolling (verbose notes for future reference) : 1️⃣First I've created an empty directory:
2️⃣And created a new user with that same treeid:
That resulted in an internal error 500 firing for the first
Looked into the container:
The result was only two files:
3️⃣I've copied those files to my container using 🏆🍾 Thank you! |
You can use |
I'm trying to setup a Multi-Tree installation with Docker and followed the instructions at https://www.grampsweb.org/Deployment/, but starting the grampsweb container fails with this error message:
I'm using the docker-compose file linked in the documentation, with minor changes:
Port, SECRET_KEY, TREE and MEDIA_PREFIX_TREE are changed
My understanding from the documentation is,
https://myhost:13000
to setup the server administrator accountIs my understanding wrong and I overlooked something? Where should I have setup the tree, that's mentioned in the error message?
Thanks in advance for the support!
The text was updated successfully, but these errors were encountered: