Run REST API from a .jar file

Requirements

In order to run the application, the host needs to have the following installed:

  • Java JDK 17 or higher. The version can be checked with java --version.

Run from a .jar file

One of the deployment options is to run the jar file manually

java -jar app-[version].jar

After running the above command, the service with the in-memory H2 database is running.

For production case, it’s recommended to use a separate database instead of an in-memory one. It can be done via environment variables DB_URL, DB_USER, DB_PASSWORD, SQL_DIALECT.

export DB_URL=[jdbc url]; \
export DB_USER=[database user]; \
export DB_PASSWORD=[database password]; \
export SQL_DIALECT=Postgres; \
java -jar cli-[version].jar

The default port is 8081. To change the port you can set the SERVER.PORT variable.

export SERVER.PORT=[port]; \
java -jar app-[version].jar

After running the above command, the terminal should show logging messages confirming the service is up:

01-04-2022 15:55:27.095 [main] INFO  l.lockservice.StandardLockService.info - Successfully released change log lock
01-04-2022 15:55:27.870 [main] INFO  o.s.b.a.e.web.EndpointLinksResolver.<init> - Exposing 1 endpoint(s) beneath base path '/actuator'
01-04-2022 15:55:27.907 [main] INFO  o.a.coyote.http11.Http11NioProtocol.log - Starting ProtocolHandler ["http-nio-8081"]
01-04-2022 15:55:27.914 [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer.start - Tomcat started on port(s): 8081 (http) with context path ''
01-04-2022 15:55:27.923 [main] INFO  i.s.t.app.TestingSuiteEngineApiKt.logStarted - Started TestingSuiteEngineApiKt in 3.574 seconds (JVM running for 4.486)

Once the REST HTTP service is up and running, you can visit a Swagger UI by the following link:

http://${API_SERVICE_URL}:${API_SERVICE_PORT}/api/swagger-ui/index.html?configUrl=/api/rest-api-docs/swagger-config#/controller/runWorkflow

You can find a list of supported Application properties.