How gearup2000/openshift works
Project Type and Purpose
• The project is a demonstration application that deploys on OpenShift.
• It consists of two main parts: a static web front end served by Nginx and a dynamic backend Node.js service that supplies random Yoda quotes.
• The project uses OpenShift resources (via the quote-app.yaml file) to manage deployments, configMaps, and routes.
File Structure
• The top-level “star wars” directory contains the entire application.
• The “nginx-cm” folder holds Nginx-related files:
– index.html: The static HTML page served by Nginx.
– nginx.conf: The Nginx configuration for serving the page.
– (Also, there is a yoda.png image used in documentation.)
• The “service” folder contains:
– Dockerfile: Used to build the container for the Node.js quote service.
– index.js: The application logic for serving the random Yoda quotes.
• The quote-app.yaml file defines the OpenShift configuration including deployments, routes, and configMaps.
README for Additional Insights
• The README explains how to create configMaps for both the Nginx configuration and the static HTML, and how to deploy the entire solution on OpenShift.
• Instructions provided detail the steps for creating a project, deploying resources via the CLI and Web Console, and exposing the application through Routes.
a. Main Components:
• Client (User Browser): Initiates requests to the application.
• OpenShift Cluster: Represents the container orchestration environment.
• Nginx Pod/Deployment: Hosts the static HTML page from “nginx-cm” and uses the provided nginx.conf. Includes dependency on configMaps (nginx-conf and nginx-html).
• Node.js Quote Service Pod/Deployment: Runs the container built via the “service/Dockerfile” that executes index.js to serve random Yoda quotes.
• OpenShift YAML Configuration (quote-app.yaml): Outlines how these components are deployed and connected in the OpenShift ecosystem.
b. Relationships and Interactions:
• The Client makes an HTTP request to the application’s route (http://quote.apps-crc.testing).
• The OpenShift Router/Route directs traffic to the appropriate service – in this case, the Nginx deployment.
• The Nginx server serves the static HTML file and may (depending on implementation) forward specific API requests to the Node.js service.
• The Node.js service responds with random Yoda quotes.
• ConfigMaps, created from the “nginx.conf” and “index.html” files, are mounted into the Nginx deployment to provide configuration and content.
c. Architectural Patterns and Design Principles:
• Separation of Concerns: The system clearly separates static content (served via Nginx) from dynamic content (Node.js quote service).
• Containerization: Use of a Dockerfile for packaging the Node.js service.
• Declarative Deployment: OpenShift YAML configuration defines deployments, configMaps, and networking routes.
d. Relevant Technologies and Frameworks:
• Nginx: Serves static HTML and configuration from the “nginx-cm” folder.
• Node.js: Serves dynamic content (random quotes) from the “service/index.js”.
• Docker: Used for containerizing the Node.js service.
• OpenShift (Kubernetes based): Manages deployments, configMaps, routes, and overall orchestration.