Before starting the setup, ensure that the following tools and services are installed and running on your local machine:
-
Java SE 17
Download and install Java SE 17 from the official website. -
Maven 3.6 or higher
Download Maven from here. -
MySQL
Install MySQL and ensure it is running. You can download it from here. -
Keycloak
Install and set up Keycloak from here. -
Kafka
Download and configure Kafka from Apache Kafka. -
Immudb
Download and install Immudb from here.NOTE: While our current implementation uses immudb for tamper-evident logging, a possible alternative could be implemented using PostgreSQL with cryptographic hashing (e.g., SHA-256). In this approach, each audit entry includes a hash of the row’s own contents (such as action, actor, timestamp, and data). These hashes are generated within the system, and the keys used for hashing are not exposed externally—ensuring that any unauthorized modification to the data would result in a hash mismatch during verification. While updates to the audit log are technically possible, they can only be performed through the controlled system logic, preserving the integrity of the log. This method may suit projects looking for a simple, transparent, and fully open-source alternative to immudb
Start by cloning the repository and switching to the main branch:
git clone https://github.com/Food-Fortification/Food-Fortification-Quality-Management-System.git
cd Food-Fortification-Quality-Management-System
git checkout mainNavigate to the fortification_parent directory and build the parent pom.xml file:
cd fortification_parent-
Open the
pom.xmlfile and make the following changes:- Set
<version>to0.0.1. - Set
<packaging>topom.
- Set
-
Deploy the service:
mvn deploy
-
Update the
<version>to0.0.2and change the<packaging>tojar. -
Redeploy the service:
mvn deploy
This will store the parent POM and common dependency JARs in your local Maven repository (.m2/repository), which will be accessible to all microservices.
Ensure that the following services are running locally:
-
MySQL
Start the MySQL service on your machine. -
Keycloak
Start Keycloak by running its startup script:
<keycloak-installation-dir>/bin/standalone.sh- Kafka
Start both Kafka and Zookeeper services:
<kafka-installation-dir>/bin/zookeeper-server-start.sh config/zookeeper.properties
<kafka-installation-dir>/bin/kafka-server-start.sh config/server.properties- Immudb
Run Immudb:
<immudb-installation-directory>/immudb service install - Create a new Realm in Keycloak.
- Set up a Client with Service Account role-based access in the new realm.
- Create a new database and user in Immudb. Ensure that the user has read and write access to the new database.
Example SQL commands to execute in Immudb:
./immuadmin database create mydatabase;
./immuadmin user create user1 readwrite mydatabaseFor each microservice, navigate to the src/main/resources directory and create an application-local.properties file. Add necessary configurations like database URLs, Keycloak details, Kafka settings, and Immudb credentials. These properties will replace placeholders in the application.properties file. For interservice communication add the required microservice urls like IAM_BASE_URL,FORTIFICATION_BASE_URL in the format <domain name>:<port>/<context path>
- Add the necessary BPMN (Business Process Model and Notation) files for the fortification service under the
src/main/resources/processesfolder. - These files will be picked up by Spring Activiti during runtime for workflow management.
Run each microservice individually using Maven:
mvn spring-boot:run -Dspring.profiles.active=localEnsure that all services start successfully and communicate with the required external services (MySQL, Keycloak, Kafka, and Immudb).
Once all microservices are running, you can access the OpenAPI documentation for each service using a browser.
For example, to access the Swagger UI for Iam service, use:
http://localhost:8089/iam/swagger-ui/index.html
Repeat this step for other microservices, changing the port and context path according to each microservice's configuration.
After the services are up and running:
- Navigate to the Fortification Service Swagger docs.
- Find the Update DSL API under the admin controller.
- Use this API to send the DSL JSON in the request body.
This will create the required product categories and roles based on the DSL (Domain-Specific Language) flow specified in the system.