Closed DimitryDushkin closed 13 years ago
I don't reproduce :/ Did you add couchbeam to your applications need in your .app ?
$ erl -pa ebin -pa deps/ibrowse/ebin -s couchbeam
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.4 (abort with ^G)
1>
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.44.0>},
{name,alarm_handler},
{mfargs,{alarm_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.45.0>},
{name,overload},
{mfargs,{overload,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.43.0>},
{name,sasl_safe_sup},
{mfargs,
{supervisor,start_link,
[{local,sasl_safe_sup},sasl,safe]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.46.0>},
{name,release_handler},
{mfargs,{release_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
application: sasl
started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,ssl_sup}
started: [{pid,<0.52.0>},
{name,ssl_broker_sup},
{mfargs,{ssl_broker_sup,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,ssl_sup}
started: [{pid,<0.53.0>},
{name,ssl_manager},
{mfargs,{ssl_manager,start_link,[[]]}},
{restart_type,permanent},
{shutdown,4000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,ssl_sup}
started: [{pid,<0.54.0>},
{name,ssl_connection},
{mfargs,{ssl_connection_sup,start_link,[]}},
{restart_type,permanent},
{shutdown,4000},
{child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
application: ssl
started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,ibrowse_sup}
started: [{pid,<0.59.0>},
{name,ibrowse},
{mfargs,{ibrowse,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
application: ibrowse
started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,couchbeam_sup}
started: [{pid,<0.62.0>},
{name,couchbeam},
{mfargs,{couchbeam,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
1> S = couchbeam:server_connection().
{server,"127.0.0.1",5984,[],[]}
2> couchbeam:server_info(S).
=PROGRESS REPORT==== 18-Jun-2011::09:10:11 ===
supervisor: {local,inet_gethost_native_sup}
started: [{pid,<0.68.0>},{mfa,{inet_gethost_native,init,[[]]}}]
=PROGRESS REPORT==== 18-Jun-2011::09:10:11 ===
supervisor: {local,kernel_safe_sup}
started: [{pid,<0.67.0>},
{name,inet_gethost_native_sup},
{mfargs,{inet_gethost_native,start_link,[]}},
{restart_type,temporary},
{shutdown,1000},
{child_type,worker}]
{ok,{[{<<"couchdb">>,<<"Welcome">>},
{<<"version">>,<<"1.2.0a-7c9cd10-git">>}]}}
3>
Sure:
{application, st_db,
[
{description, "DB adapter server"},
{vsn, "1.0.0"},
{registered, []},
{modules, [st_db_app, st_db_sup, st_db]},
{applications, [
kernel,
stdlib,
sasl,
crypto,
ibrowse,
couchbeam
]},
{mod, { st_db_app, []}},
{env, []}
]}.
In your case there is also no progress report of couchbeam started on node, but everything seems works. It's kinda strange.
couchbeam is started locally:
=PROGRESS REPORT==== 18-Jun-2011::09:05:46 ===
supervisor: {local,couchbeam_sup}
started: [{pid,<0.62.0>},
{name,couchbeam},
{mfargs,{couchbeam,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
Well, I have app "st_db" with gen_server behavior:
start_link() ->
gen_server:start_link(?MODULE, ["localhost", 5984, "site_stater"], []).
init([Server, Port, DB]) ->
%application:start(couchbeam),
couchbeam:start(),
CouchServer = couchbeam:server_connection(Server, Port, "", []),
{ok, CouchDB} = couchbeam:open_or_create_db(CouchServer, DB, []),
{ok, #state{db_pid=CouchDB, server_pid=CouchServer}}.
If I run test like
db_write_delete_test() ->
{ok, Pid} = st_db:start_link(),
Doc = {[
{<<"url">>, "http://example.com"},
{<<"status">>, <<"test">>},
{<<"timestamp">>, 0}
]},
{ok, NewDoc} = gen_server:call(Pid, {save_doc, Doc}),
?assertMatch({ok, Result},
gen_server:call(Pid, {delete_doc, NewDoc})),
gen_server:cast(Pid, stop).
Everything OK. Now I have another app – "st_site_checker" which is using "st_db" app. I want to start "couchbeam" to start "st_db" to start "st_site_checker" (makefile):
ERL ?= erl
APP := st_site_checker
.PHONY: all test clean compile
all:
@./rebar compile
test: all
@./rebar skip_deps=true eunit
clean:
@./rebar clean
docs:
@erl -noshell -run edoc_run application '$(APP)' '"."' '[]'
start: all
erl -pa ../$(APP)/ebin ../st_db/ebin ../st_db/deps/*/ebin -boot start_sasl -s couchbeam -s st_db -s $(APP)
So I had this error:
macbook-pro-15:st_site_checker dimitry$ make start
==> st_site_checker (compile)
erl -pa ../st_site_checker/ebin ../st_db/ebin ../st_db/deps/*/ebin -boot start_sasl -s couchbeam -s st_db -s st_site_checker
Erlang R14B03 (erts-5.8.4) [source] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.34.0>},
{name,alarm_handler},
{mfargs,{alarm_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.35.0>},
{name,overload},
{mfargs,{overload,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.33.0>},
{name,sasl_safe_sup},
{mfargs,
{supervisor,start_link,
[{local,sasl_safe_sup},sasl,safe]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.36.0>},
{name,release_handler},
{mfargs,{release_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
application: sasl
started_at: nonode@nohost
Eshell V5.8.4 (abort with ^G)
1>
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,crypto_sup}
started: [{pid,<0.46.0>},
{name,crypto_server},
{mfargs,{crypto_server,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
application: crypto
started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
application: public_key
started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,ssl_sup}
started: [{pid,<0.52.0>},
{name,ssl_broker_sup},
{mfargs,{ssl_broker_sup,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,ssl_sup}
started: [{pid,<0.53.0>},
{name,ssl_manager},
{mfargs,{ssl_manager,start_link,[[]]}},
{restart_type,permanent},
{shutdown,4000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,ssl_sup}
started: [{pid,<0.54.0>},
{name,ssl_connection},
{mfargs,{ssl_connection_sup,start_link,[]}},
{restart_type,permanent},
{shutdown,4000},
{child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
application: ssl
started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,ibrowse_sup}
started: [{pid,<0.59.0>},
{name,ibrowse},
{mfargs,{ibrowse,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
application: ibrowse
started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 ===
supervisor: {local,couchbeam_sup}
started: [{pid,<0.62.0>},
{name,couchbeam},
{mfargs,{couchbeam,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
{"init terminating in do_boot",{undef,[{st_db,start,[]},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
make: *** [start] Error 1
I'm no stupid, really!) I know lots of programming languages, but this one killing me, but it has strage charm.)
Hum i've no problem to start it as a release. Maybe youcan join
utc+1 zone right now).
On Sat, Jun 18, 2011 at 9:50 AM, DimitryDushkin reply@reply.github.com wrote:
Well, I have app "st_db" with gen_server behavior:
start_link() -> gen_server:start_link(?MODULE, ["localhost", 5984, "site_stater"], []). init([Server, Port, DB]) -> %application:start(couchbeam), couchbeam:start(), CouchServer = couchbeam:server_connection(Server, Port, "", []), {ok, CouchDB} = couchbeam:open_or_create_db(CouchServer, DB, []), {ok, #state{db_pid=CouchDB, server_pid=CouchServer}}.
If I run test like
db_write_delete_test() -> {ok, Pid} = st_db:start_link(), Doc = {[ {<<"url">>, "http://example.com"}, {<<"status">>, <<"test">>}, {<<"timestamp">>, 0} ]}, {ok, NewDoc} = gen_server:call(Pid, {save_doc, Doc}), ?assertMatch({ok, Result}, gen_server:call(Pid, {delete_doc, NewDoc})), gen_server:cast(Pid, stop).
Everything OK. Now I have another app – "st_site_checker" which is using "st_db" app. I want to start "couchbeam" to start "st_db" to start "st_site_checker" (makefile):
ERL ?= erl APP := st_site_checker .PHONY: all test clean compile all: @./rebar compile test: all @./rebar skip_deps=true eunit clean: @./rebar clean docs: @erl -noshell -run edoc_run application '$(APP)' '"."' '[]' start: all erl -pa ../$(APP)/ebin ../st_db/ebin ../st_db/deps/*/ebin -boot start_sasl -s couchbeam -s st_db -s $(APP) ``` So I had this error:
macbook-pro-15:st_site_checker dimitry$ make start ==> st_site_checker (compile) erl -pa ../st_site_checker/ebin ../st_db/ebin ../st_db/deps/*/ebin -boot start_sasl -s couchbeam -s st_db -s st_site_checker Erlang R14B03 (erts-5.8.4) [source] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.34.0>}, {name,alarm_handler}, {mfargs,{alarm_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,sasl_safe_sup} started: [{pid,<0.35.0>}, {name,overload}, {mfargs,{overload,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,sasl_sup} started: [{pid,<0.33.0>}, {name,sasl_safe_sup}, {mfargs, {supervisor,start_link, [{local,sasl_safe_sup},sasl,safe]}}, {restart_type,permanent}, {shutdown,infinity}, {child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,sasl_sup} started: [{pid,<0.36.0>}, {name,release_handler}, {mfargs,{release_handler,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === application: sasl started_at: nonode@nohost Eshell V5.8.4 (abort with ^G) 1> =PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,crypto_sup} started: [{pid,<0.46.0>}, {name,crypto_server}, {mfargs,{crypto_server,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === application: crypto started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === application: public_key started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,ssl_sup} started: [{pid,<0.52.0>}, {name,ssl_broker_sup}, {mfargs,{ssl_broker_sup,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,ssl_sup} started: [{pid,<0.53.0>}, {name,ssl_manager}, {mfargs,{ssl_manager,start_link,[[]]}}, {restart_type,permanent}, {shutdown,4000}, {child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,ssl_sup} started: [{pid,<0.54.0>}, {name,ssl_connection}, {mfargs,{ssl_connection_sup,start_link,[]}}, {restart_type,permanent}, {shutdown,4000}, {child_type,supervisor}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === application: ssl started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,ibrowse_sup} started: [{pid,<0.59.0>}, {name,ibrowse}, {mfargs,{ibrowse,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}]
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === application: ibrowse started_at: nonode@nohost
=PROGRESS REPORT==== 18-Jun-2011::11:49:11 === supervisor: {local,couchbeam_sup} started: [{pid,<0.62.0>}, {name,couchbeam}, {mfargs,{couchbeam,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] {"init terminating in do_boot",{undef,[{st_db,start,[]},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump init terminating in do_boot () make: *\ [start] Error 1
I'm no stupid, really!) I know lots of programming languages, but this one killing me, but it has strage charm.) -- Reply to this email directly or view it on GitHub: https://github.com/benoitc/couchbeam/issues/52#issuecomment-1392699
Yeah, thank you anyway.)
looking at your log it seems couchbeam is correctly started. Probably something in your path?
In fact I gave up the idea to run couchbeam based app as standalone app. I've added application:start(couchbeam) to application behavior startup and now everything works. I also added this to eunit and all tests have passed.
On Tue, Jul 5, 2011 at 10:45 AM, DimitryDushkin reply@reply.github.com wrote:
In fact I gave up the idea to run couchbeam based app as standalone app. I've added application:start(couchbeam) to application behavior startup and now everything works. I also added this to eunit and all tests have passed.
well erica is runnig couchbeam as a standalone app also other apps too. Pretty sure there is something.We could talk about it later in the day if you want or irc #couchdbkit. Will be online around 6 PM UTC+1.
- benoît
I wrote some program (st_db) used couchbeam. The problem is couchbeam do not starts on node after supervisor call. Seems like it just hangs on command "-s couchbeam". The only way to start it – write manually "application:start(couchbeam)." and only after this I can start my app: