Run REST API in Docker
Requirements
In order to run the application, the host needs to have the following installed:
-
Docker
orDocker Desktop
.
Run in Docker
One of the deployment options is to run the Docker service
docker run -i -p [port]:8081 -t [image name]:[version]
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 in-memory one. It can be done via environmental variables DB_URL, DB_USER, DB_PASSWORD, SQL_DIALECT
docker run -i -p [port]:8081 \
-e DB_URL=[jdbc url] \
-e DB_USER=[database user] \
-e DB_PASSWORD=[database password] \
-e SQL_DIALECT=Postgres \
-t [image name]:[version]
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.