sw360 / sw360chores

WARNING - Work in Progress - It is not Bug Free! Use with Caution. This repository contains Dockerfiles and accompanying scripts that allow deployment of sw360 via docker
Eclipse Public License 1.0
13 stars 18 forks source link

chores(liferay): make compatible with Liferay 7.2 #65

Closed lepokle closed 5 years ago

lepokle commented 5 years ago

This commit is mainly to make it compatible with Liferay 7.2 and contains:

Signed-off-by: Leo von Klenze leo.vonklenze@scansation.de

maxhbr commented 5 years ago

now has conflicts due to merge of https://github.com/sw360/sw360chores/pull/64

maxhbr commented 5 years ago

Also the travis ci needs to be adopted

kallesoranko commented 5 years ago

Tested this PR and got same failure as @maxhbr. Building images with ./sw360chores.pl --build seems to work, but after running ./sw360chores.pl -- up -d, container sw360_lr7_sw360 crashes with error:

ksoranko_verifa_io@oss-server:~/sw360chores$ docker logs sw360_lr7_sw360
/usr/local/bin/entrypoint.sh: line 68: /opt/sw360/tomcat-*/conf/Catalina/localhost/logs.xml: No such file or directory
lepokle commented 5 years ago

@maxhbr @kallesoranko Might it be that you didn't use a clean checkout but used your existing directory and just switched the branch? If thats the case, please be sure to delete sw360-liferay.tar.gz in the following directories first:

Note that you have to delete the existing containers, images and volumes associated to lr7 at least for sw360empty.

I've done a clean run without any errors today.

maxhbr commented 5 years ago

then please rename your .tar.gz to sw360-liferay7.tar.gz, and remove the old file if existing. This would be the save way.

maxhbr commented 5 years ago

The commit before this merge should be tagged for latest LR6 support

kallesoranko commented 5 years ago

Tested this again and yes the previous error was because of that old sw360-liferay.tar.gz file. There is probably still something missing from configs, since UI looks like:

Untitled

Not sure what is missing/misconfigured. Test server is in public cloud, with firewall disabled, so it is not about that. Any ideas?

lepokle commented 5 years ago

Looks like SW360_HOST and similar are not correctly configured.

I think it is in configuration/sw360.env.

-----Original Message----- From: Kalle Soranko notifications@github.com To: sw360/sw360chores sw360chores@noreply.github.com Cc: lepokle github@leo.von-klenze.de, Author author@noreply.github.com Sent: Di., 20 Aug. 2019 15:19 Subject: Re: [sw360/sw360chores] chores(liferay): make compatible with Liferay 7.2 (#65)

Tested this again and yes the previous error was because of that old sw360-liferay.tar.gz file. There is probably still something missing from configs, since UI looks like:

Untitled

Not sure what is missing/misconfigured. Test server is in public cloud, with firewall disabled, so it is not about that. Any ideas?

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/sw360/sw360chores/pull/65#issuecomment-523011054

kallesoranko commented 5 years ago

$SW360_HOST was misconfigured. Thanks @lepokle

maxhbr commented 5 years ago

has someone with a working LR7 deployment tested, whether the authorization server which relies on the LR soap interface, still works? (ping @kallesoranko @lepokle )

kallesoranko commented 5 years ago

@maxhbr not sure which part you mean with soap interface, but I do have a working instance with LR7. I haven't tested the rest yet, but will do that today.

One other point that I noticed was that sometimes webapps are not deployed from _deploy/tomcat directory, but removing all war files and deploying/copying them again to that same directory solves the issue. Is this expected behavior or do you have any ideas why this is happening ? @lepokle ?

kallesoranko commented 5 years ago

One more point: I guess --prod argument cannot be used anymore since the changes in deployment mechanism

kallesoranko commented 5 years ago

@maxhbr I tested rest and it seems that I cannot access https://sw360/authorization/client-management because

 2019-08-22 09:47:44 ERROR ErrorPageFilter:176 - Forwarding to error page from request [/client-management] due to exception [403 ]
sw360_1                |  org.springframework.web.client.HttpClientErrorException: 403
sw360_1                |        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:78)
sw360_1                |        at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700)
sw360_1                |        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653)
sw360_1                |        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
sw360_1                |        at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407)
sw360_1                |        at org.eclipse.sw360.rest.authserver.security.basicauth.Sw360LiferayAuthenticationProvider.liferayAuthCheckRequest(Sw360LiferayAuthenticationProvider.java:118)
sw360_1                |        at org.eclipse.sw360.rest.authserver.security.basicauth.Sw360LiferayAuthenticationProvider.isAuthorized(Sw360LiferayAuthenticationProvider.java:102)
sw360_1                |        at org.eclipse.sw360.rest.authserver.security.basicauth.Sw360LiferayAuthenticationProvider.authenticate(Sw360LiferayAuthenticationProvider.java:83)
sw360_1                |        at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174)

and if I try to create new client in browser's console, I get undefined in the console and same thing in log as above. On the other hand I haven't used new client management system, so I may be doing something wrong.

maxhbr commented 5 years ago

maybe it would help to use https://github.com/eclipse/sw360/wiki/Dev-REST-API#client-management-via-curl

kallesoranko commented 5 years ago

I tried to add a client with curl with no success, in terminal I get no response and in log:

sw360_1                | 2019-08-22 10:09:30 ERROR ErrorPageFilter:176 - Forwarding to error page from request [/client-management] due to exception [404 ]
sw360_1                |  org.springframework.web.client.HttpClientErrorException: 404
sw360_1                |        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:78)
sw360_1                |        at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700)
sw360_1                |        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653)
sw360_1                |        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
sw360_1                |        at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407)
sw360_1                |        at org.eclipse.sw360.rest.authserver.security.basicauth.Sw360LiferayAuthenticationProvider.liferayAuthCheckRequest(Sw360LiferayAuthenticationProvider.java:118)
sw360_1                |        at org.eclipse.sw360.rest.authserver.security.basicauth.Sw360LiferayAuthenticationProvider.isAuthorized(Sw360LiferayAuthenticationProvider.java:102)
sw360_1                |        at org.eclipse.sw360.rest.authserver.security.basicauth.Sw360LiferayAuthenticationProvider.authenticate(Sw360LiferayAuthenticationProvider.java:83)
sw360_1                |        at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174)

... can't say what this means...

maxhbr commented 5 years ago

shouldn't the request ask for /authorization/client-management instead of /client-management?

kallesoranko commented 5 years ago

yes, probably. I used the curl-command directly from the wiki, so:

curl -s -S \
     --user "${SW360_USER}:${SW360_PW}" \
     --header "Content-Type: application/json" \
     --header "Accept: application/json" \
     -X POST https://[hostname]:[port]/authorization/client-management \
     -d @- <<EOF
{
    "description" : "my first test client",
    "authorities" : [ "BASIC" ],
    "scope" : [ "READ" ],
    "access_token_validity" : 3600,
    "refresh_token_validity" : 3600
}
EOF

Maybe @imaykay can comment this, since he wrote client management thing?

imaykay commented 5 years ago

It seems to be that the Liferay 7 REST API is not available. The important part is:

sw360_1                |  org.springframework.web.client.HttpClientErrorException: 404
sw360_1                |        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:78)
sw360_1                |        at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700)
sw360_1                |        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653)
sw360_1                |        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613)
sw360_1                |        at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407)
sw360_1                |        at org.eclipse.sw360.rest.authserver.security.basicauth.Sw360LiferayAuthenticationProvider.liferayAuthCheckRequest(Sw360LiferayAuthenticationProvider.java:118)

where the last line is the last one of our own code that is trying to query the L7 REST interface. But Spring's RestTemplate cannot make a successful call. What seems strange to me is that your first output got a 403, which means that the REST API has been somehow available. But your second call resultet in a 404.

I don't have a locally running L7 installation at hand. But maybe you could test if the API is available. On L6 the path to a GUI interface was https://[host]:[port]/api/jsonws (which might not be the case for L7, Google might help).

In addition, @lepokle, did you read anything that said that the REST API has to be manually activated in L7 since they are now using their modularized system?

maxhbr commented 5 years ago

I think we use the liferay SOAP API instead of REST, but https://[host]:[port]/api/jsonws is the correct URL to check

imaykay commented 5 years ago

I think we use the liferay SOAP API instead of REST, but https://[host]:[port]/api/jsonws is the correct URL to check

I am really not so sure about it. Check the referenced lines of code (see stacktrace). It looks like REST to me.

lepokle commented 5 years ago

then please rename your .tar.gz to sw360-liferay7.tar.gz, and remove the old file if existing. This would be the save way.

This will only solve the problem once. We cannot rename the file on every change. There really should be another mechanism.

Nevertheless the file will be named after the project name after this PR has been updated.

maxhbr commented 5 years ago

This will only solve the problem once. We cannot rename the file on every change. There really should be another mechanism.

Isn't that similar to your sw360_lr7 prefix to the docker images? Shouldn't that actually be handled with tags?

maxhbr commented 5 years ago

update: The url https://[host]:[port]/api/jsonws answers and looks good with LR7

maxhbr commented 5 years ago

currently rest-auth is broken due to the LR7 update, see: https://github.com/eclipse/sw360/pull/623

lepokle commented 5 years ago

Side note: I've also fixed the docker swarm test by waiting for postgres in the sw360 startup script

lepokle commented 5 years ago

@maxhbr Can we merge it then?