Error: ChicagoBoss configuration with mnesia

55 views
Skip to first unread message

Rana Aich

unread,
Sep 19, 2014, 6:34:26 PM9/19/14
to chica...@googlegroups.com
Hi All,

I've started working with Chicagoboss quite recently. I've gone through the cb_tutorial and it is working fine. Now I want  cb_tutorial to run with mnesia. I want to persist the data to my local directory. So far I've done the following:

(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


Graeme Defty

unread,
Sep 19, 2014, 8:36:05 PM9/19/14
to chica...@googlegroups.com
Hi,

Can you post the source for your 'sessions' model.

It looks like something in there may be causing problems.

g
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to chicagoboss...@googlegroups.com.
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/2954dcaf-2e6f-4a52-96d1-5e448287c2a0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Kai Janson

unread,
Sep 20, 2014, 3:10:28 AM9/20/14
to chica...@googlegroups.com
You are using the port number of the mock DB for mnesia.
Also, make sure you start your app first,
then execute

mnesia:stop(),
mnesia:create_database(node()).

Theo Restkarten, all Seouls be good New ...

Sent from my non-google-device
> To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/CAKF5fiBAO4Gy%2BhOUvS8%2B0vGHXc3C5EgYUR%2Be2CS0s_EYx9Y-EA%40mail.gmail.com.

Rana Aich

unread,
Sep 22, 2014, 3:15:53 PM9/22/14
to chica...@googlegroups.com
Thanks...I did just that...now those errors are gone...
Reply all
Reply to author
Forward
0 new messages