Continue fleshing out workshop steps.
This commit is contained in:
BIN
2023-08-31-openshift-rails-workshop/images/observability.png
Normal file
BIN
2023-08-31-openshift-rails-workshop/images/observability.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
@ -118,6 +118,13 @@ OpenShift Pipelines (based on Tekton) make creating cloud native pipelines on Op
|
|||||||
[[./images/openshift-pipelines.gif]]
|
[[./images/openshift-pipelines.gif]]
|
||||||
|
|
||||||
|
|
||||||
|
** Built in observability
|
||||||
|
|
||||||
|
Within the OpenShift web console we can really quickly open up the logs from our application and observe metrics like cpu or memory usage.
|
||||||
|
|
||||||
|
[[./images/observability.png]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* 3. Setting up your development environment
|
* 3. Setting up your development environment
|
||||||
|
|
||||||
@ -155,60 +162,51 @@ Once logged in, feel free to repeat the OpenShift tour we went through as a grou
|
|||||||
Now that we are logged into our environment let's move on to deplying the ~rails-example~ codebase we forked earlier, onto OpenShift. We'll do this in two different ways:
|
Now that we are logged into our environment let's move on to deplying the ~rails-example~ codebase we forked earlier, onto OpenShift. We'll do this in two different ways:
|
||||||
|
|
||||||
** User the web interface to import from git and deploy
|
** User the web interface to import from git and deploy
|
||||||
1) Create a project bu clicking +Add > Create Project > Enter Project name (i.e. userXX)
|
|
||||||
2) Click on the ~Import from Git~ tile in your add menu.
|
OpenShift's Source-to-Image (S2I) is a powerful tool that streamlines the deployment of applications by automating the build process from source code to a runnable container image.
|
||||||
3) Enter the repo-url for your repository fork.
|
|
||||||
4) Click on the ~Ruby~ on Builder Image.
|
With S2I, deploying a Ruby app becomes easy – it detects your app's dependencies, assembles the necessary runtime environment, and produces a production-ready container image. This approach not only accelerates deployment but also ensures consistency and reliability across various environments, allowing you to focus on writing code without worrying about complex deployment configurations.
|
||||||
5) Enter ~rails-example~ in Name field.
|
|
||||||
6) Click create button and you will be redirected to ~Topology~ screen.
|
1) Click the ~+Add~ button in developer view (or open https://console-openshift-console.apps.cluster-dkxhl.dkxhl.sandbox1652.opentlc.com/add)
|
||||||
7) Click on ~rails-example~ application to see check the progress of the build (this should take roughly 2 minutes).
|
2) Click on the ~Import from Git~ tile in your add menu.
|
||||||
8) Click the route once the pod is ~Running~
|
3) Enter the repo-url for your repository fork.
|
||||||
|
4) Select the ~Ruby~ S2i builder image.
|
||||||
|
5) Enter ~rails-example~ in Name field.
|
||||||
|
6) Click create button and you will be redirected to ~Topology~ screen.
|
||||||
|
7) Click on ~rails-example~ application to see check the progress of the build (this should take roughly 2 minutes).
|
||||||
|
8) Click the route once the pod is ~Running~, the application ui should display.
|
||||||
|
|
||||||
|
|
||||||
** Using the command line to import from git deploy
|
** Using the command line to import from git deploy
|
||||||
|
|
||||||
|
Everything that we can do through the OpenShift web console, we can do programmatically through the ~oc~ command line utility. This includes creating a new source to image application deployment.
|
||||||
|
|
||||||
|
To save time during todays workshop we won't be setting up our local terminal to test this out, instead we will use the handy OpenShift Web Console terminal.
|
||||||
|
|
||||||
1) Click on the web terminal ~>_~ icon in the top right corner of the web console.
|
1) Click on the web terminal ~>_~ icon in the top right corner of the web console.
|
||||||
2) A terminal will pop up in the bottom of the window, this can sometimes take a minute or two to start.
|
2) A terminal will pop up in the bottom of the window, this can sometimes take a minute or two to start.
|
||||||
3) Copy the following command into the termuinal and press ~Enter~.
|
3) Copy the following command into the termuinal and press ~Enter~.
|
||||||
|
|
||||||
#+begin_src bash :results output
|
#+begin_src bash :results output
|
||||||
oc --namespace user1 new-app --name rails-cli centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git
|
oc --namespace user1 new-app --name rails-cli centos/ruby-25-centos7~https://github.com/sclorg/ruby-ex.git
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
#+begin_example
|
|
||||||
--> Found container image e96bd99 (2 years old) from Docker Hub for "centos/ruby-25-centos7"
|
|
||||||
|
|
||||||
Ruby 2.5
|
|
||||||
--------
|
|
||||||
Ruby 2.5 available as container is a base platform for building and running various Ruby 2.5 applications and frameworks. Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, and extensible.
|
|
||||||
|
|
||||||
Tags: builder, ruby, ruby25, rh-ruby25
|
|
||||||
|
|
||||||
,* An image stream tag will be created as "ruby-25-centos7:latest" that will track the source image
|
|
||||||
,* A source build using source code from https://github.com/sclorg/ruby-ex.git will be created
|
|
||||||
,* The resulting image will be pushed to image stream tag "rails-cli:latest"
|
|
||||||
,* Every time "ruby-25-centos7:latest" changes a new build will be triggered
|
|
||||||
|
|
||||||
--> Creating resources ...
|
|
||||||
imagestream.image.openshift.io "ruby-25-centos7" created
|
|
||||||
imagestream.image.openshift.io "rails-cli" created
|
|
||||||
buildconfig.build.openshift.io "rails-cli" created
|
|
||||||
deployment.apps "rails-cli" created
|
|
||||||
service "rails-cli" created
|
|
||||||
--> Success
|
|
||||||
Build scheduled, use 'oc logs -f buildconfig/rails-cli' to track its progress.
|
|
||||||
Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
|
|
||||||
'oc expose service/rails-cli'
|
|
||||||
Run 'oc status' to view your app.
|
|
||||||
#+end_example
|
|
||||||
|
|
||||||
4) Let's open the web console again and we should now see another application pod in our topology view!
|
|
||||||
5) Click on the pod, and open the route to see the application serving traffic.
|
|
||||||
|
|
||||||
|
|
||||||
** Creating a tekton deployment pipeline for our app
|
4) Let's open the web console again and we should now see another application pod in our topology view!
|
||||||
|
5) Click on the pod, and open the route to see the application serving traffic.
|
||||||
|
|
||||||
1) Click on "Pipelines" in the OpenShift web console developer view.
|
|
||||||
|
* 5. Creating a tekton deployment pipeline for our app
|
||||||
|
|
||||||
|
Now that we've explored some methods for deploying a ruby application. Let's create a full pipeline for deployments. We can actually generate basic pipelines automatically with a checkbox as we use the ~Import from git~ quick add feature in the web console.
|
||||||
|
|
||||||
|
For this excercise though, lets create a new pipeline from scratch!
|
||||||
|
|
||||||
|
1) Click on ~Pipelines~ in the OpenShift web console developer view.
|
||||||
2) Click on ~Create~ > ~Pipeline~ in the top right hand corner.
|
2) Click on ~Create~ > ~Pipeline~ in the top right hand corner.
|
||||||
3) Enter the name ~ruby-pipeline~.
|
3) Enter the name ~ruby-pipeline~.
|
||||||
4) Click on ~Add task~, and type in ~clone~, then select ~git-clone~ from Red Hat and click ~Add~.
|
4) Click ~Add workspace~ at the bottom of the page and enter name ~ruby-pipeline~. The workspace is the shared context that will be passed between each task in the pipeline. For example, cloning source code, then testing that code in a subsequent pipeline task.
|
||||||
|
5) Click on ~Add task~, and type in ~clone~, then select ~git-clone~ from ~Red Hat~ and click ~Add~.
|
||||||
|
6) Click on the newly added ~git-clone~ task and enter the clone url for the repository you forked in Bitbucket (note, ensure the Bitbucket repository is set to public in Bitbucket setttings). Then scroll down and select ~ruby-pipeline~ in the workspace dropdown.
|
||||||
|
7) Click the ~+~ symbol that appears to the right of your ~git-clone~ task when you hover over it. Click ~Add task~ on the new block in the pipeline and enter ~ruby~ in the search. Select ~s2i-ruby~ from ~Red Hat~ and click ~Add~.
|
||||||
|
8) Click on the newly added ~s2i-ruby~ task and enter ~image-registry.openshift-image-registry.svc:5000/userX/ruby-pipeline-app~ as the ~IMAGE~ field, making sure to replace the X your user number. Scroll down and select ~ruby-pipeline~ in the workspace dropdown.
|
||||||
|
|||||||
Reference in New Issue
Block a user