Open Richard-Regan opened 1 month ago
Hi Richard,
Let me present you what this API does, very briefly:
In our Jupyter hub installation, this API runs on our file server (the server that serves the files to the users' containers). The hub's web server is configured to act as a proxy and redirects file requests to this API.
The typical API calls are :
These calls are initiated from the Moodle plugin, in our use case ; but being an API, any client properly configured can make use of it.
Let me know if, from this short description, the API does what you need. If so, I can give you some help to deploy it within your Jupyter installation.
Sorry, I misread your initial comment. You clearly want to use this API with the Moodle plugin. No pb, I'll contact you by email and we'll get it running. Then, we'll improve the documentation from this experience ;-)
Thanks.
Just to give you some background. I have a test Moodle instance with the assessment plugin installed on a VM. I also have a clean instance of Jupyterhub with the file-api install, I think on a separate bare-metal server. I am now trying to get them to talk. This includes the secret key.
I am not very knowable with python, so this has been fun!
What I am trying to do is within Moodle run a pre-written lab that runs on a dedicated GPU installed on the JypterHub server.
One other complication, we are going through downtime at the moment, so connection to the two servers may be disrupted, just more fun :-)
I would appreciate any help.
Hi, Hope you are OK. looking forward to having a chat with you. just so you know I am in the UK on UTC +1, and can be available anytime. Your help is most welcome, as I am struggling, but I think just a few minutes could make all the difference and get this working. It is very important to us and we are intending to credit you in our material when working.
BW Richard
Hi,
I have been still struggling to get this software configure, but I am also begin to be concerted about what this integration actually does.
Can you clarify from a students perspective what they see, and how it could be used.
Hi,
The whole idea behind this fileserver API and the Moddle plugin is that teachers can setup "Notebook assignments" (by picking a folder from their jupyter workspace from Moodle.
Students can get the assignment resources sent to their workspace also from Moodle. Once they are finished working on the assignment, they can submit their work also directly from Moodle.
And finally, the teachers can download all students submission from Moodle to their workspace, were they can check the work, run the notebooks and grade.
Is that what you expected ?
Hi Nibheis,
Thak for emailing me.
Sorry for the emails.
I would really like to see this working on our servers. Would you be willing to help me get this working.
Best Wishes Richard
From: nibheis @.> Sent: 10 October 2024 08:46 To: epfl-cede/jupyterhub-fileserver-api @.> Cc: REGAN, RICHARD @.>; Author @.> Subject: Re: [epfl-cede/jupyterhub-fileserver-api] Not an issue, more like help (Issue #4)
[EXTERNAL EMAIL]
Hi,
The whole idea behind this fileserver API and the Moddle plugin is that teachers can setup "Notebook assignments" (by picking a folder from their jupyter workspace from Moodle.
Students can get the assignment resources sent to their workspace also from Moodle. Once they are finished working on the assignment, they can submit their work also directly from Moodle.
And finally, the teachers can download all students submission from Moodle to their workspace, were they can check the work, run the notebooks and grade.
Is that what you expected ?
— Reply to this email directly, view it on GitHubhttps://github.com/epfl-cede/jupyterhub-fileserver-api/issues/4#issuecomment-2404329619, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABIU432SUW37Z3DY2PNWQVDZ2YWE7AVCNFSM6AAAAABPQJCAV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBUGMZDSNRRHE. You are receiving this because you authored the thread.Message ID: @.***>
Hi Nibheis,
If you are still willing to help. I can meet you via zoom or any other platform, any time today. Hopefully it will only be a quick fix to get the integration working.
Best Wishes Richard
From: nibheis @.> Sent: 10 October 2024 08:46 To: epfl-cede/jupyterhub-fileserver-api @.> Cc: REGAN, RICHARD @.>; Author @.> Subject: Re: [epfl-cede/jupyterhub-fileserver-api] Not an issue, more like help (Issue #4)
[EXTERNAL EMAIL]
Hi,
The whole idea behind this fileserver API and the Moddle plugin is that teachers can setup "Notebook assignments" (by picking a folder from their jupyter workspace from Moodle.
Students can get the assignment resources sent to their workspace also from Moodle. Once they are finished working on the assignment, they can submit their work also directly from Moodle.
And finally, the teachers can download all students submission from Moodle to their workspace, were they can check the work, run the notebooks and grade.
Is that what you expected ?
— Reply to this email directly, view it on GitHubhttps://github.com/epfl-cede/jupyterhub-fileserver-api/issues/4#issuecomment-2404329619, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABIU432SUW37Z3DY2PNWQVDZ2YWE7AVCNFSM6AAAAABPQJCAV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBUGMZDSNRRHE. You are receiving this because you authored the thread.Message ID: @.***>
Sorry, busy times.
Here's how we deploy this API with Ansible on our file server. You certainly can use the same steps and deploy without Ansible.
Create a system user (we call it fsapi
)
We install APT packages (I checked and it's just python3-pip
:-) )
We clone this git repo is fsapi
's home, at /home/fsapi/noto-api/
(name is not really important)
We install the configuration file (/home/fsapi/noto-api/config.json
), with the following content:
{
"auth":
[
{
"user": "your-user-same-as-configured-on-moodle",
"key": "your-key-same-as-configured-on-moodle"
}
],
"ttl": 10,
"root": "root_directory_where_your-users-files-are-located",
"dynamic_root": false,
"chmod": false
}
dynamic_root
is used if your users are spread across several disks.
chmod
is used to change the ownership of the transferred files.
Leave those options for now.
Create a python virtualenv for running the API web server and the API itself.
/home/fsapi/noto-api/venv
Add a systemd
unit to control (start/stop) the API: /etc/systemd/system/fsapi.service
:
[Unit]
Description=FS API for Jupyter
After=network.target
[Service] User=root WorkingDirectory=/home/fsapi/noto-api Environment=FLASK_CONFIG=production ExecStart=/home/fsapi/noto-api/venv/bin/gunicorn -b 0.0.0.0:8080 -w 4 app:app Restart=always
[Install] WantedBy=multi-user.target
Adapt the IP address (`0.0.0.0` == all IPs) to fit your needs. `-w 4` is the number of `workers` - usually the same as your number of threads/CPUs on your file server. You can change also the port number `8080` if it is already in use.
At that point, your API should be running when you run `systemctl start fsapi`.
Now, you will most probably need to make this API available to the outside world - . To do that, we configure the JupyterHub web server so that it acts as a proxy for the fsapi, at a specific path. Here is an extract of the `nginx` configuration on our JupyterHub:
# FS API (used by Moodle to access the users' files)
location ^~ /api/assignment/ {
rewrite /api/assignment/(.*) /$1 break;
proxy_pass http://xxx.xxx.xxx.xxx:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
# websocket headers
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
Add this to the `server` settings, insert the IP of your file server (`xxx.xxx.xxx.xxx`), adapt the port number, save, reload `nginx` and you should be done. If you are using another server (i.e `apache`) - you should be able to find similar proxy configuration for your web server.
Note that the SSL layer is handled by the hub's web server - this is why the communication between the hub and the file server is unencrypted.
Hi,
I am sorry but I am struggling to use this api and the associated jupyter assignment submission plugin. Is there a slack channel or community page I can ask help about getting these two applications talking to each other?
Best wishes Richard richard.regan@durham.ac.uk