Code Monkey home page Code Monkey logo

dev-env-manager's People

Contributors

oubiwann avatar

Watchers

 avatar  avatar

dev-env-manager's Issues

Allow for watchers to be added

Right now, the Hawk watch objects are thrown away; we should track them so that we can unwatch and close during component shutdown.

High CPU Usage

With the latest changes to the code, (run) now induces very high CPU load. Need to find out why, and then fix that.

To duplicate:

  1. Start REPL: lein repl
  2. Start the system: (run) -- ~one CPU core will jump a little, due to the new service starting up, and then it will settle down.
  3. Reload the system: (reload) -- all CPU cores will jump, and then 1-2 will stay maxed at 100%; subsequent, repeated (reload)s will cause all CPU cores to peg out at 100%.

Depends on #3.

Move redundant get-summary function implementations into common ns

  • Option 1: cmr.dev.env.manager.components.common
  • Option 2: cmr.dev.env.manager.components.checks.common

Leaning towards the first one, since:

  1. the ns's that are using it will be in cmr.dev.env.manager.components and cmr.dev.env.manager.components.dem
  2. the ns cmr.dev.env.manager.components.checks health pulls in ns's from cmr.dev.env.manager.components and cmr.dev.env.manager.components.dem ... and we wouldn't want to cross the streams ...

Create timer component

  • Use the timing functions created in #19
  • Create timer subscribers that subscribe to timer intervals
  • Update timing/timer function to accept a parameter to set the looping time
  • Have the timer component set the looping time

Implement whole-system state management

  • Define states
  • Define state transitions
  • Only allow legal transitions between two given states
  • Implement start for whole system
  • Implement stop for whole system
  • Implement restart for whole system

Prototype a new approach for a CMR development environment manager

Important Links:

Epic features:

  • System
    • Add component infrastructure
    • Implement whole-system state management - see #11
    • Add component messaging capability - see #4
    • Implement dev-env-only components - IN PROGRESS - see #9
  • CMR Services
    • Implement service components - IN PROGRESS - see #8
    • Implement per-service state management - see #10
  • Monitoring
    • Create fs watcher protocol/API - see #32
    • Add file system watcher component - see #38
    • Manage code changes - see #35
    • Support auto-restarting services (optional)
    • Support auto-reloading changed files (optional)
    • Add service monitor (health check) component - IN PROGRESS - see #17
    • Support auto-killing/restarting of services with lost connections (optional)
  • Performance
    • Add JMX instrumentation - see #3
    • Add time-tracking to state management - see #12

Create Java NIO fs watcher implementation

Create core.async timer functionality

We need to be able to run functions periodically, every given interval. This will be used initially to support health checks of running services/processes.

Dev tasks:

  • Investigate core.async examples of this
  • Implement best fit for our needs
  • Parameterize appropriately for use by components

Implement dev-only components

We may need to implement components for various services that are used in CMR's dev-system. Possible candidates:

  • elasticsearch - IN PROGRESS - see #15
  • in-memory db
  • external db
  • in-memory queue
  • external queue
  • aws queue

