An example project that uses Spring Boot and a Postgres DB using JPA specifications
run the following command in order to spin up postgres:
cd to ./docker folder and run docker-compose up -d
The DB is managed by a Liquibase framework.
SQL procedures are stored at: resource/db/changelog/changes
DB credentials can be taken from resources/application.properties file.
Note: the program is using a default db with the name "postgres" that comes with Postgres image by default.
If from some reason this will be changed in the future, then make sure to create the db manually.
Use the following example to add Server entry to the application:
curl --location --request POST 'http://localhost:8080/api/server/addServer' --header 'Content-Type: application/json' --data-raw '{ { "ip": "192.168.1.11", "os": "ubuntu", "osType": "linux", "osVersion": "24.04", "hwType": "x400" } }'
Use the following curl to retrieve all servers from DB:
curl --location --request GET 'http://localhost:8080/api/server/getServers'
Example of returned date:
[{ "id": 1, "ip": "192.168.1.77", "os": "linux", "osVersion": "fedora", "hwType": "x645" }, { "id": 2, "ip": "192.168.1.43", "os": "linux", "osVersion": "arch linux", "hwType": "x332" }]