{"id":17006402,"url":"https://github.com/mcruzdev/pizza-quarkus","last_synced_at":"2026-01-05T02:04:55.544Z","repository":{"id":221439035,"uuid":"754379747","full_name":"mcruzdev/pizza-quarkus","owner":"mcruzdev","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-12T20:05:21.000Z","size":1170,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T10:43:35.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcruzdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-07T23:34:59.000Z","updated_at":"2024-12-07T13:11:11.000Z","dependencies_parsed_at":"2024-02-12T21:31:00.190Z","dependency_job_id":null,"html_url":"https://github.com/mcruzdev/pizza-quarkus","commit_stats":null,"previous_names":["mcruzdev/pizza-quarkus"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcruzdev%2Fpizza-quarkus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcruzdev%2Fpizza-quarkus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcruzdev%2Fpizza-quarkus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcruzdev%2Fpizza-quarkus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcruzdev","download_url":"https://codeload.github.com/mcruzdev/pizza-quarkus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244945591,"owners_count":20536296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T05:05:44.926Z","updated_at":"2026-01-05T02:04:55.539Z","avatar_url":"https://github.com/mcruzdev.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloud-Native Pizza Delivery system\n\nThis repository contains a simple example for a Pizza Store application using Kubernetes, [Dapr](https://dapr.io) and [Testcontainers](https://testcontainers.com) with [Quarkus](https://pt.quarkus.io/) to enable developers with an awesome developer experience.\n\n\u003e This repository is a copy of the https://github.com/salaboy/pizza repository, rewritten using Quarkus.\n\n![testcontainers-dapr-and-quarkus-logo](imgs/testcontainers-dapr-quarkus.png)\n\nYou can run this application on any Kubernetes cluster by following the step-by-step instructions described in this document. \n\n![pizza-store](./imgs/pizza-store.png)\n\nThe Pizza Store application simulates placing a Pizza Order that is going to be processed by different services. The application is composed by the Pizza Store Service which serve as the front end and backend to place the order. The order is sent to the Kitchen Service for preparation and once the order is ready to be delivered the Delivery Service takes the order to your door.\n\n![architecture](./imgs/architecture.png)\n\nAs any other application, these services will need to store and read data from a persistent store such as a Database and exchange messages if a more event-driven approach is needed.\n\nThis application uses PostgreSQL and Kafka, as they are well-known components among developers.\n\n![architecture+infra](./imgs/architecture_infra.png)\n\nAs you can see in the diagram, if we want to connect to PostgreSQL from the Pizza Store Service we need to add to our applications the PostgreSQL driver that must match with the PostgreSQL instance version that we have available. A Kafka client is required in all the services that are interested in publishing or consuming messages/events. Because you have Drivers and Clients that are sensitive to the available versions on the infrastructure components, the lifecycle of the application is now bound to the lifecycle of these components.\n\nAdding Dapr to the picture not only breaks these dependencies, but also remove responsabilities from developers of choosing the right Driver/Client and how these need to be configured for the application to work correctly. Dapr provides developers building block APIs such as the StateStore and PubSub API that developer can use without know the details of which infrastructure is going to be connected under the covers.\n\n![architecture+dapr](./imgs/architecture_dapr.png)\n\nWhen using Dapr, developers can trust that the [building block APIs](https://docs.dapr.io/concepts/building-blocks-concept/) are stable, while the teams in charge of the infrastructure can swap versions and services without impacting the application code or behavior.\n\n## Installation\n\nIf you don't have a Kubernetes Cluster, you can [install KinD](https://kind.sigs.k8s.io/docs/user/quick-start/) to create a local cluster to run the application. \n\nOnce you have KinD installed, you can run the following command to create a local Cluster: \n\n```\nkind create cluster\n```\n\nThen we will install [Dapr](https://dapr.io) into our fresh new cluster by running the following command: \n\n```\nhelm repo add dapr https://dapr.github.io/helm-charts/\nhelm repo update\nhelm upgrade --install dapr dapr/dapr \\\n--version=1.12.0 \\\n--namespace dapr-system \\\n--create-namespace \\\n--wait\n```\n\n## Installing infrastructure for the application\n\nWe will be using Kafka for sending messages between services: \n\n```\nhelm install kafka oci://registry-1.docker.io/bitnamicharts/kafka --version 22.1.5 --set \"provisioning.topics[0].name=events-topic\" --set \"provisioning.topics[0].partitions=1\" --set \"persistence.size=1Gi\" \n```\n\nWe will be using PostgreSQL as our persistent store, but before installing the PostgreSQL Chart run:\n\n```\nkubectl apply -f k8s/pizza-init-sql-cm.yaml\n```\n\nThen: \n\n```\nhelm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --version 12.5.7 --set \"image.debug=true\" --set \"primary.initdb.user=postgres\" --set \"primary.initdb.password=postgres\" --set \"primary.initdb.scriptsConfigMap=pizza-init-sql\" --set \"global.postgresql.auth.postgresPassword=postgres\" --set \"primary.persistence.size=1Gi\"\n\n```\n\n## Installing the Application\n\nTo install the application you only need to run the following command: \n\n```\nkubectl apply -f k8s/\n```\n\nThis install all the application services. To avoid dealing with Ingresses you can access the application by using `kubectl port-forward`, run to access the application on port `8080`: \n\n```\nkubectl port-forward svc/pizza-store 8080:80\n```\n\nThen you can point your browser to [`http://localhost:8080`](http://localhost:8080) and you should see: \n\n![Pizza Store](imgs/pizza-store.png)\n\n## Building from source / changing the services\n\nThe application services are written using Java + Quarkus. These services use the Dapr Extension to interact with the Dapr [PubSub](https://docs.dapr.io/getting-started/quickstarts/pubsub-quickstart/) and [Statestore](https://docs.dapr.io/getting-started/quickstarts/statemanagement-quickstart/) APIs. \n\nTo run the services locally you can use the [Testcontainer](https://testcontainaers.com) integration already included in the projects. \n\nFor example you can start a local version of the `pizza-store` service by running the following command inside the `pizza-store/` directory (this requires having Java and [Maven](https://maven.apache.org/) installed locally):\n\n```\nquarkus dev\n```\n\nThis, not only start the `pizza-store` service, but it also uses the [Testcontainers + Dev Services for Dapr](https://github.com/quarkiverse/quarkus-dapr) integration to configure and wire up a Dapr configuration for local development. In other words, you can now use Dapr outside of Kubernetes, for writing your service tests without the need to know how Dapr is configured. \n\n\nOnce the service is up, you can place orders and simulate other events coming from the Kitchen and Delivery services by sending HTTP requests to the `/events` endpoint. \n\nUsing [`httpie`](https://httpie.io/) this look like this: \n\n```\nhttp :8080/events Content-Type:application/cloudevents+json \u003c pizza-store/event-in-prep.json\n```\n\nIn the Application you should see the event recieved that the order moving forward. \n\n\n# Resources and references\n\n- [Platform engineering on Kubernetes Book](http://mng.bz/jjKP?ref=salaboy.com)\n- [Testcontainers for Go Developers](https://www.atomicjar.com/2023/08/local-development-of-go-applications-with-testcontainers/)\n- [Cloud native local development with Dapr and Testcontainers](https://www.diagrid.io/blog/cloud-native-local-development)\n\n# Feedback / Comments / Contribute\n\nFeel free to create issues or get in touch with us using Issues or via [Twitter @Salaboy](https://twitter.com/salaboy)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcruzdev%2Fpizza-quarkus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcruzdev%2Fpizza-quarkus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcruzdev%2Fpizza-quarkus/lists"}