Errors while trying to run core locally

Hey all! We are three Bachelor’s students doing our thesis right now. We use the cht-core for some enhancements from our side.
While trying to get it up and running, we ran into some quite tricky errors we could not solve until now. We are using Ubuntu and have done everything according to the development.md. We have also seen the other posts but they didnt really clarify our problems. These are the three main problems:

When running “grunt”, this was one of the errors:
Running “exec:build-webapp” (exec) task
Error: Lock found, but no process with PID 1937291 seems to be running.

Another one occured while trying to run “node server.js”:
COUCH_URL http://localhost:5984/medic
COUCH_NODE_NAME nonode@nohost
2022-03-09 09:49:40 ERROR: Fatal error initialising medic-api
2022-03-09 09:49:40 ERROR: 'CouchDB doesn't seem to be running on http://localhost:5984/medic. Tried to connect but got an error:\n Error: socket hang up\n at createHangUpError

The couchdb is running, however there are only databases _global_changes and _replicator available.

Last but not least, when using docker and stopping the container it seems to vanish. We have to initialize everything again. Do you have any idea why?

Thanks for your help, it is greatly appreciated!
Joel, Nicolas and Silvan

1 Like

Hey, welcome to the CHT! These are some tricky errors. I think the best approach is to start by figuring out what is going wrong when running just the default grunt command (since the result of that command can have an effect on subsequent executions of node server.js). Could you please post the entire output when grunt is run so that we can see everything with some context?

1 Like

Assuming you just talking about running CouchDB in a Docker container (as described in the DEVELOPMENT.md) and not trying to run containers from the docker-compose.yml config or anything like that, then I think I can see the issue!

It looks like our documentation is causing the confusion because the sample docker run... command contains the --rm flag which will cause the container to be removed whenever it is stopped. (Which, as you have noticed, does not match up with the later recommendations on how the medic-couchdb container can be stopped and started.)

So, I think all you need to do here is just remove the --rm flag when initially running the CouchDB container.

I have logged a new PR to clear up the documentation.

1 Like

Hey jkuester, thanks for the fast reply!

This first snippet is from a problem with the docker (as you rightly pointed out done in a container, and I overread the -rm so thanks for pointing that out!). These are the “docker logs medic-couchdb”:

For some reason I cannot access http://127.0.0.1:5984/_utils#setup (simply no connection). Did you have that issue as well?

