-
Notifications
You must be signed in to change notification settings - Fork 11
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
No such file or directory: 'jupyterhub-announcement-cookie-secret' #12
Comments
You need to generate a cookie secret and put it at the expected location. Something like |
Hello rcthomas. Thank you for your hints. The location of the tornado's cookie_secret for jupyterhub, in my case, is:
But in your file
And the location of this file is:
So which one could be the location of the
Thank you again for your help. |
I think |
Thanks again rcthomas. For the moment I am not successful in making this service to work. After your latest message I did the following, without success. Maybe you could tell me what I am doing wrong:
After this, I am still getting Options where I may be wrong:
I appreciate all your help and patiente. Only If you could provide me with a little bit more of light in this issue... PS: I also tried putting Regards I am wondering why the |
The |
Thanks to rcthomas suggestions, I managed to fix the issue about the cookie secret and now the service is started (as a hub managed service).
The logs for the jupyterhub pod are next:
Any ideas? Thank you. |
Can you post your hub's
|
Hello rcthomas, thanks again. In my jupyterhub I have these configured services in the config.yaml file used by the helm chart:
As you can see, I just now, as you suggested, added the load_roles data. Unfortunately I am still not able to acces the web UI of the service from the jupyterhub services menu. The logs are exactly the same as in my previous post. Any other ideas? Thanks again once more. |
Following the example found here (for a managed service named service-notebook): ... I modified the config.yaml as next:
Still I am getting:
|
I'll need to recreate the same kind of setup and that'll take a little time here, hopefully I can come back to you later in the week. |
I just started up JupyterHub in a Docker container, with the hub managing the service and it seemed to be just fine. I compared my log to yours and I don't understand your logs. If I do something like omit the cookie secret (causing the announcement service to crash on startup) then I can replicate a 503 just like you get because the proxy can't find it. But I see messages in your log that indicate the service started up OK. In mine, the crash is obvious from the log. I also don't see your hub saying it's adding routes to your proxy like Dockerfile:
And the jupyterhub_config.py:
This ran just fine with With the cookie secret initialized how I mentioned before. What's in your |
Hello rcthomas, thank you again for taking your time to try to find a solution. What I can see from your Dockerfile is that you are using the jupyterhub image that is specific for simple docker containers, whereas in my case I am running jupyterhub in a kubernetes cluster. For running jupyterhub in a kubernetes cluster, the image you need to use is: instead of Some of the paths are different between these 2 images. For example, the working directory in In a k8s cluster the proxy is running in a separate pod, not in the hub pod itself. Overall seems that you service is only compatible with jupyterhub running in a simple docker container, but no in a kubernetes cluster. I will continue searching for a solution, and in case I find it I will be happy to share here. Thank you (again). |
Hmmm, no, I don't buy that. My production hub is running in a k8s cluster (Rancher) and it's just fine. In that deployment the hub, proxy, announcement service, and everything are in their own separate pods. Why don't you try running the announcement service in a separate pod? I was only trying to replicate your setup here where you had it running as hub-managed. |
Ok, I may be wrong, obviously. I can try to run it as an external service. If that works in your case it should work also in mine. For that, could you add to this repo the Dockerfile of the container running the service? And if possible, the pod yaml or even better the deployment yaml corresponding to this service run in its own pod. This would be very helpful and give the repo completeness, to my unsderstanding. Thanks once more ;) |
As suggested, I am trying to deploy this service as external in its own pod. For the moment I am getting now
The logs are:
Maybe it's the value of the token I use in:
I got this token from the user interface of the jupyterhub, I do not know if that's the right way to obtain it. By the way, I used the next Dockerfile to create the image used in the pod:
And I deployed it using a simple helm chart I created using |
Maybe try setting the environment variable |
Thanks rcthomas for your new suggestions, and for your patiente. I added those 2 env variables and now I am getting next:
The hub logs are next:
And the logs of the annoucement pod are:
Everything is behing an ingress ngnix reverse proxy, and the other external service I have (ngshare) is working fine. |
Do you have |
I did not have it set. I added it to the announcement service Dockerfile, which now is next:
Is this Dockerfile different than the one you use in your cluster for this service? The problem is that now I am getting a Relevant hub logs are now:
And announcement pod's logs are:
|
Ah, I think I forgot to include a trailing / on the prefix. Try instead
|
I added now the trailing slash: the But... now I amb getting Relevant hub logs are:
It pretty clear the problem, but I do not know how to fix it. Annoucement service pod's logs are:
|
Is your hub running at |
Thank you rcthomas. I added this env variable Hub logs:
Service logs:
Is this related with the token used in the jupyterhub to access the external service? I generated the token in the jupyterhub itself (client side from the service perspective) using the hub web user interface (menu token). Maybe I should generate that token from the service side, but I do not know how to. |
Hmmm. You didn't use |
Oh sorry, yes there is a typo but in my message here ;), not in the Dockerfile- I double cheked my Dockerfile, and I'm pasting it here again:
|
@orboan Loooking at your dockerfile, where have you set the api token? The token can be anything and you can generate and add it yourself or if you have admin can prob use the UI to generate token and set the value @rcthomas I do have the same issue above but I'm running annoucement as hub managed service, on annoucement.py line 313 you open the cookie-secret file, what is this really used for? API Token is diff than cookie-secret-file right ? |
@rcthomas in that case, we just create a random token and add it to the library location ? Does it have to be tied to SSO service in any way? |
Not sure what you mean by library location. But see #12 (comment) above, you should be able to put the cookie secret at the default location specified by the config, it just has to be in whatever directory is being used when the application starts. For the above Dockerfile @orboan has that would be |
@rcthomas I added the token as you mentioned, now I'm getting this error: I'm debugging but if you have any insights please lmk. Also going to try the separate pod install as well. |
I think the auth_state line isn't related directly, it seems to be coming from https://github.com/jupyterhub/jupyterhub/blob/main/jupyterhub/user.py#L303 which in turn is caused by an exception here https://github.com/jupyterhub/jupyterhub/blob/main/jupyterhub/crypto.py#L167 See also https://jupyterhub.readthedocs.io/en/stable/reference/authenticators.html#authentication-state As for the 503 I can't tell much from that one line by itself, sorry |
@stubclan I did not add
Is is mandatory to use the env variable ANNOUNCEMENT_JUPYTERHUB_API_TOKEN ? |
No, you should be able to set the token the way you have, though it is really not advisable to put a secret like that into your config. https://jupyterhub.readthedocs.io/en/stable/reference/services.html#properties-of-a-service |
Thanks @rcthomas In https://jupyterhub.readthedocs.io/en/stable/reference/services.html#properties-of-a-service we can read: Each Externally-Managed Service will need a unique API token, because the Hub authenticates each API request and the API token is used to identify the originating Service or user. My question is how the token can be assigned to the announcement service running as external in its own pod? For the moment, I only set the token to the jupyterhub config file, but I haven't set it in the service. In the Thank you |
@orboan Here's my understanding of this and I had to do thing for other API services. The token has to be generated from hub, its also encrypted using jupyterhub crypt key. Once the token is saved in hub database, then you can use that token in these services. Since you are using external service you have to give it a token, in the readme they are using env variable ANNOUNCEMENT_JUPYTERHUB_API_TOKEN which is the token generated for this service. You can inject this however you want but adding to config directly is risky. You could just add that directly as env variable for the pod/ deployment or read from github secret/ vault/ or other if you're running via pipeline. |
Maybe this is the problem then? The API token here just needs to be a shared secret. On the announcement service side you have |
This latest information has turned out what I had missing to make the service work. Now it is working. Thank you again @rcthomas for your help and patiente. |
Great, sorry for the difficulty. I'm going to review this thread here and make updates to the documentation to clarify things about configuring the service. The feedback is really useful. |
@orboan Thank you and take your time |
@orboan sorry to bother you, just wondering if you had time, Thanks |
Hello, I added some documentation and files, according to the steps I needed to follow in order to make this service to work. You can find it in this fork: annoucement-service - fix to some problems I hope this could help someone. Thanks for all your help. |
@orboan you don't want to contribute these as a PR? |
Yes, I will submit a PR. Thank you |
Hello @orboan I was wondering if you could help with a small thing. I used your fork to deploy external annoucement service but getting the following error: I am using SSO for jupyterhub and its trying to authenticate services-annoucement as a user. Was wondering if you had same setup and you did run into similar issue below?: Does this client id have to match SSO service's client ID ? If so, then probably need to add secret as well right? I'll test this out but wondering if you had seen something like this already |
What's the |
Hi @orboan I am facing the same issue as you. I am trying to solve it for a while but seems like this link is not working anymore. Can you please send a copy of this if possible? annoucement-service - fix to some problems |
I am trying this service in my jupyterhub (deployed in a k8s cluster), where the jupyterhub container (in its pod) listens in port 8081. The config file used is:
But when accessing the announcement service from the services menu in the hub page, I get the 503 Service Unavailable. Cheking the pod logs I get:
Any ideas on how to fix this?
PS: Using the port 8888 I get exactly the same result (the same logs).
Thank you.
The text was updated successfully, but these errors were encountered: