npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@opencdk8s/cdk8s-redis-sts

v0.0.7

Published

Create a Replicated Redis Statefulset on Kubernetes, powered by the [cdk8s project](https://cdk8s.io) 🚀

Downloads

4

Readme

cdk8s-redis-sts Release

Create a Replicated Redis Statefulset on Kubernetes, powered by the cdk8s project 🚀

Disclaimer

This construct is under heavy development, and breaking changes will be introduced very often. Please don't forget to version lock your code if you are using this construct.

Overview

cdk8s-redis-sts is a cdk8s library.

import { Construct } from 'constructs';
import { App, Chart, ChartProps } from 'cdk8s';
import { MyRedis } from '@opencdk8s/cdk8s-redis-sts';

export class MyChart extends Chart {
  constructor(scope: Construct, id: string, props: ChartProps = { }) {
    super(scope, id, props);
    new MyRedis(this, 'dev', {
        image: 'redis',
        namespace: 'databases',
        volumeSize: '10Gi',
        replicas: 2,
        createStorageClass: true,
        volumeProvisioner: 'kubernetes.io/aws-ebs',
        storageClassName: "io1-slow",
        storageClassParams: {
          type: 'io1',
          fsType: 'ext4',
          iopsPerGB: "10",
        },
    });
    }
}

const app = new App();
new MyChart(app, 'dev');
app.synth();

Then the Kubernetes manifests created by cdk8s synth command will have Kubernetes resources such as Statefulset, ConfigMap and Service as follows.

allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: io1-slow
parameters:
  fsType: ext4
  iopsPerGB: "10"
  type: io1
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Retain
---
apiVersion: v1
data:
  master.conf: |-
    
    bind 0.0.0.0
    daemonize no
    port 6379
    tcp-backlog 511
    timeout 0
    tcp-keepalive 300
    supervised no
  slave.conf: |-
    
    slaveof dev 6379
kind: ConfigMap
metadata:
  name: dev-redis-conf
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: dev
  name: dev
  namespace: databases
spec:
  ports:
    - port: 6379
      targetPort: 6379
  selector:
    app: dev
  type: ClusterIP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: dev
  name: dev
  namespace: databases
spec:
  replicas: 2
  selector:
    matchLabels:
      app: dev
  serviceName: dev
  template:
    metadata:
      labels:
        app: dev
    spec:
      containers:
        - command:
            - bash
            - -c
            - |-
              [[ `hostname` =~ -([0-9]+)$ ]] || exit 1
              ordinal=${BASH_REMATCH[1]}
              if [[ $ordinal -eq 0 ]]; then
              redis-server /mnt/redis/master.conf
              else
              redis-server /mnt/redis/slave.conf
              fi
          env: []
          image: redis
          name: redis
          ports:
            - containerPort: 6379
          resources:
            limits:
              cpu: 400m
              memory: 512Mi
            requests:
              cpu: 200m
              memory: 256Mi
          volumeMounts:
            - mountPath: /data
              name: dev
            - mountPath: /mnt/redis/
              name: dev-redis-conf
      terminationGracePeriodSeconds: 10
      volumes:
        - configMap:
            name: dev-redis-conf
          name: dev-redis-conf
  volumeClaimTemplates:
    - metadata:
        name: dev
        namespace: databases
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
        storageClassName: io1-slow

Installation

TypeScript

Use yarn or npm to install.

$ npm install @opencdk8s/cdk8s-redis-sts
$ yarn add @opencdk8s/cdk8s-redis-sts

Python

$ pip install cdk8s-redis-sts

Contribution

  1. Fork (link)

  2. Bootstrap the repo:

    npx projen   # generates package.json 
    yarn install # installs dependencies
  3. Development scripts: |Command|Description |-|- |yarn compile|Compiles typescript => javascript |yarn watch|Watch & compile |yarn test|Run unit test & linter through jest |yarn test -u|Update jest snapshots |yarn run package|Creates a dist with packages for all languages. |yarn build|Compile + test + package |yarn bump|Bump version (with changelog) based on [conventional commits] |yarn release|Bump + push to master

  4. Create a feature branch

  5. Commit your changes

  6. Rebase your local changes against the master branch

  7. Create a new Pull Request (use conventional commits for the title please)

Licence

Apache License, Version 2.0

Author

Hunter-Thompson