Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Create procedure for Deploying on OpenShift using Docker build strategy #45918

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sheilamjones
Copy link
Contributor

@sheilamjones sheilamjones commented Jan 28, 2025

This PR aims to draft a procedure for the following use case

  • Build and deploy Quarkus applications on OpenShift using the docker build strategy.

Reference: Based on the Red Hat build of Quarkus guide Deploying on OpenShift Container Platform

Copy link

quarkus-bot bot commented Jan 28, 2025

Thanks for your pull request!

Your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)

This message is automatically generated by a bot.

@sheilamjones sheilamjones marked this pull request as draft January 28, 2025 11:46
@sheilamjones sheilamjones marked this pull request as ready for review February 5, 2025 10:21
@sheilamjones sheilamjones requested a review from iocanel February 5, 2025 10:21
@sheilamjones sheilamjones changed the title [DOCS]: Create procedure for Deploying on OpenShift using Docker build strategy Docs: Create procedure for Deploying on OpenShift using Docker build strategy Feb 5, 2025
Copy link

quarkus-bot bot commented Feb 5, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit b87770d.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Copy link

github-actions bot commented Feb 5, 2025

🎊 PR Preview 17b634f has been successfully built and deployed to https://quarkus-pr-main-45918-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

@sheilamjones
Copy link
Contributor Author

Hi @iocanel,
Can I please get your review of this procedure. Again, this content is based on the existing downstream Deploying on Openshift guide.
Many thanks,
Sheila

@sheilamjones sheilamjones requested a review from rolfedh February 6, 2025 12:10
Copy link
Contributor

@rolfedh rolfedh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed some items to bullet points to better reflect that they are a collection of independent options rather than a sequence of steps. Additionally, to make it clearer that these options are optional, I replaced the imperative verb form with the infinitive "To ..." form. Feel free to apply this approach to any other PRs that include similar lists of optional steps.

As an application developer, you can deploy your applications to {openshift} by using the Docker build strategy as a deployment option.
This functionality is provided by the `quarkus-openshift` extension.

The container gets built inside the {openshift} cluster and is provided as an image stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The container gets built inside the {openshift} cluster and is provided as an image stream.
The {openshift} cluster builds the container and provides it as an image stream.

The container gets built inside the {openshift} cluster and is provided as an image stream.

Your Quarkus project includes pregenerated Dockerfiles with instructions.
When you want to use a custom Dockerfile, you must add the file in the `src/main/docker` directory or anywhere inside the module. Additionally, you must set the path to your Dockerfile by using the `quarkus.openshift.jvm-dockerfile` property.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When you want to use a custom Dockerfile, you must add the file in the `src/main/docker` directory or anywhere inside the module. Additionally, you must set the path to your Dockerfile by using the `quarkus.openshift.jvm-dockerfile` property.
If you want to use a custom Dockerfile, add the file to the `src/main/docker` directory or any location inside the module. Additionally, set the path to your Dockerfile by using the `quarkus.openshift.jvm-dockerfile` property.

* You have set the `JAVA_HOME` environment variable to the location of the Java SDK.
* You have Apache Maven {maven-version} installed.
* You have a Quarkus project that includes the `quarkus-openshift` extension.
* You have access to a {openshift} cluster and the latest compatible version of the `oc` tool installed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* You have access to a {openshift} cluster and the latest compatible version of the `oc` tool installed.
* You have access to a {openshift} cluster and the latest compatible version of the `oc` CLI tool installed.

----
quarkus.openshift.build-strategy=docker
----
. Optional: Set the following properties in the `application.properties` file, as required by your environment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. Optional: Set the following properties in the `application.properties` file, as required by your environment:
. Optional: Set the following properties in the `application.properties` file based on your environment:

quarkus.openshift.build-strategy=docker
----
. Optional: Set the following properties in the `application.properties` file, as required by your environment:
.. If you are using an untrusted certificate, configure the `KubernetesClient`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. If you are using an untrusted certificate, configure the `KubernetesClient`:
** If you are using an untrusted certificate, enable certificate trust for the `KubernetesClient`:

----
quarkus.kubernetes-client.trust-certs=true
----
.. Expose the service to create an {openshift} route:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. Expose the service to create an {openshift} route:
** To expose the service and create an {openshift} route, set the following property:

