nextcloud / lookup-server

:eyes: Lookup server to find remote users for federated sharing
23 stars 16 forks source link

How to test the installation #70

Closed pmarini-nc closed 2 years ago

pmarini-nc commented 2 years ago

I have followed the installation steps:

  1. Created the DB and defined the tables
  2. Copied the server folder in /var/www/html
  3. Fill the ServerName property with the hostname, gs-lookup.localenv.com, in the virtualhost file (otherwise this is the file shipped in the APT repository - 000-default.conf.txt).
  4. Changed the config.php with the following one - config.php.txt. Nothing special just 'PUBLIC_URL' => 'https://gs-lookup.localenv.com/index.php'.
  5. Try to use the REST API to launch a search of the users, as suggested in the documentation.

curl -X GET http://gs-lookup.localenv.com/server/users?search=searchstring

I know that I don't have any users yet, but I would expect an empty resultset instead of an error.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache/2.4.41 (Ubuntu) Server at gs-lookup.localenv.com Port 80</address>
</body></html>

As I'm in a Global Scale deployment, I need to test that the Lookup server is up and running before going on with the following steps.

Questions

  1. I don't see any log created in the /tmp folder. At which point should it be created?
  2. Is the full url in the curl request above correct?
schiessle commented 2 years ago

Can you call the "/status" end-point?

pmarini-nc commented 2 years ago

No, I can't.

wget http://gs-lookup.localenv.com/status
--2021-11-05 09:50:07--  http://gs-lookup.localenv.com/status
Resolving gs-lookup.localenv.com (gs-lookup.localenv.com)... 10.23.46.70
Connecting to gs-lookup.localenv.com (gs-lookup.localenv.com)|10.23.46.70|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-11-05 09:50:07 ERROR 404: Not Found.

Note that I put a plain index.html in the web root (/var/www/html) and requesting it with wget works fine.

Where can I find the log to debug it? No /tmp/lookup.log is created

schiessle commented 2 years ago

hm, maybe something wrong with the Apache conf?

You called "http://gs-lookup.localenv.com/status" but in the inital post you used "http://gs-lookup.localenv.com/server/users?search=searchstring" with a additional subfolder "server".

Maybe "http://gs-lookup.localenv.com/server/status" works? Depending on the configuration you might also have to keep the index.php: "http://gs-lookup.localenv.com/server/index.php/status"

pmarini-nc commented 2 years ago

Thanks @schiessle!

There is some progress here:

wget -O/dev/null http://gs-lookup.localenv.com/index.php/status
--2021-11-05 15:53:37--  http://gs-lookup.localenv.com/index.php/status
Resolving gs-lookup.localenv.com (gs-lookup.localenv.com)... 127.0.0.1
Connecting to gs-lookup.localenv.com (gs-lookup.localenv.com)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK

Question 1 Is removing the index.php part the same as Pretty URLs?

Now, I'm trying to do a POST request (create-user.json is the sample json here):

curl -i -X POST   http://gs-lookup.localenv.com/index.php/users   -H 'Content-Type: application/json' -d '@create-user.json'
HTTP/1.1 200 OK
Date: Fri, 05 Nov 2021 14:57:39 GMT
Server: Apache/2.4.41 (Ubuntu)
Content-Length: 0
Content-Type: text/html; charset=UTF-8

Return code is 200, so everything should be ok. However no users are created, e.g. no user is created in table users .

Question 2: is there something more to do to get the user created?

Question 3: I don't see any log created in the /tmp folder. At which point should it be created?

pmarini-nc commented 2 years ago

Digging a little bit, I found out that if $verified is false, return code is 200 but the insertOrUpdate is not called so no transaction is done.

Now the question is what is the purpose of $signatureHandler->verify function? This should be documented and the test API calls made ready to get through this function.

pmarini-nc commented 2 years ago

I have created a: