DevOps Lab: Create Your Own Reference Application
By Sudheer S
A reference application is a sample application that is used as a guide for developers to learn and implement best practices for software development, testing, deployment, and operations within a specific technology stack or framework. It can serve as a blueprint for building and maintaining similar applications and can be used to demonstrate the use of tools, processes, and techniques for achieving high levels of automation, scalability, and reliability.
If you are learning how to deploy applications to Kubernetes of Virtual Machines in cloud, create your own tiny application.
The reference application typically:
- Demonstrates how to install the application on a Virtual Machine Guest(VM).
- Demonstrates how to install the application onto a Kubernetes cluster.
- Demonstrates how to scale the application horizontally and vertically. Describes the configuration of the application that aids in such scaling operations.
- Describes its dependencies. Example, PostgreSQL or Redis database. Explains how to connect the application to these databases. Other dependencies such as message brokers, persistent storage, shared block storage, object storage, third party APIs, network egress and ingress requirement, etc.
- Describes how to collect logs from the application and eventually ship the logs to a logging cluster such as OpenSearch.
- Describes how to collect metrics from the application and eventually ship the metrics to a timeseries database server such as Prometheus.
- Describes how to collect traces from the application and analyse them in a dashboarding application such as Kibana or OpenSearch Dashboards.
Two Tier Architecture
Start with the two-tier architecture. In this architecture, your application uses a database such as MySQL or
PostgreSQL to store the data. In returns web pages with HTML, CSS and JavaScript as response. Start with the
programming language you are comfortable with. Create the application that writes some data to a database and reads
from the database. You could use any popular web framework such as Flask, Django, Laravel, Ruby On Rails, Gin, Spring,
Express.js
etc.
Three Tier Architecture
In this architecture, your application uses a database such as PostgreSQL or CouchDB to store the data. The backend
application talks to the database and provides an API for the frontend. For backend, use a server-side programming
language such as Python, PHP, NodeJS, Go, Java, etc. For the frontend your options are limited. Use vanilla JavaScript
or a framework such as ReactJS, Angular, Vue.js
, Next.js
or Nuxt.js
. TypeScript and other languages that
eventually transpile to JavaScript is also fine. The point is not to delve deep into frontend engineering at this stage.
But to focus on quickly getting a working frontend application. The frontend application should talk to the backend
API via HTTP, REST or some variant of RPC.
Documentation Checklist For The Reference Application
- Documentation for the user. A brief description of the project. Description of the tools and technologies used.
- Project requirements such as databases and filesystems.
- Instructions to generate the build and run the test suite.
- Instructions to deploy the application to VMs. Example configuration files and environment variables.
- Instructions to deploy the application to VMs on containers.
- Instructions to deploy the application to a Kubernetes cluster. Details of Kubernetes manifests, example usage of Kubernetes manifests, Kustomize or Helm charts.
- Instructions to contribute to the project. Instructions to develop the application locally. Information about the code repositories and contribution guidelines.
- Instructions to scale the application horizontally and vertically.
Deploying To Virtual Machines: Day To Day Deployment
Once the reference application is ready, create a strategy to deploy it to the virtual machines.
- Install the dependencies such as language runtimes and build tools.
- Install a reverse-proxy such as Nginx to perform the heavy-lifting of web application serving.
- Clone the Git repository.
- Create the environment variables or files.
- Start the application.
Deploying To Virtual Machines: Day To Day Deployment
Typical steps to deploy the backend application:
- Execute a script on the local laptop or an automation server.
- The script checks whether there’s a code change in the Git repository.
- If there is a change in code, the script fetches the latest code in the designated Git branch.
- The script installs the dependencies such as NodeJS or Python packages.
- Restart the application server.
Examples Of Reference Applications
- Python web application. Frontend and workers.
- PHP web applications. Frontend and workers.
- Ruby On Rails web application. Frontend and workers.
- Go web application. Backend API.
- NodeJS and Express web application. Backend API.
- Frontend JS application. Building and deploying to a CDN.
- Kotlin Android application.
- Swift iOS application.
- Java Sprint Boot application. REST API and backend.
- A Kafka producer application. A Kafka consumer application.
- An AMQP producer and consumer application.
- A backend application that uses Redis as data store.
- A backend application that uses MySQL, MariaDB or PostgreSQL as database.
- A backend application that uses MongoDB or Cassandra as the database.
- An image resizing microservice.