The following list of tools are needed to build and run this application:
A refactoring was done on the provided SQLite database file for adding a column to represent the country and make easier to do the filter through country name.
The same was not done regarding the phone number sate (VALID or INVALID) because it was better to implement at service layer and make it possible to reuse it in a CRUD scenario.
The script is located at: microservice/src/main/resources/database/db-refactor.sql
The H2 is used for testing purposes and is automatically loaded due to Spring @DataJpaTest annotation.
In case want to override the database file, please, copy the new file to microservice/src/main/resources/database/db-refactor.sql, beforing running the build for the backend, but make sure to keep its name, customers.db.
Both dev (environment.ts) and prod (environment.prod.ts) files are pointing to the url http://localhost:8080/customers-api/v1/customers as the configuration for accessing the back-end.
In case another IP or port is needed, these files have to be change and a new build process has to be done again.
For generating the image (also on Docker Hub):
cd spa
docker build -t ricardosouzamorais/customers-spa:0.0.1 .
For running the image:
docker run -p 3000:80 ricardosouzamorais/customers-spa:0.0.1
To run it as detached (without hanging the terminal):
docker run -d -p 3000:80 ricardosouzamorais/customers-spa:0.0.1
For accessing the SPA: http://localhost:3000
The API can be viewed at: http://localhost:8080/customers-api/swagger-ui.html
For generating the image (also on Docker Hub):
mvn clean package
For running the image:
docker run -p 8080:8080 \
ricardosouzamorais/customers-microservice:0.0.1
To run it as detached (without hanging the terminal):
docker run -d -p 8080:8080 \
ricardosouzamorais/customers-microservice:0.0.1
In case you want to provide an external SQLite database file and independently of name, you can do this way (not detached):
docker run \
-e url="jdbc:sqlite:/app/input/YOUR-DATABASE-FILE-NAME" \
-v /path/to/your/external-database-file:/app/input \
-p 8080:8080 \
ricardosouzamorais/customers-microservice:0.0.1
Where:
/app/inputDBConfiguration to laod the database. Its value has to have the value from the previous example cal, which you can change only YOUR-DATABASE-FILE-NAME, like external.dbAs an example with values filled in:
docker run \
-e url="jdbc:sqlite:/app/input/external.db" \
-v /Users/ricardosm/Downloads/customers:/app/input \
-p 8080:8080 \
ricardosouzamorais/customers-microservice:0.0.1
Content type
Image
Digest
Size
8.7 MB
Last updated
almost 7 years ago
docker pull ricardosouzamorais/customers-spa