Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

In case you have issues while accessing your MySQL installation, please consult your sys admin to resolve the issue.

Starting WS API server

...

from source codes

To prepare Catalog QT environment run compile.sh script - it will create server application and basic components. 

...

Info

Note that you can use different port number for `Spring Boot` application

Code Block
> SERVER_PORT=8081 mvn spring-boot:run


 Startnig WS API Server from

...

Docker Containers


Our codes are open-source and you can find them in here: https://github.com/mkopsnc/catalogue_qt_docker

...

Example of application.properties file for docker-compose


Info

Look at the structure:

  • KeyCloak settings are enabled
  • Bearer token authorization is enabled
  • HTTPS settings are disabled


Code Block
# The host is 'db' not localhost!
spring.datasource.url=jdbc:mysql://db:3306/itm_catalog_qt?serverTimezone=UTC

spring.datasource.username=itm_catalog_rw
spring.datasource.password=itm_catalog_rw
spring.jpa.properties.hibernate.jdbc.time_zone=UTC

server.error.include-message=always
spring.mvc.dispatch-options-request=true

spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=none

# This is additional http handler, on another port
server.port=8080
server.http.port=8081
server.http.interface=0.0.0.0

# ------ Keycloak settings -------
# If you plan to use Keycloak authorization, make sure to uncomment this one 

keycloak.realm = fair4fusion-docker-demo
keycloak.auth-server-url=https://sso.apps.paas-dev.psnc.pl/
keycloak.resource= catalogqt-cli
keycloak.realm-key= MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjOCDGJsBi7rxVjf0RQb8pm0LAGsEKFcH7g7mKSqpFvp1uOypUeiYe5dwlwkXAXaYeYs0J70LB8E6mtVUcykbmp+XrqD1nn3yfPxlVLSg7iCvJqMUq8udsUbsyT3M/32/kssXurgY7rX5JhdtkYeAgq+9ifIjLQZhALg+FvEsX9C+D30WQDAChEljlReb+Y4UTz2aIqz9C+90bqG1ZIX4o3Dli1PZDosTNM444CwDTbrFrenctOTDtGPodo9k2jze8McZFAIrdUYi9mKD8v0frs8NUUW/TQj9h62swXdvVAfzYTd+R7aMRG0eXMV3rJc38DfsCsF7bkqSg0b4l8GcaQIDAQAB
keycloak.bearer-only = true
keycloak.public-client=true
keycloak.principal-attribute=preferred_username


# ------ Bearer token authorization settings -------
# If you plan to send autorization token, make sure to make this one 'true'

swagger-ui.authorization.header=true 

# ------ HTTPS settings -------
# If you plan to use HTTPS, make sure to uncomment this one

#server.ssl.key-store=file:///home/imas/cert/keystore.p12
#server.ssl.key-store-password=catalogqt
#server.ssl.keyStoreType=PKCS12
#server.ssl.keyAlias=tomcat



...

Example of application.properties file for single-container:

Info

Look at the structure:

  • KeyCloak settings are disabled
  • Bearer token authorization is disabled
  • HTTPS settings are enabled


Code Block
# The host is localhost
spring.datasource.url=jdbc:mysql://localhost:3306/itm_catalog_qt?serverTimezone=UTC

spring.datasource.username=itm_catalog_rw
spring.datasource.password=itm_catalog_rw
spring.jpa.properties.hibernate.jdbc.time_zone=UTC

server.error.include-message=always
spring.mvc.dispatch-options-request=true

spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=none

# This is additional http handler, on another port
server.port=8080
server.http.port=8081
server.http.interface=0.0.0.0

# ------ Keycloak settings -------
# If you plan to use Keycloak authorization, make sure to uncomment this one 

keycloak#keycloak.realm = fair4fusion-docker-demo
keycloak#keycloak.auth-server-url=https://sso.apps.paas-dev.psnc.pl/
keycloak#keycloak.resource= catalogqt-cli
keycloak#keycloak.realm-key= MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjOCDGJsBi7rxVjf0RQb8pm0LAGsEKFcH7g7mKSqpFvp1uOypUeiYe5dwlwkXAXaYeYs0J70LB8E6mtVUcykbmp+XrqD1nn3yfPxlVLSg7iCvJqMUq8udsUbsyT3M/32/kssXurgY7rX5JhdtkYeAgq+9ifIjLQZhALg+FvEsX9C+D30WQDAChEljlReb+Y4UTz2aIqz9C+90bqG1ZIX4o3Dli1PZDosTNM444CwDTbrFrenctOTDtGPodo9k2jze8McZFAIrdUYi9mKD8v0frs8NUUW/TQj9h62swXdvVAfzYTd+R7aMRG0eXMV3rJc38DfsCsF7bkqSg0b4l8GcaQIDAQAB
keycloak#keycloak.bearer-only = true
keycloak#keycloak.public-client=true
keycloak#keycloak.principal-attribute=preferred_username


