Skip to content

Commit

Permalink
Updated guides for Hibernate with Panache
Browse files Browse the repository at this point in the history
  • Loading branch information
bmeklund committed Nov 13, 2024
1 parent 1d83dbb commit a501837
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
5 changes: 3 additions & 2 deletions documentation/modules/ROOT/pages/extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ echo "This is a bash shell command that you can copy/paste by selecting"
----

=== Access Your Development Environment
---

### First Step: Connect to your Developer Sandbox environment!

Expand Down Expand Up @@ -104,7 +105,7 @@ Once you log in, you’ll be placed on the *Create Workspace* dashboard. Copy th

image::ds-landing.png[ds, 800]

A new window or tab in your web browser will open automatically to showcase the progess about *Starting workspace quarkus-workshop*. It takes about *60* seconds to finish the process.
A new window or tab in your web browser will open automatically to showcase the progess about *Starting workspace quarkus-workshop*. It can take a few minutes the first time to finish the process, but will be quicker next time.

image::starting-workspace.png[ds, 800]

Expand Down Expand Up @@ -303,7 +304,7 @@ Deploy the `people` microservice by executing the following shell script in a De
sh scripts/deploy-people.sh %USER_ID%-dev
----

Wait for the script to complete before continuing.
Wait for the script to complete before continuing. This will take a few minutes as we will run a native build and deploy the artifact to our cluster.

When the script completes, the app is deployed to OpenShift. You can see it in the OpenShift Console. From the console make sure to switch to the developer perspective:

Expand Down
33 changes: 26 additions & 7 deletions documentation/modules/ROOT/pages/panache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,17 @@ You should get up to 2 records returned (since we passed `length=2` in the query

== Deploy to OpenShift

Our production environment needs a "real" database so let's deploy a Postgres database to OpenShift. Back in the {{ CONSOLE_URL }}/topology/ns/{{ USER_ID }}-project[Topology View^], select **+Add to Project** on the left. Then, Type in `PostgreSQL (Ephemeral)` in the search box, and select the *PostgreSQL (ephemeral)*:
Our production environment needs a "real" database so let's deploy a Postgres database to OpenShift.

Back in the Developer Sandbox and the OpenShift console in the Developer Perspective click the *Topology View*

Select **+Add to Project** on the left. Then, Type in `PostgreSQL (Ephemeral)` in the search box, and select the *PostgreSQL (ephemeral)*:

image::db.png[db, 700]

Select *Instantiate Template* and fill in the following fields, leaving the others as their default values:

* **Namespace** (the first one): Select `{{ USER_ID }}-project`
* **Namespace** (the first one): Select *%USER_ID%-dev*
* **Namespace** (the _second_ one): `openshift`
* **Database Service Name**: `postgres-database`
* **PostgreSQL Connection Username**: `sa`
Expand All @@ -580,7 +584,7 @@ image::db-postgres-values.png[db, 700]

Select *Create*.

And label the items with proper icons:
And label the items with proper icons by running these commands in your terminal in DevSpaces:

[source,sh,role="copypaste"]
----
Expand All @@ -590,7 +594,7 @@ oc label dc/postgres-database app.kubernetes.io/part-of=people --overwrite && \
oc annotate deployment/people app.openshift.io/connects-to=postgres-database --overwrite
----

This will deploy the database to our new project. Select the {{ CONSOLE_URL }}/topology/ns/{{ USER_ID }}-project[Topology View^] to see it:
This will deploy the database to our new project. View the changes in the Topology view in the Developer Perspective:

image::database-deployment.png[inventory_db_deployments, 700]

Expand Down Expand Up @@ -626,7 +630,7 @@ oc label dc/postgres-database app.kubernetes.io/part-of=people --overwrite && \
oc annotate deployment/people app.openshift.io/connects-to=postgres-database --overwrite
----

Back on the {{ CONSOLE_URL }}/topology/ns/{{ USER_ID }}-project[Topology View^], make sure it's done deploying (dark blue circle):
Back on the Topology View, make sure it's done deploying (dark blue circle):

[NOTE]
====
Expand All @@ -643,10 +647,25 @@ We can access using `curl` once again to find everyone born in or before the yea

[source,sh,role="copypaste"]
----
curl -s $(oc get route people -o=go-template --template={% raw %}'{{ .spec.host }}'{% endraw %})/person/birth/before/2000 | jq
curl -s $(oc get route people -o=go-template --template='{{ .spec.host }}')/person/birth/before/2000 | jq
----

Now lets access our GUI for this application. Run the below command to get the route for your application

[source,sh,role="copypaste"]
----
oc get route people -o=go-template --template='{{ .spec.host }} {{printf "\n"}}'
----

Open a new browser tab and paste the result and also add the following endpoint to it to view the result */datatable.html*

The url should look something like this:
[source,console]
----
http://people-user-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/datatable.html
----

Now access the http://people-{{USER_ID}}-project.{{ROUTE_SUBDOMAIN}}/datatable.html[graphical person browser powered by the DataTables library^]. It should look like:
And the resulting page should look like this:

image::datatable.png[datatable,800]

Expand Down

0 comments on commit a501837

Please sign in to comment.