[error] 2022-03-09T19:36:14.474934Z nonode@nohost <0.546.0> -------- gen_server <0.546.0> terminated with reason: killed
last msg: {‘EXIT’,<0.402.0>,killed}
state: {state,94307,couch_replicator_doc_processor,nil,<<“_replicator”>>,#Ref<0.0.1.1389>,nil,[],true}
extra: []
[error] 2022-03-09T19:36:14.478862Z nonode@nohost <0.546.0> -------- CRASH REPORT Process (<0.546.0>) with 0 neighbors exited with reason: killed at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_multidb_changes,init,[‘Argument__1’]}, ancestors: [<0.402.0>,couch_replicator_sup,<0.347.0>], messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 1598, stack_size: 27, reductions: 2100
[error] 2022-03-09T19:36:14.486234Z nonode@nohost <0.2932.0> -------- gen_server <0.2932.0> terminated with reason: killed
last msg: {‘EXIT’,<0.2929.0>,killed}
state: {st,<0.2929.0>,couch_mrview_index,undefined}
extra: []
[error] 2022-03-09T19:36:14.486720Z nonode@nohost <0.2932.0> -------- CRASH REPORT Process (<0.2932.0>) with 0 neighbors exited with reason: killed at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_index_compactor,init,[‘Argument__1’]}, ancestors: [<0.2929.0>,<0.2928.0>], messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 27, reductions: 126
[error] 2022-03-09T19:36:14.486820Z nonode@nohost <0.2931.0> -------- gen_server <0.2931.0> terminated with reason: killed
last msg: {‘EXIT’,<0.2929.0>,killed}
state: {st,<0.2929.0>,couch_mrview_index,nil}
extra: []
[error] 2022-03-09T19:36:14.487023Z nonode@nohost <0.2931.0> -------- CRASH REPORT Process (<0.2931.0>) with 0 neighbors exited with reason: killed at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_index_updater,init,[‘Argument__1’]}, ancestors: [<0.2929.0>,<0.2928.0>], messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 27, reductions: 126
[error] 2022-03-09T19:36:14.487191Z nonode@nohost <0.2754.0> -------- gen_server <0.2754.0> terminated with reason: killed
last msg: {‘EXIT’,<0.2751.0>,killed}
state: {st,<0.2751.0>,couch_mrview_index,undefined}
extra: []
[error] 2022-03-09T19:36:14.487443Z nonode@nohost <0.2754.0> -------- CRASH REPORT Process (<0.2754.0>) with 0 neighbors exited with reason: killed at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_index_compactor,init,[‘Argument__1’]}, ancestors: [<0.2751.0>,<0.2750.0>], messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 27, reductions: 126
[error] 2022-03-09T19:36:14.487551Z nonode@nohost <0.2753.0> -------- gen_server <0.2753.0> terminated with reason: killed
last msg: {‘EXIT’,<0.2751.0>,killed}
state: {st,<0.2751.0>,couch_mrview_index,nil}
extra: []
[error] 2022-03-09T19:36:14.487795Z nonode@nohost <0.2753.0> -------- CRASH REPORT Process (<0.2753.0>) with 0 neighbors exited with reason: killed at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_index_updater,init,[‘Argument__1’]}, ancestors: [<0.2751.0>,<0.2750.0>], messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 27, reductions: 126
[error] 2022-03-09T19:36:14.487925Z nonode@nohost <0.1891.0> -------- gen_server <0.1891.0> terminated with reason: killed
last msg: {‘EXIT’,<0.1888.0>,killed}
state: {st,<0.1888.0>,couch_mrview_index,undefined}
extra: []
[error] 2022-03-09T19:36:14.488001Z nonode@nohost <0.1890.0> -------- gen_server <0.1890.0> terminated with reason: killed
last msg: {‘EXIT’,<0.1888.0>,killed}
state: {st,<0.1888.0>,couch_mrview_index,nil}
extra: []
[error] 2022-03-09T19:36:14.488174Z nonode@nohost <0.1891.0> -------- CRASH REPORT Process (<0.1891.0>) with 0 neighbors exited with reason: killed at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_index_compactor,init,[‘Argument__1’]}, ancestors: [<0.1888.0>,<0.1887.0>], messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 27, reductions: 150
[error] 2022-03-09T19:36:14.488765Z nonode@nohost <0.1890.0> -------- CRASH REPORT Process (<0.1890.0>) with 0 neighbors exited with reason: killed at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_index_updater,init,[‘Argument__1’]}, ancestors: [<0.1888.0>,<0.1887.0>], messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 376, stack_size: 27, reductions: 150
[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
[info] 2022-03-09T19:36:22.286993Z nonode@nohost <0.9.0> -------- Application couch_log started on node nonode@nohost
[info] 2022-03-09T19:36:22.300706Z nonode@nohost <0.9.0> -------- Application folsom started on node nonode@nohost
[info] 2022-03-09T19:36:22.399887Z nonode@nohost <0.9.0> -------- Application couch_stats started on node nonode@nohost
[info] 2022-03-09T19:36:22.400264Z nonode@nohost <0.9.0> -------- Application khash started on node nonode@nohost
[info] 2022-03-09T19:36:22.420956Z nonode@nohost <0.9.0> -------- Application couch_event started on node nonode@nohost
[info] 2022-03-09T19:36:22.421498Z nonode@nohost <0.9.0> -------- Application hyper started on node nonode@nohost
[info] 2022-03-09T19:36:22.436309Z nonode@nohost <0.9.0> -------- Application ibrowse started on node nonode@nohost
[info] 2022-03-09T19:36:22.451141Z nonode@nohost <0.9.0> -------- Application ioq started on node nonode@nohost
[info] 2022-03-09T19:36:22.451581Z nonode@nohost <0.9.0> -------- Application mochiweb started on node nonode@nohost
[info] 2022-03-09T19:36:22.473672Z nonode@nohost <0.206.0> -------- Apache CouchDB 2.3.1 is starting.

[info] 2022-03-09T19:36:22.473879Z nonode@nohost <0.207.0> -------- Starting couch_sup
[notice] 2022-03-09T19:36:22.505337Z nonode@nohost <0.90.0> -------- config: [features] pluggable-storage-engines set to true for reason nil
[info] 2022-03-09T19:36:22.776792Z nonode@nohost <0.206.0> -------- Apache CouchDB has started. Time to relax.

[info] 2022-03-09T19:36:22.776938Z nonode@nohost <0.206.0> -------- Apache CouchDB has started on http://any:5986/
[info] 2022-03-09T19:36:22.777336Z nonode@nohost <0.9.0> -------- Application couch started on node nonode@nohost
[info] 2022-03-09T19:36:22.777642Z nonode@nohost <0.9.0> -------- Application ets_lru started on node nonode@nohost
[error] 2022-03-09T19:36:22.843488Z nonode@nohost <0.256.0> -------- Could not get design docs for <<“shards/00000000-1fffffff/_users.1646847220”>> error:{badarg,[{ets,member,[mem3_openers,<<“_users”>>],[]},{mem3_shards,maybe_spawn_shard_writer,3,[{file,“src/mem3_shards.erl”},{line,476}]},{mem3_shards,load_shards_from_db,2,[{file,“src/mem3_shards.erl”},{line,381}]},{mem3_shards,load_shards_from_disk,1,[{file,“src/mem3_shards.erl”},{line,370}]},{mem3_shards,for_db,2,[{file,“src/mem3_shards.erl”},{line,59}]},{fabric_view_all_docs,go,5,[{file,“src/fabric_view_all_docs.erl”},{line,24}]},{couch_db,‘-get_design_docs/1-fun-0-’,1,[{file,“src/couch_db.erl”},{line,627}]}]}
[error] 2022-03-09T19:36:22.843666Z nonode@nohost emulator -------- Error in process <0.260.0> with exit value:
{badarg,[{ets,member,[mem3_openers,<<“_users”>>],[]},{mem3_shards,maybe_spawn_shard_writer,3,[{file,“src/mem3_shards.erl”},{line,476}]},{mem3_shards,load_shards_from_db,2,[{file,“src/mem3_shards.erl”},{line,381}]},{mem3_shards,load_shards_from_disk,1,[{file,“src/mem3_shards.erl”},{line,370}]},{mem3_shards,for_db,2,[{file,“src/mem3_shards.erl”},{line,59}]},{fabric_view_all_docs,go,5,[{file,“src/fabric_view_all_docs.erl”},{line,24}]},{couch_db,‘-get_design_docs/1-fun-0-’,1,[{file,“src/couch_db.erl”},{line,627}]}]}

[notice] 2022-03-09T19:36:22.858295Z nonode@nohost <0.275.0> -------- rexi_server : started servers
[notice] 2022-03-09T19:36:22.864905Z nonode@nohost <0.279.0> -------- rexi_buffer : started servers
[info] 2022-03-09T19:36:22.865220Z nonode@nohost <0.9.0> -------- Application rexi started on node nonode@nohost
[info] 2022-03-09T19:36:22.937763Z nonode@nohost <0.9.0> -------- Application mem3 started on node nonode@nohost
[info] 2022-03-09T19:36:22.937904Z nonode@nohost <0.9.0> -------- Application fabric started on node nonode@nohost
[info] 2022-03-09T19:36:22.987297Z nonode@nohost <0.9.0> -------- Application chttpd started on node nonode@nohost
[info] 2022-03-09T19:36:23.019801Z nonode@nohost <0.9.0> -------- Application couch_index started on node nonode@nohost
[info] 2022-03-09T19:36:23.019946Z nonode@nohost <0.9.0> -------- Application couch_mrview started on node nonode@nohost
[info] 2022-03-09T19:36:23.020096Z nonode@nohost <0.9.0> -------- Application couch_plugins started on node nonode@nohost
[notice] 2022-03-09T19:36:23.166326Z nonode@nohost <0.90.0> -------- config: [features] scheduler set to true for reason nil
[info] 2022-03-09T19:36:23.235977Z nonode@nohost <0.9.0> -------- Application couch_replicator started on node nonode@nohost
[info] 2022-03-09T19:36:23.258485Z nonode@nohost <0.9.0> -------- Application couch_peruser started on node nonode@nohost
[info] 2022-03-09T19:36:23.300337Z nonode@nohost <0.9.0> -------- Application ddoc_cache started on node nonode@nohost
[info] 2022-03-09T19:36:23.344178Z nonode@nohost <0.9.0> -------- Application global_changes started on node nonode@nohost
[info] 2022-03-09T19:36:23.344342Z nonode@nohost <0.9.0> -------- Application jiffy started on node nonode@nohost
[info] 2022-03-09T19:36:23.363647Z nonode@nohost <0.9.0> -------- Application mango started on node nonode@nohost
[info] 2022-03-09T19:36:23.385256Z nonode@nohost <0.9.0> -------- Application setup started on node nonode@nohost
[info] 2022-03-09T19:36:23.385390Z nonode@nohost <0.9.0> -------- Application snappy started on node nonode@nohost

It seems that now grunt throws a basic error about the COUCH_URL. Will get back with the logs as soon as I can fix this one.

Regarding your medic-couchdb logs, those look very similar to the logs that I get, (but mine are missing the odd errors at the beginning…):

logs
❯ docker logs -f medic-couchdb
[info] 2022-03-09T20:46:14.573187Z nonode@nohost <0.9.0> -------- Application couch_log started on node nonode@nohost
[info] 2022-03-09T20:46:14.576063Z nonode@nohost <0.9.0> -------- Application folsom started on node nonode@nohost
[info] 2022-03-09T20:46:14.601749Z nonode@nohost <0.9.0> -------- Application couch_stats started on node nonode@nohost
[info] 2022-03-09T20:46:14.602006Z nonode@nohost <0.9.0> -------- Application khash started on node nonode@nohost
[info] 2022-03-09T20:46:14.606819Z nonode@nohost <0.9.0> -------- Application couch_event started on node nonode@nohost
[info] 2022-03-09T20:46:14.606971Z nonode@nohost <0.9.0> -------- Application hyper started on node nonode@nohost
[info] 2022-03-09T20:46:14.610607Z nonode@nohost <0.9.0> -------- Application ibrowse started on node nonode@nohost
[info] 2022-03-09T20:46:14.613844Z nonode@nohost <0.9.0> -------- Application ioq started on node nonode@nohost
[info] 2022-03-09T20:46:14.613982Z nonode@nohost <0.9.0> -------- Application mochiweb started on node nonode@nohost
[info] 2022-03-09T20:46:14.619223Z nonode@nohost <0.206.0> -------- Apache CouchDB 2.3.1 is starting.

[info] 2022-03-09T20:46:14.619302Z nonode@nohost <0.207.0> -------- Starting couch_sup
[notice] 2022-03-09T20:46:14.625770Z nonode@nohost <0.90.0> -------- config: [features] pluggable-storage-engines set to true for reason nil
[notice] 2022-03-09T20:46:14.630382Z nonode@nohost <0.90.0> -------- config: [admins] myadminuser set to -pbkdf2-8c49c894811f891406675edf2e13f41a295fd88e,ab4879f6853cd97bb8af8917c7e37a6b,10 for reason nil
[notice] 2022-03-09T20:46:14.647272Z nonode@nohost <0.90.0> -------- config: [couchdb] uuid set to d1d2f9185ac8333d9f2c29ff05a32e19 for reason nil
[info] 2022-03-09T20:46:14.674186Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _users
[info] 2022-03-09T20:46:14.707214Z nonode@nohost <0.206.0> -------- Apache CouchDB has started. Time to relax.

[info] 2022-03-09T20:46:14.707273Z nonode@nohost <0.206.0> -------- Apache CouchDB has started on http://any:5986/
[info] 2022-03-09T20:46:14.707418Z nonode@nohost <0.9.0> -------- Application couch started on node nonode@nohost
[info] 2022-03-09T20:46:14.707506Z nonode@nohost <0.9.0> -------- Application ets_lru started on node nonode@nohost
[notice] 2022-03-09T20:46:14.723705Z nonode@nohost <0.278.0> -------- rexi_server : started servers
[notice] 2022-03-09T20:46:14.725302Z nonode@nohost <0.283.0> -------- rexi_buffer : started servers
[info] 2022-03-09T20:46:14.725455Z nonode@nohost <0.9.0> -------- Application rexi started on node nonode@nohost
[info] 2022-03-09T20:46:14.731081Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _nodes
[warning] 2022-03-09T20:46:14.731117Z nonode@nohost <0.291.0> -------- creating missing database: _nodes
[info] 2022-03-09T20:46:14.745183Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _dbs
[warning] 2022-03-09T20:46:14.745183Z nonode@nohost <0.306.0> -------- creating missing database: _dbs
[warning] 2022-03-09T20:46:14.745219Z nonode@nohost <0.305.0> -------- creating missing database: _dbs
[info] 2022-03-09T20:46:14.749274Z nonode@nohost <0.9.0> -------- Application mem3 started on node nonode@nohost
[info] 2022-03-09T20:46:14.749403Z nonode@nohost <0.9.0> -------- Application fabric started on node nonode@nohost
[info] 2022-03-09T20:46:14.760286Z nonode@nohost <0.9.0> -------- Application chttpd started on node nonode@nohost
[notice] 2022-03-09T20:46:14.765591Z nonode@nohost <0.344.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:395) <= mem3_shards:load_shards_from_disk/1(line:370) <= mem3_shards:load_shards_from_disk/2(line:399) <= mem3_shards:for_docid/3(line:86) <= fabric_doc_open:go/3(line:39) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:195) <= chttpd_auth_cache:listen_for_changes/1(line:142)
[error] 2022-03-09T20:46:14.765635Z nonode@nohost emulator -------- Error in process <0.345.0> with exit value:
{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,395}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,370}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,399}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,86}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,39}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,195}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,142}]}]}

