Currently working on:
you may need to add some entries to your HOSTS file to point services from docker-compose.yml
to application.yml
The relevant entries are:
127.0.0.1 redis
127.0.0.1 mongo-service
127.0.0.1 kafka-broker
In windows, the hosts file can be found in: C:\Windows\System32\drivers\etc\hosts.file
In Mac, you need to edit /etc/hosts
and add the same entries
Each of the posts contains a video overview.
Configuring MongoDB & creation of characters for account: https://unreal-mmo-dev.com/2021/05/08/7-java-micronaut-with-mongodb-character-controller/
Setting up Micronaut, jooq, flyway (deprecated with v0.7): https://unreal-mmo-dev.com/2021/04/18/4-java-micronaut-dockered-postgres/
Setting up JWT Authentication (deprecated): https://unreal-mmo-dev.com/2021/04/26/5-java-micronaut-jwt-authentication/
Encode password for user, integrate with JWT: https://unreal-mmo-dev.com/2021/05/04/6-java-secure-encode-user-credential/
This project branches from the Micronaut template found here: https://github.com/yazoo321/micronaut_template
To see where components are configured, see mini tutorial on youtube: https://www.youtube.com/watch?v=PF_Bg6CgMts&t=16s
JWT Authentication described here on YouTube tutorial here: https://www.youtube.com/watch?v=acAFcDWuxhI&t=8s
In this project we rely on Docker, you can download it here: https://docs.docker.com/desktop/windows/install/ Docker will be used to spin up the dependencies, including any DBs (postgres, mongodb) and now Kafka + Zookeeper.
More in-depth Kafka instructions here: https://unreal-mmo-dev.com/2023/04/17/37-how-to-connect-your-java-micronaut-springboot-with-kafka-sasl/
There was a very useful video covering some details that can be found here: https://www.youtube.com/watch?v=bj5SKXanaAI
Kafka is spun up using 'docker-compose' so check the relevant entries there. the './configs' directory contains the necessary configs for SASL enabled Kafka Do note that you will need to change these for production use.
Some useful kafka CLI commands:
// create topic:
kafka-topics --create --bootstrap-server kafka1:9093 --replication-factor 1 --partitions 1 --topic test
--command-config /etc/kafka/configs/config.properties
// producer example:
kafka-console-producer --broker-list kafka1:9093 --topic test --producer.config /etc/kafka/configs/config.properties
// consumer example:
kafka-console-consumer --bootstrap-server kafka1:9093 --topic test --from-beginning --partition 0
--consumer.config /etc/kafka/configs/config.properties
Micronaut also offers some useful documentation: https://guides.micronaut.io/latest/micronaut-kafka-maven-java.html
In order to build the project run:
./gradlew build
In order to remove the docker container and its database, run
docker rm -f -v <container_name>
This project is a base template for getting started with micronaut + postgres + jooq + flyway + lombok.
It contains a very simple migration file (resources/db/postgres/V1__create_user_table.sql
)
to create a base users table and
an entry with a user. Modify this based on your requirements.
The inventory sample requests can be found in: resources/inventory/inventorySampleRequests
Motion sample requests can be found in: resources/motion/updateMotionRequest