Prerequisites:
- Maven 3
- Java 11
- Docker
- Docker hub account
- Make sure you have below ports: 8080, 3306, 9000
- Postman**
How to get the code: Clone report from GitHub
How to install database
- Locate in docker-compose.yml directory using the terminal
- Execute
docker-compose upcommand. - Execute
docker-compose psin the same directory, but using a different terminal instance, take note of the container with prefix "database_gbm-challenges-server", you will need it later on. - Open this URL in your browser
- Set below parameters to establish the connection properly:
- System: MySQL
- Server: gbm-challenges-server
- Username: root
- Password: cvillarreal1990
- Database: gbm_challenge
- Permanent login: Checked
- Click on SQL Command option from the left panel.
- Copy and paste the content from ddl.sql.
- Click on execute button.
- Then click again in SQL Command option and copy and paste the content issuers_dml.sql.
- Ready database is up and running.
Create network in Docker.
- In order to make your database container visible for application container, you need to create a network using:
docker network create gbm-challenge-connection - Then get network's IP using
docker network inspect gbm-challenge-connection - Connect database container to the network created using
docker network connect gbm-challenge-connection database_gbm-challenges-server_1(note: last parameter is container name, make sure it matches from the one you got from db installation)
How to install Java Application
- Locate in application folder.
- Execute
mvn spring-boot:build-imagecommand - Then execute
docker run -it -p9000:9000 --env-file variables.env --network gbm-challenge-connection gbm-challenge:0.0.1-SNAPSHOT - Application should start right away under your port 9000, you can test it using this link.
- In case you would like to review sample request, you can find some sample request in this postman collection.
How to query tables
- Open this URL in your browser.
- Click on the name of the table you want to query (like tbl_account to export account_id).
- Chose Select data from the menu and data will be displayed.
Note:
**Is very important to keep in mind that DB has no persistance enable, hence installation
is required if you delete the container, in case you want to enable persistance in the execution.
please execute docker volume create --name=mydb command and uncomment code from
docker-compose.yml **