Giter Site home page Giter Site logo

kripu77 / ts-node-redis-sentinel-k8s-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 157 KB

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

JavaScript 12.09% TypeScript 3.47% Smarty 82.94% Shell 1.50%

ts-node-redis-sentinel-k8s-example's Introduction

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>

ts-node-redis-sentinel-k8s-example's People

Contributors

kripu77 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.