I hereby claim:
- I am jmerriweather on github.
- I am jmerriweather (https://keybase.io/jmerriweather) on keybase.
- I have a public key whose fingerprint is EDA0 EC4B 2430 7DD6 4DCE 9FC2 E91E 478F B7FA 9EAA
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
[{kernel, | |
[ | |
{sync_nodes_optional, ['n1@127.0.0.1', 'n2@127.0.0.1']}, | |
{sync_nodes_timeout, 3000} | |
]} | |
]. |
diff --git a/config/dev.exs b/config/dev.exs | |
index 06daee3..afb1189 100644 | |
--- a/config/dev.exs | |
+++ b/config/dev.exs | |
@@ -7,7 +7,7 @@ use Mix.Config | |
# watchers to your application. For example, we use it | |
# with brunch.io to recompile .js and .css sources. | |
config :blogpost_amnesia, BlogpostAmnesia.Endpoint, | |
- http: [port: 4000], | |
+ http: [port: System.get_env("PORT") || 4000], |
PORT=4001 iex --name n1@127.0.0.1 --erl "-config sys.config" -S mix phoenix.server | |
PORT=4002 iex --name n2@127.0.0.1 --erl "-config sys.config" -S mix phoenix.server |
set PORT=4001 | |
iex --name n1@127.0.0.1 --erl "-config sys.config" -S mix phoenix.server | |
REM -- In new console window | |
set PORT=4002 | |
iex --name n2@127.0.0.1 --erl "-config sys.config" -S mix phoenix.server |
iex(n1@127.0.0.1)1> Node.list | |
[:"n2@127.0.0.1"] | |
~ | |
iex(n2@127.0.0.1)1> Node.list | |
[:"n1@127.0.0.1"] |
# needed to get defdatabase and other macros | |
use Amnesia | |
# defines a database called Database, it's basically a defmodule with | |
# some additional magic | |
defdatabase Database do | |
# this is just a forward declaration of the table, otherwise you'd have | |
# to fully scope User.read in Message functions | |
deftable User |
diff --git a/mix.exs b/mix.exs | |
index 683ee39..ffe337d 100644 | |
--- a/mix.exs | |
+++ b/mix.exs | |
@@ -33,6 +33,7 @@ defmodule BlogpostAmnesia.Mixfile do | |
{:phoenix_html, "~> 2.6"}, | |
{:phoenix_live_reload, "~> 1.0", only: :dev}, | |
{:gettext, "~> 0.11"}, | |
- {:cowboy, "~> 1.0"}] | |
+ {:cowboy, "~> 1.0"}, |
iex(n1@127.0.0.1)2> Amnesia.stop | |
:stopped | |
~ | |
iex(n2@127.0.0.1)2> Amnesia.stop | |
:stopped |
iex(n1@127.0.0.1)4> nodes = [node | Node.list] | |
[:"n1@127.0.0.1", :"n2@127.0.0.1"] | |
iex(n1@127.0.0.1)5> Amnesia.Schema.create(nodes) | |
:ok |