Create component for starting up local Elasticsearch

  • Create component in cmr.dev.env.manager.components.system
  • Use cmr.dev.env.manager.components.common.docker (depends on #14)
  • Identify the correct version to use and the corresponding docker container to use
  • Add elasticsearch-head support (see #24)
  • Ensure that it's configured like the one started by CMR's dev-system

Implement per-service state management

  • Add in-REPL state tracking for each component
  • Add support for starting a single component
  • Add support for stopping a single component
  • Add support for restarting a single component
  • Add support for tracking start time of a single component
  • Add support for tracking end time of a single component

Manage code changes

Update Watcher component to:

  • Perform "ubercompile" and check for errors
  • Upon ubercompile error
    • Update state of service: :code-change? true, :successful-recompile? false
    • Log an error message
    • Publish message :topic :unsuccessful-recompile :message {... :service-key service-key}
    • Go no further in the code change management process
  • Upon successful recompile
    • Log success message to debug
    • Update state :code-change? true, :successful-recompile? true
    • Publish message :topic :successful-recompile :message {... :service-key service-key}

Add health checks component

Tasks:

  • Create generic health check functions - see #18
  • Create core.async timer functionality - see #19
  • Create timer component - see #21
  • Create cmr.dev.env.manager.components.dem.health
    • Ensure individual service state gets updated upon checks
  • Create new component instance in cmr.dev.env.manager.components.system
  • Add data structure for all desired / currently enabled (or supported) health checks in cmr.dev.env.manager.components.system
  • Perform overall system checks, too
    • Ensure system state gets updated upon checks

Data structure might be something like this:

[{:name :mock-echo :type :tcp :frequency 30000}
 {:name :mock-echo :type :http :frequency 5000}
 {:name :elasticsearch :type :docker :frequency 10000}

Depends on #21

Add time-tracking to state management

  • Create a namespace that won't get reloaded
  • Define atoms for holding time data:
    • service start times (moved to #10)
    • system start times
    • service stop times (moved to #10)
    • system stop times
  • Define convenience functions for extracting data
    • Get last start/stop/restart time
    • Get average start/stop/restart time

Depends upon: #10, #11

Create a general component for starting Docker containers

  • Create namespace cmr.dev.env.manager.components.common.docker
  • Support non-daemon process fork
  • Capture the container ID and track this in the component's data
  • Provide a means of checking the container's status
  • Use the container ID to shutdown the correct container

Add namespace for testing wrappers

  • Add ltest as a dep
  • Run all tests
  • Run just unit tests
  • Run just integration tests
  • Run tests matching regex
  • Run test namespace
  • Run a single test case

Allow for subscribers to be deleted

The core functionality for this is provided by the core.async/unsub function:

(unsub p topic ch)

However, this requires that we hold onto the channel that gets subscribed to a publisher. The pubsub messaging impl needs to be updated to track subscribers. These should probably be named, too -- which means a handful of functions need to be updated. We should also provide API fns for getting all subscribers, one subscriber, unsubscribing all subscribers, and unsubscribing one.

This will mean we can update the shutdown for the default-subscriber component to unsub its own and then update the messaging component to unsubscribe all. The timer component can unsubscribe its own, too.

Add component messaging capability

Right now, any component that needs to send or receive messages is creating and managing its own set of core.async channels. It would be better if there was a pubsub component that allowed any component to publish to topics, and any component to subscribe to topics.

Create generic health check functions

For every type of supported health check, we will need a function to perform the check. So far, these are:

  • :tcp - a simple TCP "ping-like" functionality (e.g., TCP CONNECT-only) - connect to host and port
  • :http - an HTTP health check - do an HTTP GET against a specified endpoint and parse results
  • :docker - check the status of a running Docker container
  • :cpu - check the CPU usage of a process-based service
  • :mem - check the memory usage of a process-based service

Ultimately, these would be used like so at the system-component-level:

[{:name :mock-echo :type :tcp :frequency 30000}
 {:name :mock-echo :type :http :frequency 5000}
 {:name :elasticsearch :type :docker :frequency 10000}

But directly, these functions would probably be utilized by a new health method supported by service components -- those would be responsible for setting/configuring the proper hosts, ports, endpoints, containers, etc.

As such, dev tasks might be this:

  • Create generic TCP ping function ... maybe return {:connects? <bool>}
  • Create generic HTTP GETter with response body-parsing and HTTP status code-checking ... maybe return {:status <int> :value <parsed body>}
  • Create generic Docker container checker ... maybe return {:container-up? <bool>}
  • Create a generic process CPU checker ... maybe return {:cpu <float>}
  • Update ProcessRunner component to support a health method
  • Update DockerRunner component to support a health method
  • Implement health methods for each service type to call the appropriate generic health functions, dispatched on type

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.