hubbling the universe nebula by nebula
CSS Clojure HTML
Latest commit d682f44 Jan 10, 2017 @tolitius recording dev overrides

README.md

Hubble

Let me take you to April 24, 1990

The Hubble Telescope has been launched into orbit.

Earth awaits for one of the Hubble's Clojure/Script engines to boot up to communicate with humanity.

We are inside the Hubble, let's help booting it up...

Hubble, can you hear me?

Not only can Hubble hear you, but it can also listen to you and help humanity navigate through the space:

steps taken:

  • upgrading Hubble store from spacecraft://tape to spacecraft://ssd
  • mission change from Eagle Nebula to Horsehead Nebula
  • swapping the old monochrome camera for a new color one
  • mission change form Horsehead Nebula to Pismis 24-1

Hubble is configured, serviced and controlled from Earth via Consul. Every event Hubble receives is audited into its space log (a.k.a the "mission log").

What's inside

Backend

Hubble listens to Consul events via envoy:

(defn watch-consul [path]
  (let [listener (add-watchers)]
    (info "watching on" path)
    (envoy/watch-path path #(on-change listener (keys %)))))

(defstate consul-watcher :start (watch-consul (config :consul))
                         :stop (envoy/stop consul-watcher))

mount listens to envoy, and restarts only those Hubble components that need to be restarted given the change in Consul:

(defn add-watchers []
  (let [watchers {:hubble/mission/target  [#'hubble.consul/config #'hubble.core/mission]
                  :hubble/camera/mode     [#'hubble.consul/config #'hubble.core/camera]
                  :hubble/store/url       [#'hubble.consul/config #'hubble.core/store]}]
    (mount/restart-listener watchers)))

Would not be great to shut down the whole Hubble "system" in case we need to swap a camera, right? I agree, hence only the camera component is restarted in case it needs to be swapped / changed at runtime.

Frontend

On every Hubble component restart, Hubble sends out changes to Earth via a websocket channel using almighty httpkit.

In order for people of Earth to visualize Hubble component states, space log, and what Hubble is currently doing, an excellent, mission critical rum reacts to all the changes sent by Hubble and rerenders components. Again, only components that need to rerender will, because incremental changes rule.

Can I control Hubble?

You sure can, just point it to your Consul and boot up.

In case you do not have a Consul instance running, you can just install it (i.e. brew instal consul or similar) and start it in dev mode:

$ consul agent -dev

Does Hubble really use LISP?

In fact it does for many years now. Meet SPIKE: Intelligent Scheduling of Hubble Space Telescope Observations:

The development of started in early 1987 using Texas Instruments Explorer Lisp machines

Since 1987 there has been a great deal of evolution in Lisp hardware and software. We have continued to modify to keep pace with these changes

Updating for new Lisp language features has not been difficult, and there are currently no plans to convert any of the system to C or C++

License

Copyright © 2016 tolitius

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.