How to Get Started with YAS: Your Microservice Application in Java

Aug 7, 2024 | Programming

Welcome to the world of YAS: Yet Another Shop! This project is a fantastic way to practice building a microservice application in Java. If you’re looking to understand how to set up and run this ambitious project, you’re in the right place. Let’s dive into the world of microservices and the technologies that make YAS tick!

Tentative Technologies and Frameworks

YAS utilizes a plethora of technologies, making it a modern solution for microservice applications. Here are the core components:

  • Java 21
  • Spring Boot 3.2
  • Testcontainers
  • Next.js
  • Keycloak
  • Kafka
  • Elasticsearch
  • Kubernetes (K8s)
  • GitHub Actions
  • SonarCloud
  • OpenTelemetry
  • Grafana, Loki, Prometheus, Tempo

Local Development Architecture

To visualize how these components come together, refer to the local development architecture diagram:

Yas - local development architecture

Getting Started with Docker Compose

Now let’s move onto the practical steps of setting up YAS locally using Docker Compose. Follow these instructions meticulously:

  1. Start by getting the latest source code.
  2. Add the following records to your host file:
    127.0.0.1 identity
    127.0.0.1 api.yas.local
    127.0.0.1 pgadmin.yas.local
    127.0.0.1 storefront
    127.0.0.1 backoffice
    127.0.0.1 loki
    127.0.0.1 tempo
    127.0.0.1 grafana
    127.0.0.1 elasticsearch
    127.0.0.1 kafka
    127.0.0.1 akhq
  3. Open your preferred terminal, navigate to the yas directory, and run docker compose up. Wait until all containers are up and running.
    Warning: Ensure your system has at least 16GB of RAM to run all containers. If not, you can use docker compose -f docker-compose.yml up to only run core services.
  4. Once all containers are running, start the source connectors by executing the script: navigate to the YAS root folder and type .start-source-connectors.sh.
  5. Open your web browser to access:

    Please note that on your first run, the storefront and backoffice might not behave as expected. If this happens, stop all containers (press Ctrl + C) and rerun docker compose up.

Useful Links for Further Exploration

You might also want to explore:

Understanding the Code – An Analogy

The entire YAS application acts like a well-orchestrated orchestra. Each component, whether it’s Java, Spring Boot, or Elasticsearch, plays its unique role, just like each instrument contributes to a musical symphony. Imagine Java as the conductor who guides the overall performance, while Spring Boot serves as the violin section, providing the melody. The other instruments, like Kafka and Grafana, create harmonies that ensure data flows smoothly and is presented in a visually appealing manner.

Troubleshooting Tips

Not every setup goes smoothly, and you might run into a few bumps along the way. Here are some troubleshooting ideas to help you out:

  • Issue: Containers fail to start.
    • Solution: Check your system’s RAM allocation, ensure you have at least 16GB available if running all services, or try only the core services.
  • Issue: Storefront and Backoffice not loading correctly.
    • Solution: Stop all containers and restart using the provided Docker commands.
  • General: Reviewing logs might provide insights into what’s going wrong. Use tools like Grafana to monitor.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Additional Resources

For comprehensive documentation and guidance, don’t forget to check:

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox