konveyor / mig-demo-apps

A collection of apps ideal for migration demos
Apache License 2.0
15 stars 70 forks source link

fix: modify the customers service to work locally using a postgresql database #56

Closed HarikrishnanBalagopal closed 2 years ago

HarikrishnanBalagopal commented 2 years ago

The instructions on the README.md are not working: https://github.com/konveyor/mig-demo-apps/tree/7259959b620223494c84ac512760502be43b34af/apps/e2e-demo#running-locally

$ mvn clean spring-boot:run -P local
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 16 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 11 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.777 s
[INFO] Finished at: 2022-01-30T04:28:53+05:30
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "local" could not be activated because it does not exist.
[ERROR] No plugin found for prefix 'spring-boot' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/user/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

The sprint-boot maven plugin isn't present in the customers pom.xml and the profile local is also absent.

I have created a new README for that service and slightly modified the persistence.properties to make the service runnable locally. Also created a maven wrapper for convenience and reproducibility.

Signed-off-by: Harikrishnan Balagopal harikrishmenon@gmail.com

HarikrishnanBalagopal commented 2 years ago

@rromannissen Thanks for taking a look at the PR.

Because of that, I see no point in applying changes to the application to work with PostgreSQL since that would break the proposed scenario.

That's fine, my intention is not to replace the database but to get it running locally. The current instructions in the README simply give an error when executed. They don't let you run it with or without Oracle.

Would it make sense to have 2 application.properties file similar to the Orders service? One for local use with embedded H2 and another for Openshift use with Oracle?

HarikrishnanBalagopal commented 2 years ago

update: Seem the log variable is created by the @Slf4j annotation https://projectlombok.org/api/lombok/extern/slf4j/Slf4j.html

Example:

 @Slf4j
 public class LogExample {
 }

will generate:
 public class LogExample {
     private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExample.class);
 }

Unrelated to this, but there seems to be more bugs: https://github.com/konveyor/mig-demo-apps/blob/master/apps/e2e-demo/orders/src/main/java/io/konveyor/demo/orders/controller/OrderController.java#L37 The log variable is not defined.

I think log is supposed to be logger similar to https://github.com/konveyor/mig-demo-apps/blob/master/apps/e2e-demo/customers-tomcat-k8s/src/main/java/io/konveyor/demo/ordermanagement/controller/CustomerController.java#L23

HarikrishnanBalagopal commented 2 years ago

update: Actually the gateway service seems to be doing some processing to make it all work for the Frontend service, even going as far as to fetch customer data, hmm....

https://github.com/konveyor/mig-demo-apps/blob/master/apps/e2e-demo/gateway/src/main/java/io/konveyor/demo/gateway/service/OrdersService.java#L50-L54


Another bug, the Order service returns a list instead of a page https://github.com/konveyor/mig-demo-apps/blob/master/apps/e2e-demo/orders/src/main/java/io/konveyor/demo/orders/controller/OrderController.java#L50-L51

It should return a page similar to the Customer service https://github.com/konveyor/mig-demo-apps/blob/master/apps/e2e-demo/customers-tomcat-k8s/src/main/java/io/konveyor/demo/ordermanagement/controller/CustomerController.java#L36-L37

This is not a bug in Orders itself but during integration with the Frontend service, it breaks the website. The website expects a page not a list.

HarikrishnanBalagopal commented 2 years ago

I will close this PR and open a new one later that makes the customers service build locally without changing the database that is used. Thanks for taking a look at this PR.