Skip to content

Commit

Permalink
Unify docs
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Mar 3, 2020
1 parent fefdfb8 commit 4995d37
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 377 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2019 Chris McCord
Copyright (c) 2019 Michael Crumm, Chris McCord, José Valim

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
75 changes: 67 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,80 @@
# Phoenix.LiveDashboard
# Phoenix LiveDashboard

**TODO: Add description**
[Online Documentation](https://hexdocs.pm/phoenix_live_dashboard).

<!-- MDOC !-->

LiveDashboard provides real-time performance monitoring and debugging tools for Phoenix developers. It provides the following modules:

* Metrics - See how your application performs under different conditions by visualizing [`:telemetry`](https://hexdocs.pm/telemetry) events with real-time charts

* Request logging (coming soon) - See everything that was logged for a certain request

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `phoenix_live_dashboard` to your list of dependencies in `mix.exs`:
To start using LiveDashboard, you will need three steps:

1. Add the `phoenix_live_dashboard` dependency
2. Configure LiveView
3. Add the dashboard routes

### Add the `phoenix_live_dashboard` dependency

Add the following to your `mix.exs` and run `mix deps.get`:

```elixir
def deps do
[
{:phoenix_live_dashboard, "~> 0.1.0"}
{:phoenix_live_dashboard, github: "phoenixframework/phoenix_live_dashboard"}
]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/phoenix_live_dashboard](https://hexdocs.pm/phoenix_live_dashboard).
### Configure LiveView

The LiveDashboard is built on top of LiveView. If LiveView is already installed in your app, feel free to skip this section.

If you plan to use LiveView in your application in the future, we recommend you to follow [the official installation instructions](https://hexdocs.pm/phoenix_live_view/installation.html).
This guide only covers the minimum steps necessary for the LiveDashboard itself to run.

First, update your endpoint's configuration to include a signing salt. You can generate a signing salt by running `mix phx.gen.secret 32` (note Phoenix v1.5+ apps already have this configuration):

# config/config.exs
config :my_app, MyAppWeb.Endpoint,
live_view: [signing_salt: "SECRET_SALT"]

Then add the `Phoenix.LiveView.Socket` declaration to your endpodint:

socket "/live", Phoenix.LiveView.Socket

And you are good to go!

### Add the dashboard routes

Once installed, update your router's configuration to forward requests to a LiveDashboard with a unique `name` of your choosing:

```elixir
# lib/my_app_web/router.ex
use MyAppWeb, :router

...

# If using LiveDashboard in production,
# remember to add authentication to it.
if Mix.env() == :dev do
import Phoenix.LiveDashboard.Router

scope "/" do
pipe_through :browser
live_dashboard "/dashboard"
end
end
```

This is all. Run `mix phx.server` and access the "/dashboard" to configure the necessary modules.

<!-- MDOC !-->

## License

MIT License. Copyright (c) 2019 Michael Crumm, Chris McCord, José Valim.
187 changes: 0 additions & 187 deletions guides/installation.md

This file was deleted.

Loading

0 comments on commit 4995d37

Please sign in to comment.