# ------ Bearer token authorization settings -------
# If you plan to send autorization token, make sure to make this one 'true'

swagger#swagger-ui.authorization.header=true 

# ------ HTTPS settings -------
# If you plan to use HTTPS, make sure to uncomment this one

#serverserver.ssl.key-store=file:///home/imas/cert/keystore.p12
#serverserver.ssl.key-store-password=catalogqt
#serverserver.ssl.keyStoreType=PKCS12
#serverserver.ssl.keyAlias=tomcat





Building and running

The checklist you should make before building the app:
  • Can iI succesfully login to rhus-71.man.poznan.pl?
  • Do I have catalog_qt_2 codes?
  • Did I changed application properties? If yes runin your /catalog_qt_2 run script
    Code Block
    > ./compile.sh


After this you can finally build and run the app!

...

In order to build and run docker-compose container you have to do following:

...

Once Catalog QT 2 is in place, you can build the single-container.

Code Block
> docker build -t catalogqt .

...

Info

#1  Maps your code on host machine to the code inside container, allowing you to use your favourite IDE debugger capabilities. Also, you can change your code and run docker-compose restart to rerun container. This allows container to integrate your newest code

#2  Exposes port for Java debugger, usually 5005.

#3  Enables debugging on catalog-ws-server.



You also need to run to clear patch file:

Code Block
true '' > build/files/server/application.properties.patch

...

and in catalog_qt_2/server/catalog-ws-server/src/main/resources/application.properties change the first line to second line

Code Block
languagejava
themeEclipse
-spring.datasource.url=jdbc:mysql://localhost:3306/itm_catalog_qt?serverTimezone=UTC
+spring.datasource.url=jdbc:mysql://db:3306/itm_catalog_qt?serverTimezone=UTC

...

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
spring.datasource.url=jdbc:mysql://localhost:3306/itm_catalog_qt?serverTimezone=UTC

spring.datasource.username=itm_catalog_rw
spring.datasource.password=itm_catalog_rw
spring.jpa.properties.hibernate.jdbc.time_zone=UTC

server.error.include-message=always

spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=none

# This is additional http handler, on another port
# We need this one, in case we plan to use https
server.port=8081  # We have to change ports on our local instance, because 8080 is taken by container
server.http.port=8082  # This one as well
server.http.interface=0.0.0.0

keycloak.realm = ******** fair4fusion-docker-demo
keycloak.auth-server-url= *******https://sso.apps.paas-dev.psnc.pl/
keycloak.resource= *********catalogqt-cli
keycloak.realm-key= ********MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjOCDGJsBi7rxVjf0RQb8pm0LAGsEKFcH7g7mKSqpFvp1uOypUeiYe5dwlwkXAXaYeYs0J70LB8E6mtVUcykbmp+XrqD1nn3yfPxlVLSg7iCvJqMUq8udsUbsyT3M/32/kssXurgY7rX5JhdtkYeAgq+9ifIjLQZhALg+FvEsX9C+D30WQDAChEljlReb+Y4UTz2aIqz9C+90bqG1ZIX4o3Dli1PZDosTNM444CwDTbrFrenctOTDtGPodo9k2jze8McZFAIrdUYi9mKD8v0frs8NUUW/TQj9h62swXdvVAfzYTd+R7aMRG0eXMV3rJc38DfsCsF7bkqSg0b4l8GcaQIDAQAB
keycloak.bearer-only = true
keycloak.public-client=true
keycloak.principal-attribute=preferred_username

spring.mvc.dispatch-options-request=true

# These need to be commented
# If you plan to use HTTPS, make sure to uncomment this one
#server.ssl.key-store=file:///home/imas/cert/keystore.p12
#server.ssl.key-store-password=catalogqt
#server.ssl.keyStoreType=PKCS12
#server.ssl.keyAlias=tomcat

swagger-ui.authorization.header=true 

...

Warning

Change both ports in lines 14 and 15 because ports 8080 and 8081 are already taken by running docker container.

Warning

Lines from 18 to 21 should be filled with proper data! 


and then run this command:

...