[info] 2022-03-09T20:46:14.767295Z nonode@nohost <0.9.0> -------- Application couch_index started on node nonode@nohost
[info] 2022-03-09T20:46:14.767314Z nonode@nohost <0.9.0> -------- Application couch_mrview started on node nonode@nohost
[info] 2022-03-09T20:46:14.767371Z nonode@nohost <0.9.0> -------- Application couch_plugins started on node nonode@nohost
[notice] 2022-03-09T20:46:14.781045Z nonode@nohost <0.90.0> -------- config: [features] scheduler set to true for reason nil
[info] 2022-03-09T20:46:14.789839Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _replicator
[notice] 2022-03-09T20:46:14.791911Z nonode@nohost <0.362.0> -------- creating replicator ddoc <<"_replicator">>
[info] 2022-03-09T20:46:14.796282Z nonode@nohost <0.9.0> -------- Application couch_replicator started on node nonode@nohost
[info] 2022-03-09T20:46:14.800521Z nonode@nohost <0.9.0> -------- Application couch_peruser started on node nonode@nohost
[info] 2022-03-09T20:46:14.805391Z nonode@nohost <0.9.0> -------- Application ddoc_cache started on node nonode@nohost
[info] 2022-03-09T20:46:14.813448Z nonode@nohost <0.9.0> -------- Application global_changes started on node nonode@nohost
[info] 2022-03-09T20:46:14.813468Z nonode@nohost <0.9.0> -------- Application jiffy started on node nonode@nohost
[info] 2022-03-09T20:46:14.816543Z nonode@nohost <0.9.0> -------- Application mango started on node nonode@nohost
[info] 2022-03-09T20:46:14.820241Z nonode@nohost <0.9.0> -------- Application setup started on node nonode@nohost
[info] 2022-03-09T20:46:14.820270Z nonode@nohost <0.9.0> -------- Application snappy started on node nonode@nohost

