pdsinterop / solid-nextcloud

A plugin to make Nextcloud compatible with Solid
https://pdsinterop.org/solid-nextcloud/
MIT License
72 stars 11 forks source link

help needed for configuration #61

Closed aakerbeere closed 1 year ago

aakerbeere commented 2 years ago

After installing from NC app store and activating solid app i can find "/var/www/nextcloud/apps/solid/composer.json". Are you talking about this when considering something like "take and put JSON from ... to" and do you mean "copy the file". When doing "https://myDomain/.well-known/openid-configuration" i get "message: openid-configuration not supported".

Some hints would be great.

Regards markus

Potherca commented 2 years ago

Hi! Lets see if we can get you up and running...

For Solid NC to work, the OpenID .well-known file needs to be present under https://myDomain/.well-known/openid-configuration.

When this plugin was created, Nextcloud (NC20) did not have a mechanism to add files underneath https://myDomain/.well-known/. All URLs had to be underneath the App space. This means the file is present at https://myDomain/index.php/apps/solid/openid (or https://myDomain/apps/solid/openid) instead of where it should be.

It could be possible to redirect from /.well-known/openid-configuration to /index.php/apps/solid/openid (for instance in the Apache config or a .htaccess file) but it proved difficult to add CORS headers to the redirect. Hence the advice to copy the JSON content from /index.php/apps/solid/openid to /.well-known/openid-configuration.

Reading the INSTALL.md, I think some rewording is needed to make that more clear.

