orangecoding / fredy

:heart: Fredy - [F]ind [R]eal [E]states [D]amn Eas[y] - Fredy will constantly search for new listings on sites like Immoscout or Immowelt and send new results to you, so that you can focus on more important things in life ;)
http://www.orange-coding.net
MIT License
209 stars 54 forks source link

[Solved] Access Denied when running with Ubuntu - docker-compose #89

Closed eracle closed 5 months ago

eracle commented 5 months ago

First of all thanks for the amazing project.

Describe the bug I launched the project on Ubuntu and docker- compose, when when trying to login with default admin/admin login I got the following error:


$ docker-compose up
Starting fredy ... done
Attaching to fredy
fredy    | Started Fredy successfully. Ui can be accessed via http://localhost:9998
fredy    | Started API service on port 9998
fredy    | node:fs:590
fredy    |   handleErrorFromBinding(ctx);
fredy    |   ^
fredy    | 
fredy    | Error: EACCES: permission denied, open '/fredy/db/.users.json.tmp'
fredy    |     at Object.openSync (node:fs:590:3)
fredy    |     at Object.writeFileSync (node:fs:2202:35)
fredy    |     at TextFileSync.write (file:///fredy/node_modules/lowdb/lib/adapters/node/TextFile.js:63:12)
fredy    |     at JSONFileSync.write (file:///fredy/node_modules/lowdb/lib/adapters/node/JSONFile.js:48:66)
fredy    |     at LowdashAdapter.write (file:///fredy/node_modules/lowdb/lib/core/Low.js:60:26)
fredy    |     at Module.setLastLoginToNow (file:///fredy/lib/services/storage/userStorage.js:75:6)
fredy    |     at file:///fredy/lib/api/routes/loginRoute.js:28:17
fredy    |     at next (/fredy/node_modules/0http/lib/next.js:37:14)
fredy    |     at Trouter.router.lookup (/fredy/node_modules/0http/lib/router/sequential.js:93:14)
fredy    |     at Object.service.lookup (/fredy/node_modules/restana/libs/request-router.js:75:49)
fredy    |     at next (/fredy/node_modules/0http/lib/next.js:35:25)
fredy    |     at step (/fredy/node_modules/0http/lib/next.js:17:14)
fredy    |     at serveStatic (/fredy/node_modules/serve-static/index.js:75:16)
fredy    |     at next (/fredy/node_modules/0http/lib/next.js:37:14)
fredy    |     at step (/fredy/node_modules/0http/lib/next.js:17:14)
fredy    |     at _cookieSession (/fredy/node_modules/cookie-session/index.js:135:5) {
fredy    |   errno: -13,
fredy    |   syscall: 'open',
fredy    |   code: 'EACCES',
fredy    |   path: '/fredy/db/.users.json.tmp'
fredy    | }
fredy exited with code 1

I solved using:

sudo chmod 777 -R db/
orangecoding commented 5 months ago

see https://github.com/orangecoding/fredy/commit/172c039c794c2b5090b66726bf6d212bf65bbf45