Requires Erlang, Elixir, and node.js, as specified in the .tool-versions file. You can use asdf for that.
load_control
folder is a library directly being used by the example_system
mix project, which is
the demo app.
Building:
cd example_system
mix deps.get &&
pushd assets &&
npm install &&
popd &&
mix compile
Starting for development with live reload (recommended for following with youtube):
iex -S mix phx.server
Then, you can visit the following links:
- http://localhost:4000
- http://localhost:4000/load
- http://localhost:4000/services
- http://localhost:4000/top
Building and starting for production (in the background):
cd example_system
./rebuild.sh
./_build/prod/rel/system/bin/system start
Open the remote console:
./_build/prod/rel/system/bin/system remote_console
Hot upgrade with no downtime:
mix system.upgrade
ExampleSystem.Metrics.init/1
- calls
LoadControl.subscribe_to_stats/0
LoadControl.subscribe_to_stats/0
- is a
defdelegate
toLoadControl.Stats.subscribe/0
LoadControl.Stats.subscribe/0
- stores
LoadControl
pid to its subscribers list in state - because this was called via
defdelegate
, this function is viewed as if a public function ofLoadControl
ExampleSystemWeb.Load.Dashboard.mount/3
- calls
ExampleSystem.Metrics.subscribe/0
ExampleSystem.Metrics.subscribe/0
- gets the calling pid (Dashboard LiveView), stores into its list of subscribes in state