Does the medic-couchdb continue running, or does it crash? (What is the status of the container if you run docker ps -a?) Also can you post the exact docker run... command you use to start the couch container? I have no problems accessing http://127.0.0.1:5984/_utils#setup as soon as the container is spun up.

Just wanted to followup here and note that after more discussion we were able to determine that some of the issues (particularly with just the initial deployment via grunt were probably caused by using the wrong version of Node (10.x). Currently NodeJS 12.x should be used for developing cht-core, but this was not documented properly in the development guide (an issue I have corrected here).

There are still some weird issues surrounding the CouchDB container and volume mapping, but these may be related to some permissions issues on the VM itself. @joedoublev98 feel free to reply out here if you continue to see issue with Couch!

Thanks again for your great help Josh!

Sadly, we still cannot produce a stable running environment for the docker container.

We ran the container with the following command, as you suggested without a folder mapping:

sudo docker run -d -p 5984:5984 -p 5986:5986 --name medic-couchdb -e COUCHDB_USER=myadminuser -e COUCHDB_PASSWORD=myadminpass -v /opt/couchdb/data:/opt/couchdb/data -v /opt/couchdb/etc:/opt/couchdb/etc/local.d apache/couchdb:2

The rights of these folders seem them to be the following:

drwxr-xr-x 4 root root 4096 Mar 13 07:21 .
drwxr-xr-x 5 root root 4096 Mar  9 04:34 ..
drwxr-xr-x 7 5984 5984 4096 Mar 13 08:26 data
drwxr-xr-x 2 5984 5984 4096 Mar 13 07:21 etc

It seems that user 5984 (is this one created by the docker container?) does not possess the right amount of rights. However, as “5984” is a “Bad Name” for a user, I cannot create it nor give it any more rights.

Any thoughts or ideas on this?

@joedoublev98 can you post exactly what the bad behavior it is that you are seeing from the CouchDB container now? (What is it doing that you do not expect or not doing that you expect it to do?)

I was able to run the docker run command you posted above locally without issue. It started the container, and I was able to go to http://localhost:5984/_utils/#/setup. The folder permissions for my mapped-out volumes also look exactly like what you have posted (so it seems like maybe the volume permissions is not the issue…).

I would also note that as the container starts, I see the Could not get design docs... errors that we were noticing on your deployment, but they do not seem to affect my container’s ability to run normally. (At least I can start/stop the container. And if I remove the container and run a new one with the same volumes mapped in, it seems to correctly pick up the data being mapped in…)

@jkuester it is still the same as last time, once we made it but as the VM was suspended (or powered down doesn’t matter) it didn’t work anymore again.

This is the whole log of a newly generated container:

[info] 2022-03-14T15:51:21.504690Z nonode@nohost <0.9.0> -------- Application couch_log started on node nonode@nohost
[info] 2022-03-14T15:51:21.510132Z nonode@nohost <0.9.0> -------- Application folsom started on node nonode@nohost
[info] 2022-03-14T15:51:21.557854Z nonode@nohost <0.9.0> -------- Application couch_stats started on node nonode@nohost
[info] 2022-03-14T15:51:21.557987Z nonode@nohost <0.9.0> -------- Application khash started on node nonode@nohost
[info] 2022-03-14T15:51:21.565429Z nonode@nohost <0.9.0> -------- Application couch_event started on node nonode@nohost
[info] 2022-03-14T15:51:21.565558Z nonode@nohost <0.9.0> -------- Application hyper started on node nonode@nohost
[info] 2022-03-14T15:51:21.571873Z nonode@nohost <0.9.0> -------- Application ibrowse started on node nonode@nohost
[info] 2022-03-14T15:51:21.577600Z nonode@nohost <0.9.0> -------- Application ioq started on node nonode@nohost
[info] 2022-03-14T15:51:21.577738Z nonode@nohost <0.9.0> -------- Application mochiweb started on node nonode@nohost
[info] 2022-03-14T15:51:21.585451Z nonode@nohost <0.206.0> -------- Apache CouchDB 2.3.1 is starting.

[info] 2022-03-14T15:51:21.585517Z nonode@nohost <0.207.0> -------- Starting couch_sup
[notice] 2022-03-14T15:51:21.593552Z nonode@nohost <0.90.0> -------- config: [features] pluggable-storage-engines set to true for reason nil
[notice] 2022-03-14T15:51:21.601457Z nonode@nohost <0.90.0> -------- config: [admins] myadminuser set to -pbkdf2-374d69245454887e7f768d7b360473511b97c47e,dfc62b34432caa2b05106167ad8e06a3,10 for reason nil
[notice] 2022-03-14T15:51:21.627666Z nonode@nohost <0.90.0> -------- config: [couchdb] uuid set to 0400097e4a9777b4bcc7554795e2914c for reason nil
[info] 2022-03-14T15:51:21.670023Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _users
[info] 2022-03-14T15:51:21.722058Z nonode@nohost <0.206.0> -------- Apache CouchDB has started. Time to relax.

[info] 2022-03-14T15:51:21.722182Z nonode@nohost <0.206.0> -------- Apache CouchDB has started on http://any:5986/
[info] 2022-03-14T15:51:21.722353Z nonode@nohost <0.9.0> -------- Application couch started on node nonode@nohost
[info] 2022-03-14T15:51:21.722433Z nonode@nohost <0.9.0> -------- Application ets_lru started on node nonode@nohost
[notice] 2022-03-14T15:51:21.751211Z nonode@nohost <0.278.0> -------- rexi_server : started servers
[notice] 2022-03-14T15:51:21.754049Z nonode@nohost <0.283.0> -------- rexi_buffer : started servers
[info] 2022-03-14T15:51:21.754183Z nonode@nohost <0.9.0> -------- Application rexi started on node nonode@nohost
[info] 2022-03-14T15:51:21.766747Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _nodes
[warning] 2022-03-14T15:51:21.766791Z nonode@nohost <0.291.0> -------- creating missing database: _nodes
[info] 2022-03-14T15:51:21.793786Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _dbs
[warning] 2022-03-14T15:51:21.793797Z nonode@nohost <0.306.0> -------- creating missing database: _dbs
[warning] 2022-03-14T15:51:21.793813Z nonode@nohost <0.305.0> -------- creating missing database: _dbs
[info] 2022-03-14T15:51:21.800740Z nonode@nohost <0.9.0> -------- Application mem3 started on node nonode@nohost
[info] 2022-03-14T15:51:21.800876Z nonode@nohost <0.9.0> -------- Application fabric started on node nonode@nohost
[info] 2022-03-14T15:51:21.818369Z nonode@nohost <0.9.0> -------- Application chttpd started on node nonode@nohost
[notice] 2022-03-14T15:51:21.827568Z nonode@nohost <0.344.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:395) <= mem3_shards:load_shards_from_disk/1(line:370) <= mem3_shards:load_shards_from_disk/2(line:399) <= mem3_shards:for_docid/3(line:86) <= fabric_doc_open:go/3(line:39) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:195) <= chttpd_auth_cache:listen_for_changes/1(line:142)
[error] 2022-03-14T15:51:21.827622Z nonode@nohost emulator -------- Error in process <0.345.0> with exit value:
{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,395}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,370}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,399}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,86}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,39}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,195}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,142}]}]}

