Code Monkey home page Code Monkey logo

argus-node's Introduction

argus-node

Container lifecycle watcher and config distribution with websockets

Install

npm install -g incureforce/argus-node.git

Launch

To launch it just argus-node in your favorite shell.

If argus-node finds a "app-shell.js" file it enters client mode, if not it enters server mode.

app-shell.js

webapp-sample

Sample app-shell.js for a web-app container.

When it launches it registers config values under service.proxy (hostname).

const os = require('os')

module.exports = {
    url: "http://argus/",

    startup: function (ctx) {
        ctx.update('services.proxy', {
            hostname: os.hostname()
        })
    },

    dispose: function (ctx) {
        ctx.update('services.proxy')
    },
}

proxy-sample

Sample app-shell.js for a proxy container.

When it launches it fetches all config values under service.proxy and prints them to stdout. Every time a new clients connects we get a notify callback with all config values under serivce.proxy.

module.exports = {
    url: "http://argus/",

    startup: function (ctx) {
        ctx.notify('services.proxy', function (path, content) {
            console.log('notify', path, content)
        })
    },

    dispose: function (ctx) {
    },
}

docker-compose sample

You can try it out yourself: Link

version: "3.3"
services:
  argus:
    build: argus-node
    image: argus-node
    networks:
      - test
    hostname: argus
    container_name: argus
  web-proxy:
    build: argus-proxy
    image: argus-proxy
    networks:
      - test
    hostname: argus-proxy
    depends_on:
      - argus
    container_name: argus-proxy
  web-app-a:
    build: argus-web-app
    image: argus-web-app
    depends_on:
      - argus
    networks:
      - test
  web-app-b:
    build: argus-web-app
    image: argus-web-app
    depends_on:
      - argus
    networks:
      - test

networks:
  test:

docker-compose

argus-node's People

Contributors

incureforce avatar

Watchers

James Cloos avatar  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.