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

Could not get api version #58

Open
christiansteier opened this issue Nov 8, 2022 · 11 comments
Open

Could not get api version #58

christiansteier opened this issue Nov 8, 2022 · 11 comments

Comments

@christiansteier
Copy link

With Moodle 4.0.4+ (Build: 20221025)] and Plugin Version v4.0-r4 (2022-11-03) (2022083101) I get the Error Could not get api version

@grabs
Copy link
Collaborator

grabs commented Nov 8, 2022

Hi Christian,
it looks like your Moodle server cannot reach your Etherpadlite server. Please check the network settings on your Moodle server and also the name resolution.
Best regards
Andreas

@christiansteier
Copy link
Author

Hi Andreas,

THX for the hint. Indeed it was.

@grabs grabs closed this as completed Dec 15, 2022
@alwaysSoConfused
Copy link

Hi Andreas,

sorry I have the same issue, but I am not sure how to check it. Could you please give me some hints what to looks for? Thank you so much in advance!

I have the moodle Server and etherpad Server running in two different docker container (both behind a nginx proxy).
I can access the etherpad server through a Browser via https://etherpad.moodle...:9001/
So the etherpad Server is a subdomain from my moodle server.
Therefore I also put the Server URL for the moodle Plugin to https://etherpad.moodle..:9001/
But I always get the error "could not get api version".

I would be grateful for any tipps!

Best Regards
Roxana

@grabs
Copy link
Collaborator

grabs commented Dec 17, 2022

Hi Roxana,

I'd say your Moodle container can't reach the Etherpad container.
You have to tell your Moodle container how to connect the Etherpad container.
One way could be to add an extra host to the Moodle container.
Have a look here: https://docs.docker.com/compose/compose-file/compose-file-v3/#extra_hosts

Best regards
Andreas

@grabs grabs reopened this Dec 17, 2022
@alwaysSoConfused
Copy link

Hi Andreas,

thank you for your fast reply!
I tried a few things so that my moodle container can reach the etherpad container.
They are both in the same network and now if I docker exec into the moodle container I can curl etherpad:9001 (I set etherpad as the name of the etherpad container) and get the html response from etherpad.
This should mean that the container ist reachable right?

Now through a browser I can access the Etherpad with https://etherpad.moodle.../, so I changed the Server URL in the Plugins Setting to this.
But I still get the same error.

Do you have another idea what I could try?
Thank you again!
Best regards
Roxana

@grabs
Copy link
Collaborator

grabs commented Dec 17, 2022

Hi Roxana,

you have to configurate your system in a way the Etherpad server can be called from browser and from Moodle conatainer in the same way.
I'd suggest you do this:

  1. You configure your proxy so that the Etherpad server is reachable via port 443. I would strongly recommend to use a valid SSL certificate for this right away.
    This way, the Etherpad server should be reachable in the browser via https://<public-etherpad-servername>.
  2. Now add an extra host with the IP address of the Nginx proxy to the Docker configuration of the Etherpad server. If the Nginx proxy is reachable via a local IP address, then use this address otherwise the public one.

Example:

extra_hosts:
  - "<public-etherpad-servername>:<ip-nginx-proxy>"

This will cause the calls Moodle sends to the Etherpad server to be routed through the proxy, and therefore be made using the same server name as the browser.

Best regards
Andreas

@alwaysSoConfused
Copy link

Hi Andres,

thank you again for your patience and your fast answer!
I did what you suggested.
Now I still can reach the etherpad through the browser and its server-name via https. This works fine, I can create and edit pads there.
But I still have the Could not get api version when trying to integrate the plugin through moodle.
But now the error changed when i try to get /api
--> before it was a html response cannot GET /api
--> now its Failed to connect to port 443: Connection refused.

Which confuses me even more, because the etherpad is accessible through the browser via https Port 443.
What did I do wrong?

Thank you
Best Regards
Roxana

@grabs
Copy link
Collaborator

grabs commented Dec 17, 2022

Hi Roxana,

the error indicates that the Moodle server is unable to connect to the Etherpad server via port 443.
Possibly the nginx proxy is not listening over the ip address defined as "extra_host" on port 443.
Try the public ip address or check the nginx configuration.

Best Andreas

@alwaysSoConfused
Copy link

Hi Andreas,

yes you are right, it was the wrong IP Address.
But now I am back to the cannot GET /api error, sorry!
Do you maybe have another idea what could cause the error?
It has to be something with the networking of the two containers, right?

Thank you
Best Regards
Roxana

@grabs
Copy link
Collaborator

grabs commented Dec 17, 2022

Hi Roxana,
can you get the api url inside the container by using exec?
Please check the API key.
A file called APIKEY.txt must be in the root folder of Etherpad.
The content of this file is the value for the "API Key" setting in Moodle.
If the ip address of the extra host is local it might be blocked in Moodle. Then you can activate "Ignore security".

@alwaysSoConfused
Copy link

alwaysSoConfused commented Dec 19, 2022

Hello Andreas,

thanks again for your help!
It is now working! Thank you for your help with the extra_hosts tipp!

I checked the API Key - it matches. But then I noticed that it hat the root user as owner. In the logs etherpad said it will generate a random API Key - probably because of that. I changed the rights and then edited the setting.json to add the ssl Certificate.
Now the Server Url for the Plugin is https://etherpad...:9001/

Thank you so much again!

Best Regards
Roxana

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

No branches or pull requests

3 participants