Use it for Kubernetes liveness & readiness checks. The middleware opens a HTTP server on port 3001. To check, open the http://localhost:3001/live & http://localhost:3001/ready URL.
{
"state": "up",
"uptime": 7.419,
# 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 |
version: '3' | |
services: | |
server: | |
image: "rancher/k3s:latest" | |
command: server | |
tmpfs: | |
- /run | |
- /var/run | |
privileged: true |
Use it for Kubernetes liveness & readiness checks. The middleware opens a HTTP server on port 3001. To check, open the http://localhost:3001/live & http://localhost:3001/ready URL.
{
"state": "up",
"uptime": 7.419,
"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() { |
It supports using MongoDB at development & production and using NeDB at unit testing.
NODE_ENV=test
).NEDB_FOLDER
is defined.NODE_ENV=test TEST_E2E=true
).posts.entity.created
, posts.entity.updated
, posts.entity.removed
It sends the Moleculer log messages to a Grafana Loki server directly. I'm using it to send logs from Fly.io moleculer app to Grafana Cloud.
For Kubernetes, I recommend to use Grafana Agent to send log messages because Agent adds K8s pod relevant labels to the messages.
// moleculer.config.js
"use strict"; | |
// Generate webpack config with CLI service | |
const webpackConfig = require("@vue/cli-service/webpack.config.js"); | |
// Create express app | |
const express = require("express"); | |
const app = express(); | |
// Configure webpack as middleware |
"use strict"; | |
let ServiceBroker = require("../src/service-broker"); | |
let BaseValidator = require("../src/validator"); | |
let { ValidationError } = require("../src/errors"); | |
// --- JOI VALIDATOR CLASS --- | |
class JoiValidator extends BaseValidator { | |
constructor() { | |
super(); |
Copyright 2021 Icebob
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL