Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
21.78k stars 1.49k forks source link

Cannot Docker compose to bind mount #14283

Closed e-e-eric closed 1 week ago

e-e-eric commented 1 month ago

Checklist

Hosting

Describe the bug Brand new docker image does not install (standard yaml, only API variable and volume mount).

To Reproduce Docker compose with volume mount for /data

Expected behavior Install correctly.

Screenshots drwxrwx--- 4 5984 5984 4 Jul 31 13:05 couch drwxrwx--- 3 root root 3 Jul 31 13:05 minio drwxrwx--- 2 root root 2 Jul 31 13:05 search

/couch drwxrwx--- 2 5984 5984 2 Jul 31 13:05 dbs drwxrwx--- 2 5984 5984 2 Jul 31 13:05 views

2024-07-31T13:06:00.722888119+10:00 [info] 2024-07-31T03:06:00.722509Z couchdb@127.0.0.1 <0.254.0> -------- Apache CouchDB has started. Time to relax.
2024-07-31T13:06:00.722953999+10:00 
2024-07-31T13:06:00.733428411+10:00 [notice] 2024-07-31T03:06:00.733063Z couchdb@127.0.0.1 <0.617.0> -------- rexi_server : started servers
2024-07-31T13:06:00.735467986+10:00 [notice] 2024-07-31T03:06:00.735164Z couchdb@127.0.0.1 <0.621.0> -------- rexi_buffer : started servers
2024-07-31T13:06:00.784472738+10:00 [error] 2024-07-31T03:06:00.782854Z couchdb@127.0.0.1 <0.631.0> -------- Could not open file /data/couch/dbs/_nodes.couch: permission denied
2024-07-31T13:06:00.785310575+10:00 [info] 2024-07-31T03:06:00.784469Z couchdb@127.0.0.1 <0.630.0> -------- open_result error {error,eacces} for _nodes
2024-07-31T13:06:00.786212362+10:00 [error] 2024-07-31T03:06:00.785464Z couchdb@127.0.0.1 <0.627.0> -------- Supervisor mem3_sup had child mem3_nodes started with mem3_nodes:start_link() at undefined exit with reason no case clause matching {error,eacces} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226) in context start_error
2024-07-31T13:06:00.787155508+10:00 [error] 2024-07-31T03:06:00.785972Z couchdb@127.0.0.1 <0.627.0> -------- Supervisor mem3_sup had child mem3_nodes started with mem3_nodes:start_link() at undefined exit with reason no case clause matching {error,eacces} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226) in context start_error
2024-07-31T13:06:00.787781674+10:00 [error] 2024-07-31T03:06:00.786501Z couchdb@127.0.0.1 <0.629.0> -------- CRASH REPORT Process  (<0.629.0>) with 0 neighbors crashed with reason: no case clause matching {error,eacces} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {mem3_nodes,init,['Argument__1']}, ancestors: [mem3_sup,<0.626.0>], message_queue_len: 0, links: [<0.627.0>], dictionary: [{io_priority,{system,<<"_nodes">>}}], trap_exit: false, status: running, heap_size: 610, stack_size: 29, reductions: 24335
2024-07-31T13:06:00.788145651+10:00 [error] 2024-07-31T03:06:00.786709Z couchdb@127.0.0.1 <0.629.0> -------- CRASH REPORT Process  (<0.629.0>) with 0 neighbors crashed with reason: no case clause matching {error,eacces} at mem3_util:ensure_exists/1(line:344) <= mem3_nodes:initialize_nodelist/0(line:110) <= mem3_nodes:init/1(line:55) <= gen_server:init_it/2(line:423) <= gen_server:init_it/6(line:390) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {mem3_nodes,init,['Argument__1']}, ancestors: [mem3_sup,<0.626.0>], message_queue_len: 0, links: [<0.627.0>], dictionary: [{io_priority,{system,<<"_nodes">>}}], trap_exit: false, status: running, heap_size: 610, stack_size: 29, reductions: 24335
2024-07-31T13:06:00.788810903+10:00 [error] 2024-07-31T03:06:00.787157Z couchdb@127.0.0.1 <0.625.0> -------- CRASH REPORT Process  (<0.625.0>) with 0 neighbors exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{error,eacces}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,[]]}} at application_master:init/4(line:142) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {application_master,init,['Argument__1','Argument__2',...]}, ancestors: [<0.624.0>], message_queue_len: 1, links: [<0.624.0>,<0.16.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 29, reductions: 205
2024-07-31T13:06:00.789539415+10:00 [error] 2024-07-31T03:06:00.787574Z couchdb@127.0.0.1 <0.625.0> -------- CRASH REPORT Process  (<0.625.0>) with 0 neighbors exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{error,eacces}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,[]]}} at application_master:init/4(line:142) <= proc_lib:init_p_do_apply/3(line:226); initial_call: {application_master,init,['Argument__1','Argument__2',...]}, ancestors: [<0.624.0>], message_queue_len: 1, links: [<0.624.0>,<0.16.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 29, reductions: 205
2024-07-31T13:06:00.789762523+10:00 [info] 2024-07-31T03:06:00.787889Z couchdb@127.0.0.1 <0.16.0> -------- Application mem3 exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{error,eacces}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,[]]}}
2024-07-31T13:06:00.790028278+10:00 [info] 2024-07-31T03:06:00.788086Z couchdb@127.0.0.1 <0.16.0> -------- Application mem3 exited with reason: {{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{error,eacces}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,[]]}}
2024-07-31T13:06:02.314676962+10:00 {"Kernel pid terminated",application_controller,"{application_start_failure,mem3,{{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{error,eacces}},[{mem3_util,ensure_exists,1,[{file,\"src/mem3_util.erl\"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,\"src/mem3_nodes.erl\"},{line,110}]},{mem3_nodes,init,1,[{file,\"src/mem3_nodes.erl\"},{line,55}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,423}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,226}]}]}}},{mem3_app,start,[normal,[]]}}}"}
2024-07-31T13:06:02.315935813+10:00 Kernel pid terminated (application_controller) ({application_start_failure,mem3,{{shutdown,{failed_to_start_child,mem3_nodes,{{case_clause,{error,eacces}},[{mem3_util,ensure_exists,1,[{file,"src/mem3_util.erl"},{line,344}]},{mem3_nodes,initialize_nodelist,0,[{file,"src/mem3_nodes.erl"},{line,110}]},{mem3_nodes,init,1,[{file,"src/mem3_nodes.erl"},{line,55}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,423}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,390}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}},{mem3_app,start,[normal,[]]}}})
2024-07-31T13:06:17.499753161+10:00 {"level":"INFO","timestamp":"2024-07-31T03:06:17.354Z","service":"@budibase/server","pid":489,"tenantId":"default","msg":"Checking migrations"}
2024-07-31T13:06:17.499796629+10:00 {"level":"ERROR","timestamp":"2024-07-31T03:06:17.375Z","service":"@budibase/server","err":{"type":"CouchDBError","message":"CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984","stack":"Error: CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984\n    at _DatabaseImpl.performCall (/app/dist/index.js:95426:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async getMigrationsDoc (/app/dist/index.js:113630:16)\n    at async runMigration (/app/dist/index.js:113680:24)\n    at async /app/dist/index.js:113744:25\n    at async Object.runMigrations (/app/dist/index.js:113742:11)\n    at async /app/dist/index.js:234044:11\n    at async Object.doWithLock (/app/dist/index.js:106763:20)\n    at async migrateWithLock (/app/dist/index.js:234035:7)\n    at async migrate4 (/app/dist/index.js:234029:9)\n    at async startup (/app/dist/index.js:237167:7)\n    at async start2 (/app/dist/index.js:237277:3)","status":500,"statusCode":500,"reason":"Unknown","name":"Error","errid":"Unknown","description":"Unknown","error":"Not found"},"pid":489,"tenantId":"default","msg":"[Migration: user_email_view_casing] [DB: global-db] Error: "}
2024-07-31T13:06:17.499860231+10:00 {"level":"ERROR","timestamp":"2024-07-31T03:06:17.378Z","service":"@budibase/server","err":{"type":"CouchDBError","message":"CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984","stack":"Error: CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984\n    at _DatabaseImpl.performCall (/app/dist/index.js:95426:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async getMigrationsDoc (/app/dist/index.js:113630:16)\n    at async runMigration (/app/dist/index.js:113680:24)\n    at async /app/dist/index.js:113744:25\n    at async Object.runMigrations (/app/dist/index.js:113742:11)\n    at async /app/dist/index.js:234044:11\n    at async Object.doWithLock (/app/dist/index.js:106763:20)\n    at async migrateWithLock (/app/dist/index.js:234035:7)\n    at async migrate4 (/app/dist/index.js:234029:9)\n    at async startup (/app/dist/index.js:237167:7)\n    at async start2 (/app/dist/index.js:237277:3)","status":500,"statusCode":500,"reason":"Unknown","name":"Error","errid":"Unknown","description":"Unknown","error":"Not found"},"pid":489,"tenantId":"default","msg":"bb-alert: Error performing migrations. Exiting."}
2024-07-31T13:06:17.499914670+10:00 {"level":"INFO","timestamp":"2024-07-31T03:06:17.379Z","service":"@budibase/server","pid":489,"tenantId":"default","msg":"Checking for version updates"}
2024-07-31T13:06:17.499940352+10:00 {"level":"INFO","timestamp":"2024-07-31T03:06:17.380Z","service":"@budibase/server","pid":489,"tenantId":"default","msg":"Server Closed"}
2024-07-31T13:06:17.499964837+10:00 {"level":"ERROR","timestamp":"2024-07-31T03:06:17.386Z","service":"@budibase/server","err":{"type":"CouchDBError","message":"CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984","stack":"Error: CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984\n    at _DatabaseImpl.performCall (/app/dist/index.js:95426:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async /app/dist/index.js:110066:23\n    at async doWithDB (/app/dist/index.js:95666:10)\n    at async BaseCache.withCache (/app/dist/index.js:96110:32)\n    at async Object.checkInstallVersion (/app/dist/index.js:110100:23)\n    at async startup (/app/dist/index.js:237178:3)\n    at async start2 (/app/dist/index.js:237277:3)","status":500,"statusCode":500,"reason":"Unknown","name":"Error","errid":"Unknown","description":"Unknown","error":"Not found"},"pid":489,"tenantId":"default","msg":"Error fetching before cache - "}
2024-07-31T13:06:17.500010436+10:00 {"level":"ERROR","timestamp":"2024-07-31T03:06:17.386Z","service":"@budibase/server","pid":489,"tenantId":"default","msg":"Failed server startup - CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984"}
2024-07-31T13:06:17.500055983+10:00 {"level":"ERROR","timestamp":"2024-07-31T03:06:17.387Z","service":"@budibase/server","err":{"type":"CouchDBError","message":"CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984","stack":"Error: CouchDB error: error happened in your connection. Reason: connect ECONNREFUSED 127.0.0.1:5984\n    at _DatabaseImpl.performCall (/app/dist/index.js:95426:17)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async /app/dist/index.js:110066:23\n    at async doWithDB (/app/dist/index.js:95666:10)\n    at async BaseCache.withCache (/app/dist/index.js:96110:32)\n    at async Object.checkInstallVersion (/app/dist/index.js:110100:23)\n    at async startup (/app/dist/index.js:237178:3)\n    at async start2 (/app/dist/index.js:237277:3)","status":500,"statusCode":500,"reason":"Unknown","name":"Error","errid":"Unknown","description":"Unknown","error":"Not found"},"pid":489,"tenantId":"default","msg":"bb-alert: Uncaught exception."}
2024-07-31T13:06:18.499558154+10:00 
2024-07-31T13:06:18.499657256+10:00 ==> /root/.pm2/logs/app-error.log <==
2024-07-31T13:06:18.499688306+10:00 error Command failed with exit code 255.

Additional context CouchDB appears to lack permissions. I checked permissions and ownership, all appeared well. Using a basic yaml with only the API variable and volume mount.

In my case, I resolved by letting CouchDB install to a volume, then moved the installed /data to the volume mount. Therefore, it appears CouchDB no longer installs correctly to a direct volume mount.

linear[bot] commented 1 month ago

BUDI-8524 Cannot Docker compose to volume mount

shogunpurple commented 1 month ago

Hi @e-e-eric

Can you share your docker-compose.yaml please?

Also what Operating system are you using Budibase on?

e-e-eric commented 1 month ago

Hi @shogunpurple,

I am running on TrueNAS Scale (appliance) so it is using Debian 12 with Kubernetes under the hood.

The only environment variable I have defined is INTERNAL_API_KEY. Storage is Host Path attached volume (bind mount).

It is equivalent to the following: ` services: budibase: restart: unless-stopped image: budibase/budibase:latest ports:

As reported above, it installs fine onto a volume mount, and runs fine from a bind mount. It just doesn't install to the volume mount. My guess would be probably due to an unnecessary permissions check somewhere.

Cheers

shogunpurple commented 4 weeks ago

@e-e-eric so are you using kubernetes? How are you deploying the docker-compose setup on that?

I'll need more information about exactly:

As reported above, it installs fine onto a volume mount, and runs fine from a bind mount. It just doesn't install to the volume mount.

So does it install to the volume mount, or not? I'm sorry, but it would be helpful to be clear about exactly what is happening

e-e-eric commented 4 weeks ago

@shogunpurple Apologies, title was incorrectly labelled as volume mount (now fixed). My report is that the image doesn't install correctly to bind mount, and that a volume mount is required. Once installed to a volume mount, moving the data to a bind mount runs as intended. This suggests a permissions check somewhere in the install script is hard failing unnecessarily.

I'm just using the TrueNAS GUI to run the equivalent parameters.

Install steps on TrueNAS

  1. Apps > Discover Apps > Custom App
  2. Image repository: budibase/budibase Image Tag: latest

Container Environment Variables: variable: INTERNAL_API_KEY value:

Storage > Host Path Volumes: Host Path: /bindmount/data Mount Path: /data

Please feel free to close if you can't replicate on your test host.

shogunpurple commented 1 week ago

@e-e-eric I have not been able to repro this with a local docker setup. There's a chance that your TrueNAS configuration isn't setting the bindmount correctly or there's some environmental issue preventing it. Closing for now but I would try on a different env to see if you are still having the same issue.