Skip to content

Commit

Permalink
chore: Update onboarding instructions in env-setup.adoc
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricclyburn committed May 6, 2024
1 parent fb63065 commit cb57a4a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion documentation/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ start_page: ROOT:index.adoc

asciidoc:
attributes:
experimental: true
experimental: false
icons: font
page-pagination: true
lab_name: Podman Desktop Tutorial
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion documentation/modules/ROOT/pages/env-setup.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Again, welcome to the Podman Desktop workshop! You'll learn how to use link:http

== Workshop Homepage

To begin, let's navigate to the homepage for workshops at link:https://summit.demo.redhat.com[https://summit.demo.redhat.com/]. From the homepage, you can access the Podman Desktop workshop by selecting the *Access this lab* button.
To begin, let's navigate to the homepage for workshops at link:https://summit.demo.redhat.com[summit.demo.redhat.com]. From the homepage, you can access the Podman Desktop workshop by selecting the *Access this lab* button.

image::podman-desktop-workshop-homepage.png[Workshop Homepage]

Expand Down
6 changes: 3 additions & 3 deletions documentation/modules/ROOT/pages/kubernetes-deploying.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Podman Desktop will generate the necessary Kubernetes manifests for the pod and

image::podman-desktop-deploy-to-kubernetes-manifests.png[Podman Desktop Deploy to Kubernetes Manifests, 600]

TIP: You can specify the Kubernetes context where you want to deploy the pod by selecting the desired context from the dropdown menu in the top left corner.
TIP: You can specify the Kubernetes context where you want to deploy the pod by selecting the desired context from the dropdown menu in the bottom left corner.

Podman Desktop will communicate with the Kubernetes API server and create the required resources in the cluster. You can monitor the deployment status, and when ready, access the deployed application using the provided URL.

