Skip to content

How to start a standard java Qanary component

Dennis Schiese edited this page Mar 11, 2024 · 2 revisions

A standard java Qanary component can be started in two different ways. The simplest way to start a component is to use the Dockerfile. The other way is to start the component from the built jar file.

Standard component properties

Most standard components have the same kind of properties they need to start correctly. You can find all properties in the application.properties file, this file will usually be saved in /src/main/resources/config/. A lot of Properties will be prefilled like server.port and spring.application.name.

Start component from Dockerfile

If you want to change properties for your component, you can use environment variables for this. All properties can simply set by using the property name in caps and replace ever dot with an underscore. E.g. : server.port will be SERVER_PORT. To start the component, you just need to run a simple command:

docker run -p 5555:5555 \
-e SERVER_PORT=5555 \
-e SPRING_BOOT_ADMIN_URL=http://example.pipeline:8080 \
-e SPRING_BOOT_ADMIN_CLIENT_INSTANCE_SERVICE-BASE-URL=http://example.component:5555 \
example-component:latest

Start component from builded jar file

If you want to change properties for your component, you can do this directly in the application.properties file. However, it is better to create a local.application.properties file next to the application.properties file and overwrite all the necessary properties.

The most java Qanary component using maven, so for the build process you can simple use the maven install command in the root folder of the component:^1

mvn clean install

After downloading all necessary dependencies and building the component you will find a target folder in the component folder. In this folder you will find the jar file, which you can start with this command:

  • name of the component 'example component'
java -jar example-component.jar
Clone this wiki locally