[info] 2022-03-14T15:51:21.831478Z nonode@nohost <0.9.0> -------- Application couch_index started on node nonode@nohost
[info] 2022-03-14T15:51:21.831515Z nonode@nohost <0.9.0> -------- Application couch_mrview started on node nonode@nohost
[info] 2022-03-14T15:51:21.831609Z nonode@nohost <0.9.0> -------- Application couch_plugins started on node nonode@nohost
[notice] 2022-03-14T15:51:21.855738Z nonode@nohost <0.90.0> -------- config: [features] scheduler set to true for reason nil
[info] 2022-03-14T15:51:21.883188Z nonode@nohost <0.212.0> -------- open_result error {not_found,no_db_file} for _replicator
[notice] 2022-03-14T15:51:21.887325Z nonode@nohost <0.362.0> -------- creating replicator ddoc <<"_replicator">>
[info] 2022-03-14T15:51:21.895791Z nonode@nohost <0.9.0> -------- Application couch_replicator started on node nonode@nohost
[info] 2022-03-14T15:51:21.903159Z nonode@nohost <0.9.0> -------- Application couch_peruser started on node nonode@nohost
[info] 2022-03-14T15:51:21.912224Z nonode@nohost <0.9.0> -------- Application ddoc_cache started on node nonode@nohost
[info] 2022-03-14T15:51:21.931185Z nonode@nohost <0.9.0> -------- Application global_changes started on node nonode@nohost
[info] 2022-03-14T15:51:21.931199Z nonode@nohost <0.9.0> -------- Application jiffy started on node nonode@nohost
[info] 2022-03-14T15:51:21.938189Z nonode@nohost <0.9.0> -------- Application mango started on node nonode@nohost
[info] 2022-03-14T15:51:21.945206Z nonode@nohost <0.9.0> -------- Application setup started on node nonode@nohost
[info] 2022-03-14T15:51:21.945236Z nonode@nohost <0.9.0> -------- Application snappy started on node nonode@nohost
[notice] 2022-03-14T15:51:26.830231Z nonode@nohost <0.344.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:395) <= mem3_shards:load_shards_from_disk/1(line:370) <= mem3_shards:load_shards_from_disk/2(line:399) <= mem3_shards:for_docid/3(line:86) <= fabric_doc_open:go/3(line:39) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:195) <= chttpd_auth_cache:listen_for_changes/1(line:142)
[error] 2022-03-14T15:51:26.830445Z nonode@nohost emulator -------- Error in process <0.484.0> with exit value:
{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,395}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,370}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,399}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,86}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,39}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,195}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,142}]}]}