Expand All @@ -27,9 +27,9 @@ image::podman-desktop-kubernetes-pod-exposed.png[Podman Desktop Kubernetes Pod D

You should see the familiar Quarkus application with the Redis-backed counter, now running on the Developer Sandbox.

=== Scaling and Managing the Deployment
=== Managing the Deployment

Kubernetes allows you to easily scale and manage your deployments. Back in Podman Desktop, select *Open in OpenShift console* from the right hand side to access the OpenShift console for the deployed pod.
Kubernetes allows you to easily modify and manage your deployments. Back in Podman Desktop, select *Open in OpenShift console* from the right hand side to access the OpenShift console for the deployed pod.

image::podman-desktop-kubernetes-pod-openshift-console2.png[Podman Desktop Kubernetes Pod OpenShift Console, 600]

Expand Down
6 changes: 2 additions & 4 deletions documentation/modules/ROOT/pages/kubernetes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@ image::podman-desktop-kubernetes-play-yaml-button.png[Podman Desktop Play Kubern

As mentioned, Podman Desktop provides a seamless integration with Kubernetes, starting from the setup of a local Kubernetes cluster to deploying and managing applications on Kubernetes. Let's take a look at how easy it is to spin up, and connect, to a Kubernetes cluster using Podman Desktop.

=== Provisioning a Kubernetes Cluster
=== Optional: Provisioning a Kubernetes Cluster

NOTE: During this workshop, we'll be directly connecting to a remote Kubernetes cluster. This information is just as a reference for later use.

Podman Desktop includes extensions to manage local Kubernetes clusters, enabling developers to deploy and test their applications in a Kubernetes environment without the need for external setup. The local cluster is powered by https://kind.sigs.k8s.io/[KinD (Kubernetes in Docker)] or https://minikube.sigs.k8s.io/[Minikube], providing a lightweight and isolated Kubernetes environment. To start a local KinD cluster in Podman Desktop:

Navigate to the *Settings* section in Podman Desktop and select *Create new Kind cluster*.
Podman Desktop includes extensions to manage local Kubernetes clusters, enabling developers to deploy and test their applications in a Kubernetes environment without the need for external setup. The local cluster is powered by https://kind.sigs.k8s.io/[KinD (Kubernetes in Docker)] or https://minikube.sigs.k8s.io/[Minikube], providing a lightweight and isolated Kubernetes environment. To start a local KinD cluster in Podman Desktop, firstly navigate to the *Settings* section in Podman Desktop and select *Create new Kind cluster*.

image::podman-desktop-settings-kind.png[Podman Desktop Settings, 600]

Expand Down
28 changes: 20 additions & 8 deletions documentation/modules/ROOT/pages/pods.adoc
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
= Working with Pods
include::_attributes.adoc[]

In the previous step, we successfully built, ran, and tested a multi-container application using Podman Desktop. As you know, we had to do a workaround to get the IP from the Redis container and then pass that in as an environment variable to the Quarkus container, which wasn't a very sustainable way to do our local container work. On a production environment, workloads with close affinity might actually be deployed in the same localhost network. To accomplish this same behavior, we could create a docker-compose.yml file and run it with podman (You installed docker-compose during the setup of Podman Desktop). Feel free to check out the `docker-compose.yml` file in the root directory of podify-quarkus-redis project and then run the following command:
In the previous step, we successfully built, ran, and tested a multi-container application using Podman Desktop.

## Optional: Working with Compose

NOTE: As you already have these two containers running, you'll have to stop them before proceeding with the Compose example, and re-do the previous steps before continuing. Feel free to just view the instructions below and skip this step if you prefer.

As you know, we had to do a workaround to get the IP from the Redis container and then pass that in as an environment variable to the Quarkus container, which wasn't a very sustainable way to do our local container work. On a production environment, workloads with close affinity might actually be deployed in the same localhost network. To accomplish this same behavior, we could create a docker-compose.yml file and run it with podman (You installed Compose during the setup of Podman Desktop). Feel free to check out the `docker-compose.yml` file in the root directory of podify-quarkus-redis project and then run the following command:

[.console-output]
[source,bash,subs="+macros,+attributes"]
----
cd ~/podify-quarkus-redis && podman compose up
----

image::podman-compose-up.png[Podman Compose Up, 600]

You'll notice that both containers are started together and you can even test the application in your browser again.

The downside of using Docker Compose is that you will need expertise in creating docker-compose.yml files, and it's a little bit of a dead-end street, since you cannot take the definitions in the compose files further to a Kubernetes environment.
image::quarkus-app-redis-compose.png[Quarkus App with Redis, 600]

What if instead we could create a nice little 'pod' for our containers to live in together and share their resources? As the name of the project already implies, that's of course exactly what Podman can do!
The downside of using Docker Compose is that you will need expertise in creating docker-compose.yml files, and it's a little bit of a dead-end street, since you cannot take the definitions in the compose files further to a Kubernetes environment.

Podman Desktop streamlines the process of creating a pod from existing containers, offering a seamless transition from development to Kubernetes, where Pods are the most basic deployable units.
What if instead we could create a nice little _pod_ for our containers to live in together and share their resources? As the name of the project already implies, that's of course exactly what Podman can do! Podman Desktop streamlines the process of creating a pod from existing containers, offering a seamless transition from development to Kubernetes, where Pods are the most basic deployable units.

== A Bit about Pods
== What are Pods?

https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods[Pods] are a fundamental concept in container orchestration systems like Kubernetes and OpenShift. They provide an abstraction layer that encapsulates one or more containers, treating them as a single entity.

TIP: Pods are designed to be the smallest deployable unit, and you should avoid running unrelated containers within the same pod.

image::podman-pod-architecture.png[Podman Desktop Overview, 600]

Pods offer several key advantages over running containers individually, including:
Expand All @@ -35,9 +45,11 @@ Pods offer several key advantages over running containers individually, includin

Podman Desktop's _Podify_ feature takes advantage of these pod benefits by simplifying the process of creating a pod from existing containers. Let's walk through the steps to create a pod from the Quarkus app and Redis containers.

You will need to change the environment variable `redis` to point to `localhost` instead of the hard coded IP we set earlier. In order to do so, delete the existing quarkus-app container and create a new one from the images tab.
First, you will need to change the environment variable `redis` to point to `localhost` instead of the hard coded IP we set earlier. In order to do so, *delete* the existing `quarkus-app` container and *create a new one* from the *Images* tab.

image::podman-desktop-delete-container.png[Podman Desktop Delete Container, 600]

TIP: the Quarkus application is by default configured to look for a Redis instance on `localhost` already, so you don't actually need to set the environment variable this time. Just create a new container with name `quarkus-app`, and continue with the instructions below.
TIP: The Quarkus application is by default configured to look for a Redis instance on `localhost` already, so you don't actually need to set the environment variable this time. Just create a new container with name `quarkus-app`, and continue with the instructions below.

In the *Containers* section of Podman Desktop, select both the `quarkus-app` and `redis` containers using the checkboxes. Now, click on the *Podify* button from the top right corner menu to initiate the pod creation process.

Expand All @@ -47,7 +59,7 @@ A new window will appear, allowing you to configure basic pod parameters. Provid

image::podman-desktop-podify-window2.png[Podman Desktop Podify, 600]

TIP: You'll notice that you only have the option to expose the port of the Quarkus container. Due to the pod's internal networking, it's not necessary to expose the Redis port externally for this application, as they can communicate using `localhost`.
TIP: You'll notice that you only have the option to expose the Quarkus container. Due to the pod's internal networking, it's not necessary to expose the Redis port externally for this application, as they can communicate using `localhost`.

Podman Desktop will now stop the existing containers and create a new pod that encapsulates the selected containers. To view the pod's details and manage its lifecycle, navigate to the *Pods* section in the Podman Desktop interface.

Expand Down
6 changes: 3 additions & 3 deletions documentation/modules/ROOT/pages/running-containers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ After a few seconds, the Redis container will be up and running. We'll be brough

image::podman-desktop-redis-container-details.png[Podman Desktop Container Details, 600]

In order to connect these two containers, we will need to configure their network. Let's view some of the details from this container, as we'll need to find the internal IP address for Redis to configure our Quarkus application. Head to the *Inspect* tab and *Ctrl-F* to search for `IPAddress`, which will be under the `NetworkSettings` section and will look something like this:
In order to connect these two containers, we will need to configure their network. Let's view some of the details from this container, as we'll need to find the internal IP address for Redis to configure our Quarkus application. Head to the *Inspect* tab and find shortcut kbd:[Ctrl+F] for `IPAddress`, which will be under the `NetworkSettings` section and will look something like this:

image::podman-desktop-redis-container-inspect.png[Podman Desktop Container Inspect, 600]

Expand All @@ -41,15 +41,15 @@ Now, let's start the Quarkus container. We'll go back to the *Images* section in

image::podman-desktop-start-quarkus-container.png[Podman Desktop Start Container, 600]

Let's navigate to the *Environment* tab and add a new environment variable with the key `redis` and the value as the IP address we copied from the Redis container earlier. You can also give the container a name, such as `quarkus-app`. Then hit the *Start* button.
Let's navigate to the *Environment variables* section and add a new environment variable with the key `redis` and the value as the IP address we copied from the Redis container earlier. You can also give the container a name, such as `quarkus-app`. Then hit the *Start* button.

image::podman-desktop-start-quarkus-container-options.png[Podman Desktop Start Container, 600]

NOTE: Setting the `redis` environment variable overrides the redis value set in the src/main/resources/application.properties. This property is used to configure the Redis connection host, which allows the Quarkus application to connect to the Redis cache running in our Redis container.

== Testing the multi-container application

With both containers started, let's test the basic functionality by selecting the *Open Browser* button from the top right corner menu. This will open a new browser window with the application's IP address and port, such as `http://localhost:8080/[http://localhost:8080/, window="_blank"]`.
With both containers started, let's test the basic functionality by selecting the *Open Browser* button from the top right corner menu. This will open a new browser window with the application's IP address and port, such as `http://localhost:8080/[http://localhost:8080, window="_blank"]`.

image::podman-desktop-open-browser-button2.png[Podman Desktop Open Browser, 600]

Expand Down

0 comments on commit cb57a4a

Please sign in to comment.