{"id":21427970,"url":"https://github.com/redhat-developer-demos/northwind-traders","last_synced_at":"2025-07-14T10:31:38.246Z","repository":{"id":87145331,"uuid":"548832266","full_name":"redhat-developer-demos/northwind-traders","owner":"redhat-developer-demos","description":"Eclipse JKube remote-dev feature demo project","archived":false,"fork":false,"pushed_at":"2024-08-12T09:40:24.000Z","size":3063,"stargazers_count":23,"open_issues_count":0,"forks_count":22,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-08T06:51:10.412Z","etag":null,"topics":["java","jkube","kubernetes","openshift"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redhat-developer-demos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-10-10T08:52:10.000Z","updated_at":"2024-08-12T09:40:29.000Z","dependencies_parsed_at":"2024-03-19T11:34:38.051Z","dependency_job_id":"b4ea33c3-49c0-41bf-9779-e429ad319b25","html_url":"https://github.com/redhat-developer-demos/northwind-traders","commit_stats":null,"previous_names":["redhat-developer-demos/northwind-traders"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/redhat-developer-demos/northwind-traders","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fnorthwind-traders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fnorthwind-traders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fnorthwind-traders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fnorthwind-traders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-developer-demos","download_url":"https://codeload.github.com/redhat-developer-demos/northwind-traders/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer-demos%2Fnorthwind-traders/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265280631,"owners_count":23739851,"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":["java","jkube","kubernetes","openshift"],"created_at":"2024-11-22T22:09:12.423Z","updated_at":"2025-07-14T10:31:35.566Z","avatar_url":"https://github.com/redhat-developer-demos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Contribute](https://www.eclipse.org/che/contribute.svg)](https://workspaces.openshift.com#https://github.com/redhat-developer-demos/northwind-traders/)\n\nNorthwind Traders\n=================\n\n![A diagram of the project's architecture](./diagram-remote.png)\n\n## Deploy the application\n\nPlease jump to the [walk-through](#id-remote-dev-walk-through) section for a step-by-step guide on how to test-drive the application. _In case you're only interested in deploying the application, please follow the instructions below._\n\nTo easily deploy the required services, this project provides a JBang script that will deploy the application to OpenShift.\n\nIf you're running from an SH compatible terminal, you can run the following command:\n```shell\n./deploy-to-openshift.sh\n```\n\nFrom any other platform, you can run the following commands:\n\n```shell\ncd prod\njbang PrepareEnvironment.java\ncd ..\nmvn clean package oc:build oc:resource oc:apply\n```\n\n## Services\n\n### Northwind traders\n\nModule: [northwind](./northwind)\n\nWeb application for the renowned Northwind traders database.\n\n\n### Mail\n\nModule: [mail](./mail)\n\nSends email notifications to Mailinator.\n\nThis application is a port of a previous iteration used for Barcelona JUG presentation in 2020.\n\nhttps://www.mailinator.com/v4/public/inboxes.jsp?to=northwind-warehouse\n\n### Order Faker\n\nModule: [order-faker](./order-faker)\n\nFake orders and send them to the Northwind application. A new order will be sent every ~6 seconds.\n\nThis application could represent a mobile-application sending requests to the Northwind REST API.\n\n### React Frontend\n\nModule: [react-frontend](./react-frontend)\n\nA React frontend skeleton JavaScript application to be able to interact with the Northwind service.\n\nThe application is 100% JavaScript. However, there is a pom.xml containing Eclipse JKube configuration to be able to deploy the application to OpenShift and to run the remote-dev goal.\n\n## Contributing\n\n### Northwind\n\n#### Building the Frontend\n\nThe frontend uses ES Modules in the browser, so it doesn't need a transpilation process.\nHowever, the npm modules/libraries it relies on need to be packaged into a single file so that they can be consumed.\nYou can perform this step by running the following command:\n```shell\ncd northwind/tools\nnode create-bundle.js\n```\nThe generated files should be persisted in the VCS, or generated before the application is executed/packaged.\n\n\u003ca name=\"id-remote-dev-walk-through\"\u003e\u003c/a\u003e\n## Remote Dev demo walk-through\n\n### Prerequisites\nTo complete this guide, you need:\n\n- Roughly 10 minutes\n- An IDE\n- An Openshift cluster. The Red Hat developer sandbox is good enough to use. See https://developers.redhat.com/developer-sandbox\n- [Jbang](https://www.jbang.dev/) to deploy the RabbitMQ and PostgreSQL services\n- JDK 17+\n- Apache Maven 3.6.3 or higher\n\n### Connect to the cluster\nOnce the Openshift cluster is up and running, you can connect your local machine to the remote cluster using the command provided in the Openshift Developer Console: Click on the question mark icon, `Command line tools`, `Copy login command`. \n\n![Openshift copy login command](./assets/openshift-copy-login.png)\n\nIn my case, the proposed command to login was something similar to:\n\n    $ oc login --token=xxxxxxxxxxx --server=https://api.sandbox.x8i5.p1.openshiftapps.com:6443\n\nIf you don't have the `oc` command, you can download it from the `Command line tools` page.\n\nThe `oc login` command should update your `~/.kube/config` file that contains all the connection configurations to your various Kubernetes clusters. JKube and the `deploy-to-openshift.sh` script are relying on this file to connect to the right cluster.\n\n### Deploy to Openshift\nDeploy all the services to the cluster with the command:\n\n```shell\n./deploy-to-openshift.sh\n```\n\n### Try the application\nIn the Openshift developer console `Topology` view, you should see all the services deployed.\nYou can access to the Frontend through the `Northwind` service:\n\n![Openshift Topology view](./assets/openshift-topology.png)\n\nIn the frontend, we can see the orders being injected on the fly by the `order-faker` service.\n\nClick on the \"send mail\" button of one of the orders.\n\n![Northwind frontend send button](./assets/northwind-send.png)\n\nThe Northwind application is now preparing the mail to be sent, send the event with the mail content to the RabbitMQ broker.\nThe Mail service should then receive the event and send the mail to the mailinator.\n\nCheck that you have receive a new email in https://www.mailinator.com/v4/public/inboxes.jsp?to=northwind-warehouse\n\n![Mailinator 1](./assets/mailinator-1.png)\n\n### Remote dev\nLet's say we want to modify the subject of the mail. This is done in [MailService.java](./northwind/src/main/java/com/redhat/developers/northwind/dashboard/MailService.java) in the Northwind service.\n\nIt is hard to test your modifications locally if you don't have all the services available. Developers could test in the dev remote cluster but this way of doing involves rebuilding the container and redeploying it. This is not very handy.\n\nJKube provides a new feature that redirects all the traffic, intended to your service, to your local application. This feature also redirects the traffic from your local application to the remote services in the cloud.\n\n#### Setup\nGo to the Northwind project and start Quarkus devmode\n\n```shell\n$ cd northwind;\n$ mvn quarkus:dev\n```\n\nIn another terminal, also in the Northwind project, run the `remote-dev` goal:\n\n```shell\n$ cd northwind;\n$ mvn oc:remote-dev\n```\n\nYou should see message like\n```\n[INFO] k8s: Kubernetes Service northwind-db:5432 is now available at local port 5432\n[INFO] k8s: Kubernetes Service rabbit-mq:5672 is now available at local port 15672\n[INFO] k8s: Local port '8080' is now available as a Kubernetes Service at northwind:8080\n```\n\nAccess/refresh the frontend. It should work now as you have not done anything. You can try to send an email and check that it has been received in mailinator. It works as before.\n\n![Mailinator 2](./assets/mailinator-2.png)\n\n#### Live modification\n\nOpen the file [MailService.java](./northwind/src/main/java/com/redhat/developers/northwind/dashboard/MailService.java) and the `sendOrder` method, let's replace the line\n\n```java\n  final String subject = \"Order \" + orderId + \" must be shipped\";\n```\n\nwith the translation in French\n```java\n  final String subject = \"La commande \" + orderId + \" doit être expédiée\";\n```\n\nJust go back the the Northwind frontend and send an email. Back to mailinator, the subject of the last email should be updated with the translation.\n\n![Mailinator 1](./assets/mailinator-3.png)\n\nYou can even change the frontend in [app.njs](./northwind/src/main/resources/META-INF/resources/app.mjs) with an uppercase `T` in `Traders`.\n\n![Edit frontend](./assets/edit-frontend.png)\n\n\nStop the `remote-dev` by typing `Ctrl-c` in the terminal where it has been started\n\n```\n[INFO] getOrCreateProvider(BC) created instance of org.bouncycastle.jce.provider.BouncyCastleProvider\n[INFO] Server announced support for publickey-hostbound@openssh.com version 0\n[INFO] k8s: Kubernetes Service northwind-db:5432 is now available at local port 5432\n[INFO] k8s: Kubernetes Service rabbit-mq:5672 is now available at local port 15672\n[INFO] k8s: Local port '8080' is now available as a Kubernetes Service at northwind:8080\n^C[INFO] k8s: Stopping remote development service...\nRemoving JKube remote development Pod [jkube-remote-dev-0b3aaa3a-c9dd-4e25-9d86-cfeb15ac0d5b]...\nRemote development service stopped\n```\n\nEverything should be back to normal now and serving the original Northwind service.\n\n#### Behind the scene\nJKube `remote-dev` is creating a proxy service and redirects all the traffic to your local computer through SSH tunnels.\nThe Northwind service is still there, but not served anymore as long as the `remote-dev` is running.\nFor the access to the remote services from your local application, it is also done through SSH tunnels and the same proxy, based on configuration made in the [pom.xml](./northwind/pom.xml) file:\n\n```xml\n      \u003cplugin\u003e\n        \u003cgroupId\u003eorg.eclipse.jkube\u003c/groupId\u003e\n        \u003cartifactId\u003eopenshift-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e${jkube.version}\u003c/version\u003e\n        \u003cconfiguration\u003e\n          \u003cremoteDevelopment\u003e\n            \u003clocalServices\u003e\n              \u003clocalService\u003e\n                \u003cserviceName\u003enorthwind\u003c/serviceName\u003e\n                \u003cport\u003e8080\u003c/port\u003e\n              \u003c/localService\u003e\n            \u003c/localServices\u003e\n            \u003cremoteServices\u003e\n              \u003cremoteService\u003e\n                \u003chostname\u003enorthwind-db\u003c/hostname\u003e\n                \u003cport\u003e5432\u003c/port\u003e\n              \u003c/remoteService\u003e\n              \u003cremoteService\u003e\n                \u003chostname\u003erabbit-mq\u003c/hostname\u003e\n                \u003cport\u003e5672\u003c/port\u003e\n                \u003clocalPort\u003e15672\u003c/localPort\u003e\n              \u003c/remoteService\u003e\n            \u003c/remoteServices\u003e\n          \u003c/remoteDevelopment\u003e\n        \u003c/configuration\u003e\n      \u003c/plugin\u003e\n```\n\nTo have it working, the hostname of the remote service should be replaced with the local port that have been created. In a Quarkus app, this is done in [application.properties](./northwind/src/main/resources/application.properties) to pick different URL while in devmode:\n\n```properties\nquarkus.datasource.reactive.url=postgresql://northwind-db:5432/northwind\n%dev.quarkus.datasource.reactive.url=postgresql://localhost:5432/northwind\n\nrabbitmq-host=rabbit-mq\nrabbitmq-port=5672\nrabbitmq-username=jkube\nrabbitmq-password=pa33word\n%dev.rabbitmq-host=localhost\n%dev.rabbitmq-port=15672\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-developer-demos%2Fnorthwind-traders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-developer-demos%2Fnorthwind-traders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-developer-demos%2Fnorthwind-traders/lists"}