[notice] 2022-03-14T15:51:26.843715Z nonode@nohost <0.366.0> -------- couch_replicator_clustering : cluster stable
[notice] 2022-03-14T15:51:26.851137Z nonode@nohost <0.383.0> -------- Started replicator db changes listener <0.485.0>
[notice] 2022-03-14T15:51:31.832999Z nonode@nohost <0.344.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:395) <= mem3_shards:load_shards_from_disk/1(line:370) <= mem3_shards:load_shards_from_disk/2(line:399) <= mem3_shards:for_docid/3(line:86) <= fabric_doc_open:go/3(line:39) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:195) <= chttpd_auth_cache:listen_for_changes/1(line:142)
[error] 2022-03-14T15:51:31.833202Z nonode@nohost emulator -------- Error in process <0.584.0> with exit value:
{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,395}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,370}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,399}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,86}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,39}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,195}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,142}]}]}

Still not reachable via http://localhost:5984/_utils/#/setup

Noticeable here: Not the design error (had that the time before) but the database does not exist. However, same result on both errors as it is just not reachable.

I see this error several times in my Couch logs as well, but the instance is running fine. But, who knows, maybe somehow mine is able to work it out while yours cannot.

It would be worth trying to run curl -X PUT http://myadminuser:myadminpass@localhost:5984/_users and see if that helps anything (but I have no idea why _users would be auto-created for me, and not for you).

