Skip to content

Example on how to use redis sentinel with node.js leveraging ioredis module in an K8s env.

Notifications You must be signed in to change notification settings

Kripu77/ts-node-redis-sentinel-k8s-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ts-node-redis-sentinel-k8s-example

Overview

This repository serves as a demonstration of harnessing the power of TypeScript, Redis, Helm and Kubernetes. The included TypeScript application showcases the seamless integration of Node.js with Redis Sentinel for robust and scalable solutions. Additionally, Helm charts are provided to simplify the deployment process on Kubernetes.

Prerequisites

Make sure you have the following tools installed:

  • Node.js (for running the TypeScript application)
  • Helm (for managing Kubernetes applications)
  • Kubernetes cluster (local or cloud-based)

The example will be based on minikube:

Getting Started

  1. Clone this repository to your local machine:

    git clone https://github.com/kripu77/ts-node-redis-sentinel-k8s-example.git
    cd ts-node-redis-sentinel-k8s-example
  2. Create a docker image for the sampleapp located inside app directory:

    cd app
    docker build -f dockerfile.local -t sample-app:tag .
    
    example:
    docker build -f dockerfile.local -t sample-app:0.1.0 .
  3. Asuuming Minikube is running on your local machine Load the docker image into minikube.

    minikube image load sample-app:tag .
  4. Create a namespace for the application stack:

    kubectl create namespace <your-desired-namespace>
    
    example:
    kubectl create namespace ts-node-redis-sentinel-k8s-example  
  5. Switch to the helm-chart directory in order to Deploy Redis Sentinel and the node.js app using Helm:

    cd ../helm-chart
    helm install ts-node-redis-sentinel-k8s-example ./ -n  <your-desired-namespace>
    
    example:
    helm install ts-node-redis-sentinel-k8s-example ./ -n  ts-node-redis-sentinel-k8s-example
  6. Access the application:

    kubectl get svc -n <your-namespace-where-application-is-running>
    
    minikube service cd-service --url -n <your-namespace-where-application-is-running>
    
    example:
    kubectl get svc -n  ts-node-redis-sentinel-k8s-example
    minikube service cd-service --url -n ts-node-redis-sentinel-k8s-example
    

    The application is now running! Visit the url displayed on your console.

Cleanup

To remove the deployed resources:

helm uninstall ts-node-redis-sentinel-k8s-example ./ -n  <your-desired-namespace>

About

Example on how to use redis sentinel with node.js leveraging ioredis module in an K8s env.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published