In newer versions of Nextcloud it is (finally!) possible to add well-known file. We plan to implement this (see #46) but we need to finish #59 first, so for now the copy/paste is the best we can offer 😞

To get things started, is there JSON content at https://myDomain/index.php/apps/solid/openid ?

aakerbeere commented 2 years ago

Thank you @Potherca

Sorry for being late. I appreciate your assistance.

When doing "https://myDomain/apps/solid/openid" a blank page opens.

Potherca commented 2 years ago

No apology needed! I know everyone has their own timeline to consider.

If https://myDomain/apps/solid/openid shows a blank page, it is most likely there is an error somewhere underwater. It might show up in your error logs.

What Nextcloud and PHP version are you using?

aakerbeere commented 2 years ago

22.2.3.0 7.4.27

Potherca commented 2 years ago

Ah, good! Then we can, at least, be assured it isn't one of the PHP8 related issues. NC22 has not been explicitly tested yet (this was planned together with PHP8 support) but things should work the same as NC21, which has been tested.

Remote debugging is somewhat cumbersome, so please bear with me. First, lets validate some assumptions:

  1. Is there a vendor directory besides the composer.lock file? (I.e. in the same directory on disk as where the composer.json and composer.lock are)
  2. To make sure there isn't some routing weirdness, is the response the same for /index.php/apps/solid/openid (without trailing slash) and /index.php/apps/solid/openid/ (with trailing slash), as well as with and without the index.php prefix?
  3. Are there any PHP errors in the error logs? (usually somewhere like nextcloud/data/nextcloud.log)
aakerbeere commented 2 years ago

Thank you @Potherca

  1. No vendor directory:
    :~ $ ls /var/www/nextcloud/apps/solid/ 
    appinfo  build  composer.json  composer.lock  css  img  js  lib  LICENSE  Makefile  phpunit.integration.xml  phpunit.xml 
    README.md  templates  tests
  2. https://<myDomain>/index.php/apps/solid/openid: empty page https://<myDomain>/index.php/apps/solid/openid/: empty page https://<myDomain>/apps/solid/openid: empty page https://<myDomain/apps/solid/openid/: empty page
  3. When doing :/var/www/nextcloud/data# grep -E 'error' nextcloud.log | grep -E 'php' i get plenty of output such as
Full logs ```json { "reqId": "FXRwhucjBVp4psZTvZfU", "level": 3, "time": "2021-12-30T16:08:59+01:00", "remoteAddr": "", "user": "", "app": "no app in context", "method": "GET", "url": "/ocs/v2.php/apps/notifications/api/v2/notifications", "message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 7 FATAL: terminating connection due to administrator command\nSSL connection has been closed unexpectedly\nserver closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.", "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0", "version": "22.2.3.0", "exception": { "Exception": "Doctrine\\DBAL\\Exception\\DriverException", "Message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 7 FATAL: terminating connection due to administrator command\nSSL connection has been closed unexpectedly\nserver closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.", "Code": 7, "Trace": [{ "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php", "line": 1780, "function": "convert", "class": "Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter", "type": "->" }, { "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php", "line": 1719, "function": "handleDriverException", "class": "Doctrine\\DBAL\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php", "line": 1067, "function": "convertExceptionDuringQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/DB/Connection.php", "line": 236, "function": "executeQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php", "line": 345, "function": "executeQuery", "class": "OC\\DB\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php", "line": 287, "function": "execute", "class": "Doctrine\\DBAL\\Query\\QueryBuilder", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php", "line": 59, "function": "execute", "class": "OC\\DB\\QueryBuilder\\QueryBuilder", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Registry.php", "line": 52, "function": "getState", "class": "OC\\Authentication\\TwoFactorAuth\\Db\\ProviderUserAssignmentDao", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Manager.php", "line": 125, "function": "getProviderStates", "class": "OC\\Authentication\\TwoFactorAuth\\Registry", "type": "->" }, { "file": "/var/www/nextcloud/core/Middleware/TwoFactorMiddleware.php", "line": 119, "function": "isTwoFactorAuthenticated", "class": "OC\\Authentication\\TwoFactorAuth\\Manager", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php", "line": 97, "function": "beforeController", "class": "OC\\Core\\Middleware\\TwoFactorMiddleware", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php", "line": 118, "function": "beforeController", "class": "OC\\AppFramework\\Middleware\\MiddlewareDispatcher", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/App.php", "line": 156, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Route/Router.php", "line": 302, "function": "main", "class": "OC\\AppFramework\\App", "type": "::" }, { "file": "/var/www/nextcloud/ocs/v1.php", "line": 62, "function": "match", "class": "OC\\Route\\Router", "type": "->" }, { "file": "/var/www/nextcloud/ocs/v2.php", "line": 23, "args": ["/var/www/nextcloud/ocs/v1.php"], "function": "require_once" }], "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php", "Line": 83, "Previous": { "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception", "Message": "SQLSTATE[HY000]: General error: 7 FATAL: terminating connection due to administrator command\nSSL connection has been closed unexpectedly\nserver closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.", "Code": 7, "Trace": [{ "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "line": 94, "function": "new", "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception", "type": "::" }, { "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php", "line": 1057, "function": "execute", "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/DB/Connection.php", "line": 236, "function": "executeQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php", "line": 345, "function": "executeQuery", "class": "OC\\DB\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php", "line": 287, "function": "execute", "class": "Doctrine\\DBAL\\Query\\QueryBuilder", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php", "line": 59, "function": "execute", "class": "OC\\DB\\QueryBuilder\\QueryBuilder", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Registry.php", "line": 52, "function": "getState", "class": "OC\\Authentication\\TwoFactorAuth\\Db\\ProviderUserAssignmentDao", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Manager.php", "line": 125, "function": "getProviderStates", "class": "OC\\Authentication\\TwoFactorAuth\\Registry", "type": "->" }, { "file": "/var/www/nextcloud/core/Middleware/TwoFactorMiddleware.php", "line": 119, "function": "isTwoFactorAuthenticated", "class": "OC\\Authentication\\TwoFactorAuth\\Manager", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php", "line": 97, "function": "beforeController", "class": "OC\\Core\\Middleware\\TwoFactorMiddleware", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php", "line": 118, "function": "beforeController", "class": "OC\\AppFramework\\Middleware\\MiddlewareDispatcher", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/App.php", "line": 156, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Route/Router.php", "line": 302, "function": "main", "class": "OC\\AppFramework\\App", "type": "::" }, { "file": "/var/www/nextcloud/ocs/v1.php", "line": 62, "function": "match", "class": "OC\\Route\\Router", "type": "->" }, { "file": "/var/www/nextcloud/ocs/v2.php", "line": 23, "args": ["/var/www/nextcloud/ocs/v1.php"], "function": "require_once" }], "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php", "Line": 26, "Previous": { "Exception": "PDOException", "Message": "SQLSTATE[HY000]: General error: 7 FATAL: terminating connection due to administrator command\nSSL connection has been closed unexpectedly\nserver closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.", "Code": "HY000", "Trace": [{ "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "line": 92, "function": "execute", "class": "PDOStatement", "type": "->" }, { "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php", "line": 1057, "function": "execute", "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/DB/Connection.php", "line": 236, "function": "executeQuery", "class": "Doctrine\\DBAL\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php", "line": 345, "function": "executeQuery", "class": "OC\\DB\\Connection", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php", "line": 287, "function": "execute", "class": "Doctrine\\DBAL\\Query\\QueryBuilder", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php", "line": 59, "function": "execute", "class": "OC\\DB\\QueryBuilder\\QueryBuilder", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Registry.php", "line": 52, "function": "getState", "class": "OC\\Authentication\\TwoFactorAuth\\Db\\ProviderUserAssignmentDao", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Authentication/TwoFactorAuth/Manager.php", "line": 125, "function": "getProviderStates", "class": "OC\\Authentication\\TwoFactorAuth\\Registry", "type": "->" }, { "file": "/var/www/nextcloud/core/Middleware/TwoFactorMiddleware.php", "line": 119, "function": "isTwoFactorAuthenticated", "class": "OC\\Authentication\\TwoFactorAuth\\Manager", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php", "line": 97, "function": "beforeController", "class": "OC\\Core\\Middleware\\TwoFactorMiddleware", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php", "line": 118, "function": "beforeController", "class": "OC\\AppFramework\\Middleware\\MiddlewareDispatcher", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/AppFramework/App.php", "line": 156, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" }, { "file": "/var/www/nextcloud/lib/private/Route/Router.php", "line": 302, "function": "main", "class": "OC\\AppFramework\\App", "type": "::" }, { "file": "/var/www/nextcloud/ocs/v1.php", "line": 62, "function": "match", "class": "OC\\Route\\Router", "type": "->" }, { "file": "/var/www/nextcloud/ocs/v2.php", "line": 23, "args": ["/var/www/nextcloud/ocs/v1.php"], "function": "require_once" }], "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php", "Line": 92 } }, "CustomMessage": "--" } } ```

Maybe this not to be of much interest to you and there is some better expression for grep to find what you want.

Potherca commented 2 years ago

Hmmm... Looking at the INSTALL.md instructions, I see that composer install is only mentioned when installing the app from source. But without the vendor directory nothing works, as all the third-party dependencies live there. We had the same issue in #50.

We really need to work on those install instructions 😞 Or maybe add the vendor package to the repo or deploy package.

For now, is it possible for you to run composer install --no-dev --prefer-dist in the /var/www/nextcloud/apps/solid/ directory? (Or composer.phar install --no-dev --prefer-dist, depending on your setup).

I'll think on a better regex in case we need one further along.

aakerbeere commented 2 years ago

Not possible: root@<host>:/var/www/nextcloud/apps/solid# composer install --no-dev --prefer-dist -bash: composer: Kommando nicht gefunden. root@<host>:/var/www/nextcloud/apps/solid# composer.phar install --no-dev --prefer-dist -bash: composer.phar: Kommando nicht gefunden.

Potherca commented 2 years ago

Thank you for trying! I've been looking into things from our end, and it looks like during the last release, the step to add the vendor directory was missing. 😭

I've opened issues to fix the package release (#64), add the vendor directory (#65), and to warn other users while this issue is not resolved (#66).

For a new release I will need to work together with another member of our team, which will be monday at the soonest. Looking at my current projects and deadlines, automation will probably take another week or so.

Regarding your issue, this gives us three options:

  1. I could walk you through the process to get composer and run the vendor install step (the workaround described in #66)
  2. You wait until a new release has been deployed (with the vendor included)
  3. You wait until the process is automated on our end and a new release has been deployed

Whichever you choose, thank you again for reporting this and bearing with us. This project is still very young, and we appreciate any interst (and feedback!) it receives.

aakerbeere commented 2 years ago

Thank you @Potherca You are very welcome.

I know the project is young. When i started reading about the solid project, i wanted to have my own instance for privacy concerns. But i was somehow feared my knowledge not to be sufficient to get it up and running. So i started by having my own cloud. Now getting my own solid instance through NC-app would make me very happy.

I went through #66:

:/var/www/nextcloud/apps/solid $ sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
:/var/www/nextcloud/apps/solid $ php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
:/var/www/nextcloud/apps/solid $ sudo php composer-setup.php
All settings correct for using Composer
Downloading...
Composer (version 2.2.3) successfully installed to: /var/www/nextcloud/apps/solid/composer.phar
Use it: php composer.phar
:/var/www/nextcloud/apps/solid $ sudo php -r "unlink('composer-setup.php');"

I ran "composer install" as root despite the warning. Dependencies have been installed, but some warnings came up at the beginning and at the end:

:/var/www/nextcloud/apps/solid $ sudo php composer.phar install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Package operations: 54 installs, 0 updates, 0 removals
  - Downloading arc/base (2.1.1)
  ...
  - Installing phpunit/phpunit (5.7.27): Extracting archive
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
13 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

regards

Potherca commented 2 years ago

My apologies for the delay, I was taken ill this week. 😥

The warnings about abandoned packages can be ignored. They are development dependencies which are not used by the main code. I'm working on updating the composer dependencies in a separate branch. From what I can see you shouldn't be too far behind with those dependencies so for now the warning about the lock file not being up to date can also be ignored.

At this point things at the .well-known/openid-configuration should start working, or we should start seeing errors in the Nextcloud logs (or the Apache logs if things are really bad).

You could also start seeing behaviour (i.e. errors) as described in #62. I'm hoping to merge and release fixes for this the coming week.

aakerbeere commented 2 years ago

Thank you @potherca

No apology needed. Take your time to recover.

Actually i get output when doing "https://<myDomain>/apps/solid/openid" but also find log entries when starting solid:

[PHP] Error: in_array() expects parameter 2 to be array, string given at /var/www/nextcloud/apps/solid/lib/Controller/AppController.php#55

[PHP] Error: Invalid argument supplied for foreach() at /var/www/nextcloud/apps/solid/lib/Controller/AppController.php#37

[PHP] Error: Undefined variable: userClients at /var/www/nextcloud/apps/solid/lib/Controller/AppController.php#37

No errors in apache error.log so far. With https://<myDomain>/.well-known/openid-configuration i get "not supported"

aakerbeere commented 2 years ago

@Potherca

Tell me if i can contribute something. No changes since my last post.

Potherca commented 1 year ago

Things have been moving forward again lately!

Since release v0.5.0 the vendor directory has been part of the release, which solves this specific issue. (Hence me closing this issue)

Once #107 has been resolved, installing things should be smooth again (so you might want to wait for v0.7.1 to be released).