----
quarkus.openshift.route.expose=true
----
.. Set the path to your custom Dockerfile:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. Set the path to your custom Dockerfile:
** To use a custom Dockerfile instead of the pregenerated Dockerfiles, set the path to your Dockerfile:

Comment on lines +57 to +63
quarkus.openshift.jvm-dockerfile=<path_to_your_dockerfile>
----
The following example shows the path to the `Dockerfile.custom-jvm`:
+
[source,properties]
----
quarkus.openshift.jvm-dockerfile=src/main/resources/Dockerfile.custom-jvm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
quarkus.openshift.jvm-dockerfile=<path_to_your_dockerfile>
----
The following example shows the path to the `Dockerfile.custom-jvm`:
+
[source,properties]
----
quarkus.openshift.jvm-dockerfile=src/main/resources/Dockerfile.custom-jvm
quarkus.openshift.jvm-dockerfile=<path_to_your_dockerfile>
----
+
.Example path to the `Dockerfile.custom-jvm`
[source,properties]
----
quarkus.openshift.jvm-dockerfile=src/main/resources/Dockerfile.custom-jvm

Or maybe use:

For example, to specify a custom Dockerfile named `Dockerfile.custom-jvm`:

They key thing is to use the + so the example indent and aligns with the bullet point.

Copy link
Contributor

@rolfedh rolfedh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sheila,

Great work! With your agreement, I’ve taken the opportunity to provide a more thorough review. I hope you find it helpful. Feel free to apply or disregard any suggestions as you see fit.
Thanks!

quarkus.openshift.jvm-dockerfile=src/main/resources/Dockerfile.custom-jvm
----

. Package and deploy your application to the current OpenShift project:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. Package and deploy your application to the current OpenShift project:
. Package and deploy your application to the current {openshift} project:


== Verification

The verification steps and related terminal outputs are demonstrated on the `openshift-helloworld` example application.
Copy link
Contributor

@rolfedh rolfedh Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The verification steps and related terminal outputs are demonstrated on the `openshift-helloworld` example application.
The following verification steps use the `openshift-helloworld` example application.

Where is this example located? Should we provide a link for clarity? I couldn’t find it in Quarkus Quickstarts...

Comment on lines +93 to +94
. To retrieve the log output for your application's pod, use the `oc logs -f` command with the `<pod_name>` value of the pod you are interested in.
In this example, we use the `openshift-helloworld-1-gzzrx` pod name that corresponds with the latest pod prefixed with the name of your application:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. To retrieve the log output for your application's pod, use the `oc logs -f` command with the `<pod_name>` value of the pod you are interested in.
In this example, we use the `openshift-helloworld-1-gzzrx` pod name that corresponds with the latest pod prefixed with the name of your application:
. To get the log output for your application's pod, use the `oc logs -f` command with its name. For example:

oc logs -f _openshift-helloworld-1-gzzrx_
----
+
[source,shell,subs=attributes+]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[source,shell,subs=attributes+]
.Example output
[source,shell,subs=attributes+]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure whether we want to label outputs, but if we do, we should aim to apply it consistently across all upstream-downstream documentation. Something to think about for the future.

2024-09-17 10:23:25,281 INFO [io.quarkus] (main) Installed features: [cdi, kubernetes, rest, smallrye-context-propagation, vertx]
----

. Retrieve a list of services:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. Retrieve a list of services:
. To get a list of services:

Comment on lines +127 to +132
. Get a URL to test your application.
+
[NOTE]
====
To create an {openshift} route, ensure you have specified `quarkus.openshift.route.expose=true` in the `application.properties` file.
====
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. Get a URL to test your application.
+
[NOTE]
====
To create an {openshift} route, ensure you have specified `quarkus.openshift.route.expose=true` in the `application.properties` file.
====
. If you exposed an {openshift} route by setting the `quarkus.openshift.route.expose=true` property before building the application, you can get a URL to test it:

+
[NOTE]
====
Be aware that the route is now listening on port 80 and no longer at port 8080.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd double-check with the SME correctness of the current statement. Is the route is listening on port 80 in addition to port 8080? If so, maybe:

Suggested change
Be aware that the route is now listening on port 80 and no longer at port 8080.
Be aware that the route is now listening on port 80.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants