Skip to content

redhat-developer-demos/hybradized-todo-app

Repository files navigation

Hybrid Cloud Quarkus/CockroachDB/Skupper

This demo deploys a Quarkus TODO app in an hybrid cloud using Skupper and Kubernetes/OpenShift. The database used is CockroachDB as it is a database that fits perfectly the needs of replication information across different clusters.

Preparing

Rename the .env.example to .env and fill with the information required to access to your clusters.

2 backends (1 in each cluster) & 1 DB (primary cluster)

make create_namespace_1
make create_namespace_2
make deploy_single_cockroachdb
make db
make deploy_backend_1
make frontend_1
make expose_1

make backend_cluster_1
make backend_cluster_2
make deploy_backend_2

1 backend & 2 DB (primary cluster and replica cluster)

make create_namespace_1
make create_namespace_2
make cluster_1
make cluster_2
make db
make backend
make frontend
make expose

Local Deployment Single Node

You can run the application on local machine with a single CockroachDB node.

You need to have Docker running to start CockroachDB.

Open 3 terminal windows:

Terminal 1 (Cockroach)
docker run -ti --rm --name roach -p 8888:8080 -p 26257:26257 cockroachdb/cockroach:v20.2.3 start-single-node --insecure
Terminal 2(Create DB)
docker exec -ti roach ./cockroach sql --insecure --execute="CREATE DATABASE todo;"
Terminal 2 (Start Backend)
cd todo-backend

./mvnw clean package -DskipTests
java -Dquarkus.http.port=9090 -Dquarkus.datasource.jdbc.url=jdbc:postgresql://localhost:26257/todo -jar target/todo-backend-1.0.0-runner.jar
Terminal 3 (Start Frontend)
cd todo-frontend

./mvnw clean package -DskipTests
java -Dio.quarkus.sample.BackendService/mp-rest/url=http://localhost:9090 -jar target/todo-frontend-1.0.0-runner.jar

Open a browser and access to http://localhost:8080/todo.html

Local Dev mode

If you want to run the demo in Quarkus dev mode you can do it as in this mode the backends are configured in different ports and embedded H2 is used instead of CockroachDB.

Open two terminals:

Terminal 1
cd todo-backend

./mvnw compile quarkus:dev
Terminal 2
cd todo-frontend

./mvnw compile quarkus:dev

Open a browser and access to http://localhost:8080/todo.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published