Red Hat and customers often work together as partners to help get an application across the finish line. In this article, Stephen (electrical training ALLIANCE) and Michael (Red Hat) share the story of one such collaboration that led to success with Node.js in production.
The application
The electrical training ALLIANCE (ETA) has the mission to develop educational materials for electrical workers. They do this by developing national standards for the education and training of electrical workers, creating standardized training curricula, and assisting in establishing local educational programs. A key part of this work is to develop and provide an application for the 275 training programs that will assist in the day-to-day operations supporting apprentices within the program from application through to graduation.
Why Node.js?
Node.js was a good fit for the training program application due to its natural affinity with the front end and because it allowed faster development and rollout along with streamlined user acceptance testing. The Red Hat build of Node.js was a choice that fit into ETA's deployment strategy as it is Red Hat-maintained, supported, container ready, and runs well in Red Hat OpenShift.
The journey
Here we will summarize the process from initial development to deployment.
Step 1: The CI/CD environment
Working with Red Hat Consulting, the electrical training ALLIANCE settled on two OpenShift Dedicated clusters: one for non-production and one for production content. Tekton (openshift-pipelines) and Cockroach Cloud were chosen for the continuous integration and continuous deployment (CI/CD) platforms and for data persistence. Application images utilize Red Hat Quay and Red Hat containers for end-to-end Red Hat support and patching. These components are shown in Figure 1.
Step 2: Version 1 of the application using nginx and Node.js
The project required a front-end and matching back-end for front-end (BFF) to help manage access to a number of existing services written in Quarkus. This is where Node.js came in as a fast and efficient stack on which to build the BFF. Conventional architecture led us to utilize an nginx container for reverse proxy and static asset hosting, along with a Node.js middleware container handling Red Hat OpenShift API Management, authentication, and authorization tasks. This architecture is shown in Figure 2.
The initial version of the application exposed a key challenge due to how nginx must be built as an image (specifically the DNS resolution). There was no way to reuse the image between the non-production and production clusters described earlier, resulting in duplicate build pipelines with no guarantee that a build would succeed in production. This led the electrical training ALLIANCE to explore better options, resulting in version 2 of the application.
Step 3: Version 2 of the application using Node.js and Next.js
Since OpenShift provides load balancing, the electrical training ALLIANCE chose to remove nginx and migrate to a Next.js application backed by the Red Hat Node.js container. This allows for proper CI/CD where the image is built once in lower namespaces, tested, and promoted through to the production cluster with confidence.
Looking at existing documentation, however, it was not clear how to use Next.js with the Red Hat Node.js container images. After reaching out for help, the electrical training ALLIANCE was pleased to discover that Red Hat had a dedicated Node.js team who was happy to jump in and help figure this out. The end result was a solution using a two-stage Dockerfile, which you can read more about in How to deploy Next.js applications to Red Hat OpenShift. This work resulted in the architecture shown in Figure 3.
Step 4: Production success
The next step was production deployment, which is a great success with the applications already having 4,000 active users and potentially growing to 40,000 active users each year as it rolls out across all training locations.
In addition to supporting the initial applications, the Node.js solution was built as a pattern that can be reused for new products and the electrical training ALLIANCE is planning on rolling out many more.
So far, it has been used for the development and production of two products, which include:
- Training Administration System (TAS): This product has a number of functions, including:
- First year online apprenticeship: This allows the electrical training ALLIANCE, partnered with ProTech Skills Institute, to deliver the first year of the apprenticeship's classroom training online. TAS manages the application process for the program, as well as the day-to-day management of the apprentices.
- Pre-apprenticeship: This extends pre-apprenticeship to participating high school and trade schools.
- VEEP - Veterans to Electrician: The VEEP program will utilize TAS for the same purposes while supporting the path to apprenticeship from our veterans.
- Curriculum analysis and mapping utility: This product, developed for internal use, allows the electrical training ALLIANCE to map all of the curriculum against various industry requirements and evaluations to ensure the curriculum provided meets the needs of the industry.
Learn more
To learn more about the electrical training ALLIANCE, check out electricaltrainingalliance.org. If you want to learn more about what Red Hat is up to on the Node.js front, visit our Node.js page.
Last updated: September 19, 2023