(1) Changed cb_tutorial boss.config with mnesia inputs - I have put a nodename also called 'cb_tutorial" (created the directory also) as shown below:
{session_adapter, mnesia},
{session_key, "_boss_session"},
{session_exp_time, 525600},
{session_cookie_http_only, false},
{session_cookie_secure, false},
{session_enable, true},
{session_mnesia_nodes, ['cb_tutorial@mynodename']}, % <- replace "node()" with a node name
Also in the app configuration section I'm mentioning the directory path for mnesia where data should persist:
{ cb_tutorial, [
{path, "../cb_tutorial"},
{base_url, "/"},
% {domains, all},
% {static_prefix, "/static"},
% {doc_prefix, "/doc"},
{mnesia, "/MyDirectory/Documents/Tests/amnesia/cb_tutorial"}, % I want to persist the the data in this directory
{dummy, true}
]}
in DB configuration section:
{db_host, "localhost"},
{db_port, 1978},
{db_adapter, mnesia},
{db_username, "boss"},
{db_password, "boss"},
{db_database, "boss"},
In the priv/init directory I've put the util file that does all the initialization stuff for mnesia (https://github.com/ChicagoBoss/ChicagoBoss/wiki/Database-Setup).
Now I'm calling the init() at cb_tutorial_01_news.erl as:
init() ->
cb_tutorial_util:init(),
{ok, []}.
However, when running init-dev.sh I'm getting following error:
===================================================
14:57:43.713 [info] Starting master services on 'cb_tutorial@mynodename'
14:57:43.714 [info] SSL:[]
14:57:43.714 [info] Starting cowboy... on 'cb_tutorial@ mynodename'
14:57:43.714 [info] Starting http listener... on 0.0.0.0:8001
14:57:43.728 [info] Loading application cb_tutorial
14:57:43.736 [notice] Compile file "/Users/T316538/Documents/cb_tutorial/src/model/cb_tutorial_greeting_model.erl" with options [debug_info,{pre_revert_transform,#Fun<boss_record_compiler.trick_out_forms.2>},{token_transform,#Fun<boss_record_compiler.process_tokens.1>},{out_dir,undefined},{include_dirs,["/Users/T316538/Documents/cb_tutorial/include"]},{compiler_options,[{parse_transform,lager_transform},return_errors]}]
14:57:43.737 [info] Tokens [{'-',{1,1}},{atom,{1,2},module},{'(',{1,8}},{atom,{1,9},greeting},{',',{1,17}},{'[',{1,19}},{var,{1,20},'Id'},{',',{1,22}},{var,{1,24},'GreetingText'},{']',{1,36}},{')',{1,37}},{dot,{1,38}},{'-',{2,1}},{atom,{2,2},compile},{'(',{2,9}},{atom,{2,10},export_all},{')',{2,20}},{dot,{2,21}}]
14:57:43.737 [notice] Module "greeting" Parameters ['Id','GreetingText'] Attributes[{compile,export_all}]
14:57:43.754 [info] Compile Modules "src/view/lib/tag_html" cb_tutorial_view_lib_tags
14:57:43.763 [notice] Compile file "/Users/T316538/Documents/cb_tutorial/priv/init/cb_tutorial_01_news.erl" with options [{include_dirs,["/Users/T316538/Documents/cb_tutorial/include"]}]
14:57:43.785 [info] Start Database Adapter boss_db_adapter_mnesia options [{adapter,mnesia},{cache_enable,false},{cache_prefix,db},{shards,[]},{is_master_node,true},{db_database,"boss"},{db_password,"boss"},{db_username,"boss"},{db_host,"localhost"},{db_port,1978}]
14:57:44.786 [warning] lager_error_logger_h dropped 78 messages in the last second that exceeded the limit of 50 messages/sec
14:57:44.786 [info] Creating mnesia table for nodes ['cb_tutorial@mynodename']
14:57:44.787 [error] Error creating mnesia table for sessions: {bad_type,boss_session,disc_copies,'cb_tutorial@IAT-mynodename'}
---------------------------------------------------------------------------------------
Am I missing something?
Thanking all in advance.
RA