aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2021-08-04 15:18:19 +0200
committerJordan Bracco <href@random.sh>2021-08-04 15:18:19 +0200
commit9fd14fc8d6d5e5e65ec44144c09908e582a3fefe (patch)
tree0ac9928c06fc78590beb948234fe488cbeefdabe
New rebar app
-rw-r--r--README.md13
-rw-r--r--apps/styx/src/styx.app.src15
-rw-r--r--apps/styx/src/styx_app.erl18
-rw-r--r--apps/styx/src/styx_sup.erl35
-rw-r--r--config/sys.config3
-rw-r--r--config/vm.args6
-rw-r--r--rebar.config38
-rw-r--r--rebar.lock17
8 files changed, 145 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4f1ea63
--- /dev/null
+++ b/README.md
@@ -0,0 +1,13 @@
+styx
+=====
+
+Ory Kratos/Hydra Lightweight erlang frontend.
+
+Can supervise external `kratos` and `hydra` processes directly.
+
+
+
+Build
+-----
+
+ $ rebar3 compile
diff --git a/apps/styx/src/styx.app.src b/apps/styx/src/styx.app.src
new file mode 100644
index 0000000..92a1e55
--- /dev/null
+++ b/apps/styx/src/styx.app.src
@@ -0,0 +1,15 @@
+{application, styx,
+ [{description, "Ory Kratos/Hydra Lightweight erlang frontend"},
+ {vsn, "0.1.0"},
+ {registered, []},
+ {mod, {styx_app, []}},
+ {applications,
+ [kernel,
+ stdlib
+ ]},
+ {env,[]},
+ {modules, []},
+
+ {licenses, ["Apache 2.0"]},
+ {links, []}
+ ]}.
diff --git a/apps/styx/src/styx_app.erl b/apps/styx/src/styx_app.erl
new file mode 100644
index 0000000..7ea35cd
--- /dev/null
+++ b/apps/styx/src/styx_app.erl
@@ -0,0 +1,18 @@
+%%%-------------------------------------------------------------------
+%% @doc styx public API
+%% @end
+%%%-------------------------------------------------------------------
+
+-module(styx_app).
+
+-behaviour(application).
+
+-export([start/2, stop/1]).
+
+start(_StartType, _StartArgs) ->
+ styx_sup:start_link().
+
+stop(_State) ->
+ ok.
+
+%% internal functions
diff --git a/apps/styx/src/styx_sup.erl b/apps/styx/src/styx_sup.erl
new file mode 100644
index 0000000..f9e812a
--- /dev/null
+++ b/apps/styx/src/styx_sup.erl
@@ -0,0 +1,35 @@
+%%%-------------------------------------------------------------------
+%% @doc styx top level supervisor.
+%% @end
+%%%-------------------------------------------------------------------
+
+-module(styx_sup).
+
+-behaviour(supervisor).
+
+-export([start_link/0]).
+
+-export([init/1]).
+
+-define(SERVER, ?MODULE).
+
+start_link() ->
+ supervisor:start_link({local, ?SERVER}, ?MODULE, []).
+
+%% sup_flags() = #{strategy => strategy(), % optional
+%% intensity => non_neg_integer(), % optional
+%% period => pos_integer()} % optional
+%% child_spec() = #{id => child_id(), % mandatory
+%% start => mfargs(), % mandatory
+%% restart => restart(), % optional
+%% shutdown => shutdown(), % optional
+%% type => worker(), % optional
+%% modules => modules()} % optional
+init([]) ->
+ SupFlags = #{strategy => one_for_all,
+ intensity => 0,
+ period => 1},
+ ChildSpecs = [],
+ {ok, {SupFlags, ChildSpecs}}.
+
+%% internal functions
diff --git a/config/sys.config b/config/sys.config
new file mode 100644
index 0000000..2eafc5f
--- /dev/null
+++ b/config/sys.config
@@ -0,0 +1,3 @@
+[
+ {styx, []}
+].
diff --git a/config/vm.args b/config/vm.args
new file mode 100644
index 0000000..70e2fd0
--- /dev/null
+++ b/config/vm.args
@@ -0,0 +1,6 @@
+-sname styx
+
+-setcookie styx_cookie
+
++K true
++A30
diff --git a/rebar.config b/rebar.config
new file mode 100644
index 0000000..bf70cb2
--- /dev/null
+++ b/rebar.config
@@ -0,0 +1,38 @@
+{erl_opts, [
+ debug_info
+]}.
+
+{deps, [
+ {cowboy, "2.9.0"},
+ {trails, "2.3.0"}
+]}.
+
+{relx, [{release, {styx, "0.1.0"},
+ [styx,
+ sasl]},
+
+ {mode, dev},
+
+ %% automatically picked up if the files
+ %% exist but can be set manually, which
+ %% is required if the names aren't exactly
+ %% sys.config and vm.args
+ {sys_config, "./config/sys.config"},
+ {vm_args, "./config/vm.args"}
+
+ %% the .src form of the configuration files do
+ %% not require setting RELX_REPLACE_OS_VARS
+ %% {sys_config_src, "./config/sys.config.src"},
+ %% {vm_args_src, "./config/vm.args.src"}
+]}.
+
+{profiles, [{prod, [{relx,
+ [%% prod is the default mode when prod
+ %% profile is used, so does not have
+ %% to be explicitly included like this
+ {mode, prod}
+
+ %% use minimal mode to exclude ERTS
+ %% {mode, minimal}
+ ]
+ }]}]}.
diff --git a/rebar.lock b/rebar.lock
new file mode 100644
index 0000000..13be5e9
--- /dev/null
+++ b/rebar.lock
@@ -0,0 +1,17 @@
+{"1.2.0",
+[{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0},
+ {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
+ {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1},
+ {<<"trails">>,{pkg,<<"trails">>,<<"2.3.0">>},0}]}.
+[
+{pkg_hash,[
+ {<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>},
+ {<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>},
+ {<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
+ {<<"trails">>, <<"B09703F056705F4943E14FFF077B98C711A6F48FAD40F4FF0B350794074AD69C">>}]},
+{pkg_hash_ext,[
+ {<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>},
+ {<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>},
+ {<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
+ {<<"trails">>, <<"40804001EB80417AA9D02400F39B7216956C3F251539A8A6096A69B3FAC0EA07">>}]}
+].