@diana do you have any other thoughts here on what might be causes issues with just running the CouchDB container (based on the docs in the DEVELOPMENT.md)?

1 Like

That did somehow work. However, I don’t know whether next time I stop the db it will still work. Will get back to you!

1 Like

Next error directly around the corner :joy: I want to add the custom config from our University team and get a 404 error in the upload-settings part:

madmin@ubuntu:~/Dokumente/cht-core-combacal/config/combacal$ cht --url=http://myadminuser:myadminpass@localhost:5984 --accept-self-signed-certs compile-app-settings upload-app-settings
INFO Checking that http://myadminuser:****@localhost:5984/medic/ is available... 
INFO Processing config in combacal. 
INFO Actions:
     - compile-app-settings
     - upload-app-settings 
INFO Starting action: compile-app-settings… 
WARN app_settings.json file should not be edited directly.
    Please create a base_settings.json file in app_settings folder and move any manually defined configurations there. 
INFO Packaging contact-summary 
INFO Hash: 8a5c18db89cebcc415a5
Version: webpack 4.46.0
Child
    Hash: 8a5c18db89cebcc415a5
    Time: 3096ms
    Built at: 2022-03-16 6:21:58
                   Asset      Size  Chunks             Chunk Names
    ./contact-summary.js  68.6 KiB       0  [emitted]  main
    Entrypoint main = ./contact-summary.js
    [0] /usr/local/lib/node_modules/cht-conf/src/contact-summary/lib.js 203 bytes {0} [built]
    [1] ./contact-summary.templated.js 5.23 KiB {0} [built]
    [2] ./contact-summary-extras.js 16 KiB {0} [built]
    [3] /home/vmadmin/Dokumente/cht-core-combacal/node_modules/moment/moment.js 170 KiB {0} [built]
    [4] (webpack)/buildin/module.js 497 bytes {0} [built]
    [5] /usr/local/lib/node_modules/cht-conf/src/contact-summary/contact-summary-emitter.js 3.41 KiB {0} [built] 
