Skip to content

Instantly share code, notes, and snippets.

View icebob's full-sized avatar

Icebob icebob

View GitHub Profile
@icebob
icebob / ALTERNATIVES.adoc
Created October 30, 2018 15:53 — forked from mbbx6spp/ALTERNATIVES.adoc
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
@icebob
icebob / README.md
Last active April 30, 2020 23:45
Cacher cleaner mixin for Moleculer DB service

Cache cleaner mixin for Moleculer DB service

Usage

const DbService	= require("moleculer-db");

module.exports = {
    name: "boards",
@icebob
icebob / README.md
Last active March 18, 2023 09:27
DB service mixin for Moleculer DB

DB handler mixin for Moleculer DB

It supports using MongoDB at development & production and using NeDB at unit testing.

Features

  • use NeDB memory DB for unit testing (NODE_ENV=test).
  • use NeDB file storage if NEDB_FOLDER is defined.
  • use other empty MongoDB database for E2E testing (NODE_ENV=test TEST_E2E=true).
  • create collection indexes.
  • generate entity changed broker messages. E.g. posts.entity.created, posts.entity.updated, posts.entity.removed
@icebob
icebob / README.md
Created December 14, 2018 11:22
Memoize mixin for Moleculer services

Memoize mixin for Moleculer services

Add caching for Moleculer service methods too. This mixin creates a memoize method which caches responses in service methods.

Usage

const Memoize = require("../mixins/memoize.mixin");

module.exports = {
 name: "acl",
@icebob
icebob / README.md
Last active December 14, 2018 11:34
Secure IDs with `hashids`

Secure IDs

This mixin created two methods to encode & decode your IDs in order to be more secure. Read more about it in hashids.js readme. It generates a Youtube-like ID from Number IDs or Mongo ObjectID.

Usage

Please note, you should define a salt for HashID with HASHID_SALT environment variables.

const SecureID = require("../mixins/secure-id.mixin");
@icebob
icebob / README.md
Created January 10, 2019 20:14
Inter-namespace middleware

Inter-namespace middleware

This middleware can connect to other namespaces.

Usage

Connect to other namespaces with the same broker options

moleculer.config.js

const InterNamespaceMiddleware = require("./inter-namespace.js");
@icebob
icebob / saga-sample.js
Last active October 2, 2023 10:47
Saga middleware PoC for Moleculer
"use strict";
const _ = require("lodash");
const chalk = require("chalk");
const Promise = require("bluebird");
const ServiceBroker = require("../src/service-broker");
const { MoleculerError } = require("../src/errors");
// --- SAGA MIDDLEWARE ---
const SagaMiddleware = function() {
@icebob
icebob / README.md
Last active November 8, 2024 09:41
Health-check middleware for Moleculer (for Kubernetes liveness readiness checks)
'use strict';
const path = require('path');
const fs = require('fs');
const YAML = require('yaml');
function WebpackMoleculerServicePlugin(options) {
options = options || {};
if (typeof options === 'string') {
this.options = { output: options };
@icebob
icebob / k3s_helm_install.sh
Last active May 29, 2025 15:12
K3S + Helm installing
# Install K3S
curl -sfL https://get.k3s.io | sh -
# Copy k3s config
mkdir $HOME/.kube
sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config
sudo chmod 644 $HOME/.kube/config
# Check K3S
kubectl get pods -n kube-system