%-*-Mode:erlang;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
% ex: set ft=erlang fenc=utf-8 sts=4 ts=4 sw=4 et nomod:

{sys,
 [
  % typical defaults
  {profile, embedded},
  {incl_cond, derived},
  {mod_cond, all},
  {app_file, keep},
  {excl_sys_filters, ["^bin/.*",
                      "^erts.*/bin/(dialyzer|typer)",
                      "^erts.*/(doc|info|include|lib|man|src)"]},

  % keep beam files exposed for module loading of internal services
  {excl_archive_filters, [".*"]},

  % not including scope script temporary directories
  {incl_app_filters, ["^(ebin|include|priv)/"]},

  % Erlang dependencies
  {erts,
   [{incl_cond, derived}, {mod_cond, all}, {app_file, keep}]},
  {app, hipe,
   [{incl_cond, exclude}]},
  % sometimes services need the debug_info within OTP applications
  {debug_info, keep},
  %{app, debugger,
  % [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, sasl,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},

  {boot_rel, "cloudi"},
  % CloudI source code, including dependencies
  {app, cloudi_core,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},

  % CloudI services, not automatically started
  % (i.e., started by the internal service configuration entries)
  {app, cloudi_service_api_requests,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_db_mysql,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_db_pgsql,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_filesystem,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_http_client,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_http_cowboy,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_http_elli,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_http_rest,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_map_reduce,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_monitoring,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_oauth1,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_queue,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_quorum,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_router,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_tcp,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_udp,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_validate,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},
  {app, cloudi_service_zeromq,
   [{incl_cond, include}, {mod_cond, all}, {app_file, keep}]},

  % application directories
  {lib_dirs,
   [
    "lib",
    "external"
    @ZEROMQ_ERLZMQ_PATH@
   ]},
  % application startup for release generation
  {rel, "cloudi", "1",
   [
    % CloudI
    cloudi_core,
    % Erlang
    sasl,
    stdlib,
    kernel
   ]},
  {rel, "start_clean", "",
   [
    kernel,
    stdlib
   ]}
 ]}.

{target_dir, "rel/cloudi"}.

{overlay,
 [
  {mkdir, "etc"},
  {copy,
   "@builddir@/rel/files/app.config",
   "etc/app.config"},
  {copy,
   "@builddir@/rel/files/vm.args",
   "etc/vm.args"},
  {mkdir, "bin"},
  {copy,
   "@srcdir@/rel/files/erl",
   "{{erts_vsn}}/bin/erl"},
  {copy,
   "@srcdir@/rel/files/nodetool",
   "{{erts_vsn}}/bin/nodetool"},
  {copy,
   "@srcdir@/rel/files/install_upgrade.escript",
   "bin/install_upgrade.escript"},
  {copy,
   "@srcdir@/rel/files/cloudi",
   "bin/cloudi"}
  % windows scripts
  %{copy,
  % "@srcdir@/rel/files/cloudi.cmd",
  % "bin/cloudi.cmd"},
  %{copy,
  % "@srcdir@/rel/files/start_erl.cmd",
  % "bin/start_erl.cmd"}
 ]}.
