ekfa/apps/efka/src/efka_sup.erl
2025-09-19 21:07:31 +08:00

100 lines
2.8 KiB
Erlang

%%%-------------------------------------------------------------------
%% @doc efka top level supervisor.
%% @end
%%%-------------------------------------------------------------------
-module(efka_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_one, intensity => 1000, period => 3600},
ChildSpecs = [
#{
id => 'efka_service_sup',
start => {'efka_service_sup', start_link, []},
restart => permanent,
shutdown => 2000,
type => supervisor,
modules => ['efka_service_sup']
},
#{
id => 'docker_events',
start => {'docker_events', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['docker_events']
},
#{
id => 'efka_model_sup',
start => {'efka_model_sup', start_link, []},
restart => permanent,
shutdown => 2000,
type => supervisor,
modules => ['efka_model_sup']
},
%#{
% id => 'efka_inetd_task_log',
% start => {'efka_inetd_task_log', start_link, []},
% restart => permanent,
% shutdown => 2000,
% type => worker,
% modules => ['efka_inetd_task_log']
%},
#{
id => 'efka_subscription',
start => {'efka_subscription', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['efka_subscription']
},
#{
id => 'docker_manager',
start => {'docker_manager', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['docker_manager']
},
#{
id => 'efka_remote_agent',
start => {'efka_remote_agent', start_link, []},
restart => permanent,
shutdown => 2000,
type => worker,
modules => ['efka_remote_agent']
}
],
{ok, {SupFlags, ChildSpecs}}.
%% internal functions