INFO Packaging nools 
INFO Hash: 3f64422a62ac60a09bb9
Version: webpack 4.46.0
Child
    Hash: 3f64422a62ac60a09bb9
    Time: 1024ms
    Built at: 2022-03-16 6:21:59
         Asset    Size  Chunks             Chunk Names
    ./nools.js  28 KiB       0  [emitted]  main
    Entrypoint main = ./nools.js
    [0] ./nools-extras.js 11.5 KiB {0} [built]
    [1] /usr/local/lib/node_modules/cht-conf/src/nools/definition-preparation.js 1.36 KiB {0} [built]
    [2] /usr/local/lib/node_modules/cht-conf/src/nools/lib.js 328 bytes {0} [built]
    [3] ./tasks.js 18.9 KiB {0} [built]
    [4] ./tasks/task-logic.js 16.7 KiB {0} [built]
    [5] ./targets.js 4.69 KiB {0} [built]
    [6] /usr/local/lib/node_modules/cht-conf/src/nools/task-emitter.js 5.24 KiB {0} [built]
    [7] /usr/local/lib/node_modules/cht-conf/src/nools/task-defaults.js 1.32 KiB {0} [built]
    [8] /usr/local/lib/node_modules/cht-conf/src/nools/target-emitter.js 2.77 KiB {0} [built] 
INFO compile-app-settings complete. 
INFO Starting action: upload-app-settings… 
INFO StatusCodeError: 404 - "{\"error\":\"not_found\",\"reason\":\"missing\"}\n"
    at new StatusCodeError (/usr/local/lib/node_modules/cht-conf/node_modules/request-promise-core/lib/errors.js:32:15)
    at Request.plumbing.callback (/usr/local/lib/node_modules/cht-conf/node_modules/request-promise-core/lib/plumbing.js:104:33)
    at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/cht-conf/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at Request.self.callback (/usr/local/lib/node_modules/cht-conf/node_modules/request/request.js:185:22)
    at Request.emit (events.js:314:20)
    at Request.<anonymous> (/usr/local/lib/node_modules/cht-conf/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:314:20)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/cht-conf/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:420:28)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) 
ERROR 404 - "{\"error\":\"not_found\",\"reason\":\"missing\"}\n"

What exactly is not found?

Try connecting to port 5988 instead of 5984 in your url string. cht-conf needs to be able to talk to the API server for cht-core (which I believe is listening on 5988 by default when running locally via grunt). 5984 is probably the port that your CouchDB instance is listening on.

2 Likes

Everything is working now, the core is running.
Unfortunately uploading our own config does not work as expected when running the dev setup.
This is the output after doing: cht --url=https://myadminuser:myadminpass@localhost:5986 --accept-self-signed-certs

Is the port from Couchdb or CHT needed? When using the one from CHT an error is thrown.
When doing the above command the result is the one in the picture with the task running forever and no config changes applied in the application even after several rebuilds etc. Do you have any idea? The config works when using CHT as docker.

Thanks and have a great day!

@Sirofjelly - welcome to the forums! Glad to see you posted a questions so we can all help you get an answer!

I suspect you put in https:// when you needed to put in http://, so cht-conf is trying to speak TLS to your non-TLS development server. Can you let us know if removing the extra s in your URL works?

cht --url=http://myadminuser:myadminpass@localhost:5986 --accept-self-signed-certs

@mrjones thanks for your quick answer. I guess it would work, however after stopping the couchdb container and starting it again it seems stuck and unavailable. Did you have this problem before?