Skip to content

Commit

Permalink
Updating readme!
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomanuel committed Nov 18, 2019
1 parent 12076c6 commit 4eb8eae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Live Qchatex
## Open sourced web application done by [Fiqus](https://fiqus.coop) for educational and experimental purposes.

The idea was to research and practice about [Phoenix LiveView](https://github.com/phoenixframework/phoenix_live_view) implementation and to play around a little with [Phoenix PubSub](https://hexdocs.pm/phoenix_pubsub/) + [Presence](https://hexdocs.pm/phoenix/Phoenix.Presence.html) for sockets, using [Memento](https://github.com/sheharyarn/memento) as [Elixir](https://elixir-lang.org/) wrapper to [Erlang Mnesia](https://learnyousomeerlang.com/mnesia) for data storage.
The idea was to research and practice about [Phoenix LiveView](https://github.com/phoenixframework/phoenix_live_view) implementation and to play around a little with [Phoenix PubSub](https://hexdocs.pm/phoenix_pubsub/) + [Presence](https://hexdocs.pm/phoenix/Phoenix.Presence.html) for sockets, using [Memento](https://github.com/sheharyarn/memento) as [Elixir](https://elixir-lang.org/) wrapper to [Erlang Mnesia](https://learnyousomeerlang.com/mnesia) for data storage.
Added clustering support by using [libcluster](https://github.com/bitwalker/libcluster), allowing Phoenix and Mnesia to work as distributed servers.

[Live Qchatex](https://github.com/fiqus/lqchatex) is a very simple and quick chat engine that allows you to create and join chat rooms on-the-fly.
Don't need to register, just enter a nickname and you are ready to go!
Expand All @@ -20,17 +21,24 @@ You will have to install:
* `Erlang/OTP` 22 or later
* `Node.js` 12 or later

## Start the server
## Start a single server

* Install dependencies with `mix deps.get`
* Install Node.js dependencies with `cd assets && npm install`
* Start Phoenix endpoint with `mix phx.server`

You can now visit [http://localhost:4000](http://localhost:4000) from your browser!

## Test
* `mix test` - run the tests
* `mix coverage` - for test coverage
## Mnesia reset data
* `mix mnesia.reset` - remove the mnesia storage directory from disk

## Mnesia
* `mix mnesia.reset` - remove the mnesia storage directory from disk
## Makefile
* `make clean` - remove mnesia data, _build/, priv/static/ and clean+unlock deps
* `make test` - run tests
* `make server` - run default server instance at *server@127.0.0.1* node accessible from [http://localhost:4000](http://localhost:4000)
* `make server1` - run additional server instance at *s1@127.0.0.1* node accessible from [http://localhost:4001](http://localhost:4001)
* `make server2` - run additional server instance at *s2@127.0.0.1* node accessible from [http://localhost:4002](http://localhost:4002)
* `make release` - build prod release and run it at *lqchatex@127.0.0.1* node accessible from [http://localhost:4004](http://localhost:4004)

Multiple server instances will connect to each other using **libcluster** with *gossip* topology!
You can try the cluster by running `server`, `server1`, `server2` and `release` at the same time.
4 changes: 4 additions & 0 deletions lib/live_qchatex_web/templates/chat/home.html.leex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
as <a href="https://elixir-lang.org/" target="_blank">Elixir</a> wrapper to
<a href="https://learnyousomeerlang.com/mnesia" target="_blank">Erlang Mnesia</a> for data storage.
</p>
<p>
Cluster support with <a href="https://github.com/bitwalker/libcluster" target="_blank">Libcluster</a>
for multiple distributed servers.
</p>
</section>

<%= LiveQchatexWeb.LayoutView.render_counters(assigns) %>
Expand Down
2 changes: 1 addition & 1 deletion lib/live_qchatex_web/templates/layout/app.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Live Qchatex · Elixir + Phoenix LiveView + PubSub + Presence + Mnesia + Memento · Fiqus.coop</title>
<title>Live Qchatex · Elixir + Phoenix LiveView + PubSub + Presence + Mnesia + Memento + Cluster · Fiqus.coop</title>
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
</head>
<body>
Expand Down

0 comments on commit 4eb8eae

Please sign in to comment.