TritonDataCenter / pkgsrc

NetBSD/pkgsrc fork for our binary package repositories
https://pkgsrc.smartos.org/
134 stars 50 forks source link

CouchDB 2.3.1 Package Install Fails #229

Open lsgroup opened 5 years ago

lsgroup commented 5 years ago

Environment: Base-64 19.2.0 Upgraded pkgsrc: bootstrap-trunk-x86_64-20190317-upgrade.tar.gz

$ svcadm enable couchdb results in error: cat: @PREFIX@/couchdb/releases/start_erl.data: No such file or directory /opt/local/bin/couchdb[31]: exec: @PREFIX@/couchdb/erts-/bin/erlexec: not found

Modify: /opt/local/bin/couchdb and hard coding in some @PREFIX...

export ROOTDIR="/opt/local/couchdb" ... and ... exec "$BINDIR/erlexec" -boot "$ROOTDIR/releases/$APP_VSN/couchdb" \ -args_file "/opt/local/couchdb/releases/2.3.1/vm.args" \ -config "${SYSCONFIG_FILE}" "$@"

When I run the service, I now get: {database_does_not_exist, [{mem3_shards,load_shards_from_db,"_users", [{file,"src/mem3_shards.erl"},{line,395}]},

I removed the /var/db/couchdb dir that was installed with the pkg and replaced it with a couchdb database directory from a running couchdb instance.

Now, couchdb does not run as a service, it gives error: Eshell V10.4.4 (abort with ^G) 1> *** Terminating erlang (nonode@nohost)

But, it will run on the shell: root:/var/db# /opt/local/bin/couchdb

I can go to: http://localhost:5984/_utils/index.html#/verifyinstall

when verifying "Creating Views", I get this error: /opt/local/couchdb/lib/couch-2.3.1-RC3/priv/couchspawnkillable[20]: exec: /opt/local/couchdb/bin/couchjs: not found

So I copy: $ mkdir /opt/local/couchdb/bin/ $ cp /opt/local/bin/couchjs /opt/local/couchdb/bin/

Now, I end up with error:

Error in process <0.3244.0> with exit value: {{badmatch,{error,{nodedown,<<"progress not possible">>}}}, [{ddoc_cache_entry_validation_funs,recover,1, [{file,"src/ddoc_cache_entry_validation_funs.erl"},{line,33}]}, {ddoc_cache_entry,do_open,1, [{file,"src/ddoc_cache_entry.erl"},{line,297}]}]}

I'm suspecting the database dir, so I purge it: $ rm -rf /var/db/couchdb $ mkdir /var/db/couchdb

http://localhost:5984/_utils/index.html#/setup

do a node setup and everything seems to work.

lsgroup commented 5 years ago

Does not run as a service. Only works via command running as root: root@sandbox4:/var/db/couchdb# /opt/local/bin/couchdb

Verified couchdb ownership on /var/db/couchdb and /var/log/couchdb root@sandbox4:/var/db# ll drwxr-xr-x 7 couchdb couchdb 12 Oct 28 14:40 couchdb/

root@sandbox4:/var# ll /var/log/couchdb/ drwxrwx--- 2 couchdb couchdb 3 Oct 27 16:44 ./ drwxr-xr-x 4 root sys 8 Oct 27 16:26 ../ -rw-r--r-- 1 couchdb couchdb 2126545 Oct 28 14:42 couch.log

When running as a service, you get this error message:

=ERROR REPORT==== 28-Oct-2019::14:40:58.109884 === Error in process <0.285.0> with exit value: {badarg,[{ets,member,[mem3_openers,<<"_global_changes">>],[]}, {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}]}]}

Eshell V10.4.4 (abort with ^G) 1> *** Terminating erlang (nonode@nohost)

jbarfield commented 4 years ago

I just provisioned a new 2019Q3-x86_64 image ran 'pkgsrc -fy up && pkgin -y in couchdb'. The install ran as expected. However I had the same problems after running: 'svcadm enable -r couchdb'. I disabled all of the services and rewrote /opt/local/bin/couchdb and then ran 'svcadm enable -r couchdb' and all is well. In the course of testing I screwed up the permissions in var/log/couchdb and in /var/db/couchdb a simple 'chown -R couchdb:couchdb /var/{log,db}/couchdb' should resolve the issue. Here is my /opt/local/bin/couchdb:

I deleted the BSD licensing portion of the script because it was causing gigantic fonts in the post.

!/bin/sh

export PREFIX=/opt/local export ROOTDIR=${PREFIX}/couchdb

START_ERL=$(cat ${ROOTDIR}/releases/start_erl.data)

ERTS_VSN=$(cat ${ROOTDIR}/releases/start_erl.data | awk '{print $1}') APP_VSN=$(cat ${ROOTDIR}/releases/start_erl.data | awk '{print $2}')

export BINDIR="${ROOTDIR}/erts-${ERTS_VSN}/bin" export EMU=beam export PROGNAME=echo $0 | sed 's/.*\///'

export COUCHDB_QUERY_SERVER_JAVASCRIPT="${ROOTDIR}/bin/couchjs ${ROOTDIR}/share/server/main.js" export COUCHDB_QUERY_SERVER_COFFEESCRIPT="${ROOTDIR}/bin/couchjs ${ROOTDIR}/share/server/main-coffee.js"

ARGS_FILE=${ROOTDIR}/etc/vm.args SYSCONFIG_FILE=${ROOTDIR}/releases/$APP_VSN/sys.config

exec "${BINDIR}/erlexec" -boot "${ROOTDIR}/releases/$APP_VSN/couchdb" \ -args_file "$PREFIX/etc/couchdb/vm.args" \ -config "${SYSCONFIG_FILE}" "$@"