ekfa/apps/docker/src/docker_sup.erl

43 lines
1.2 KiB
Erlang

%%%-------------------------------------------------------------------
%% @doc Docker top level supervisor.
%% @end
%%%-------------------------------------------------------------------
-module(docker_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).
-define(SERVER, ?MODULE).
-spec start_link() -> {ok, pid()} | ignore | {error, term()}.
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
-spec init(list()) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}.
init([]) ->
SupFlags = #{strategy => one_for_one, intensity => 1000, period => 3600},
ChildSpecs = [
#{
id => docker_task_reporter,
start => {docker_task_reporter, start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => [docker_task_reporter]
},
#{
id => docker_deploy_manager,
start => {docker_deploy_manager, start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => [docker_deploy_manager]
}
],
{ok, {SupFlags, ChildSpecs}}.