planka icon indicating copy to clipboard operation
planka copied to clipboard

Development version with docker : error connection refused on database / getaddrinfo EAI_AGAIN

Open 0x0fe opened this issue 3 years ago • 8 comments

image

I installed docker desktop, and created a new dev environement, which pulled planka github fork. docker-compose -f docker-compose-dev.yml up runs fine, but npm run server:db:init fails because it cannot reach the database. I have tried changing the URL to the one provided by the let terminal, with the same result, connection refused.

0x0fe avatar Jan 18 '22 14:01 0x0fe

OK, i found the problem:

DATABASE_URL=postgresql://postgres@elated_elion:5432/planka

the base url has to use the docker container name instead of localhost

image

0x0fe avatar Jan 18 '22 15:01 0x0fe

well, actually there is another error now

getaddrinfo EAI_AGAIN

0x0fe avatar Jan 18 '22 15:01 0x0fe

So it looks like there is still problems with reaching the database

[server]` [nodemon] 2.0.12
[server] [nodemon] to restart at any time, enter `rs`
[server] [nodemon] watching path(s): *.*
[server] [nodemon] watching extensions: js,mjs,json
[server] [nodemon] starting `node app.js`
[server]  info: Initializing custom hook (`current-user`)
[server] error: Ignoring attempt to bind route (`/*`) to unknown view: `index`
[server]  info: 
[server]  info:                .-..-.
[server]  info: 
[server]  info:    Sails              <|    .-..-.
[server]  info:    v1.4.4              |\
[server]  info:                       /|.\
[server]  info:                      / || \
[server]  info:                    ,'  |'  \
[server]  info:                 .-'.-==|/_--'
[server]  info:                 `--'-------' 
[server]  info:    __---___--___---___--___---___--___
[server]  info:  ____---___--___---___--___---___--___-__
[server]  info: 
[server]  info: Server lifted in `/com.docker.devenvironments.code/server`
[server]  info: To shut down Sails, press <CTRL> + C at any time.
[server]  info: Read more at https://sailsjs.com/support.
[server] 
[server] debug: -------------------------------------------------------
[server] debug: :: Tue Jan 18 2022 16:27:14 GMT+0000 (Coordinated Universal Time)
[server] debug: Environment : development
[server] 
[server] debug: Port        : 1337
[server] debug: -------------------------------------------------------
[client] ℹ 「wds」: Project is running at http://172.17.0.2/
[client] ℹ 「wds」: webpack output is served from 
[client] ℹ 「wds」: Content not from webpack is served from /com.docker.devenvironments.code/client/public
[client] ℹ 「wds」: 404s will fallback to /
[client] Starting the development server...
[client] 
[client] Browserslist: caniuse-lite is outdated. Please run:
[client] npx browserslist@latest --update-db
[client] 
[client] Why you should do it regularly:
[client] https://github.com/browserslist/browserslist#browsers-data-updating
[client] Compiled successfully!
[client] 
[client] You can now view planka-client in the browser.
[client] 
[client]   Local:            http://localhost:3000
[client]   On Your Network:  http://172.17.0.2:3000
[client] 
[client] Note that the development build is not optimized.
[client] To create a production build, use npm run build.
[client] 
[server] Troubleshooting tips:
[server] 
[server]  -> Is your Postgresql configuration correct?  Maybe your `poolSize` configuration is set too high? e.g. If your Postgresql database only supports 20 concurrent connections, you should make sure you have your `poolSize` set as something < 20 (see http://stackoverflow.com/a/27387928/486547). The default `poolSize` is 10. To override default settings, specify the desired properties on the relevant Postgresql "connection" config object where the host/port/database/etc. are configured. If you're using Sails, this is generally located in `config/datastores.js`, or wherever your environment-specific database configuration is set.
[server] 
[server]  -> Maybe your `poolSize` configuration is set too high? e.g. If your Postgresql database only supports 20 concurrent connections, you should make sure you have your `poolSize` set as something < 20 (see http://stackoverflow.com/a/27387928/486547). The default `poolSize` is 10.
[server] 
[server]  -> Do you have multiple Sails instances sharing the same Postgresql database? Each Sails instance may use up to the configured `poolSize` # of connections. Assuming all of the Sails instances are just copies of one another (a reasonable best practice) we can calculate the actual # of Postgresql connections used (C) by multiplying the configured `poolSize` (P) by the number of Sails instances (N). If the actual number of connections (C) exceeds the total # of **AVAILABLE** connections to your Postgresql database (V), then you have problems.  If this applies to you, try reducing your `poolSize` configuration. A reasonable `poolSize` setting would be V/N.
[server] 
[server]  -> Are you using an SSL-enabled Postgresql host like Heroku? Make sure to set `ssl` to `true` (see http://stackoverflow.com/a/22177218/486547)
[server] 
[server] 
[server] error: Sending 500 ("Server Error") response: 
[server]  AdapterError: Unexpected error from database adapter: `select` failed ("badConnection").  A connection either could not be obtained or there was an error using the connection.
[server] Additional data:
[server] 
[server] {
[server]   error: Error: getaddrinfo EAI_AGAIN silly_pare
[server]       at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
[server]     errno: -3001,
[server]     code: 'EAI_AGAIN',
[server]     syscall: 'getaddrinfo',
[server]     hostname: 'silly_pare'
[server]   },
[server]   meta: {
[server]     adapter: 'sails-postgresql-redacted',
[server]     url: 'postgresql://postgres@silly_pare/planka',
[server]     identity: 'default'
[server]   }
[server] }
[server]     at fn (/com.docker.devenvironments.code/server/api/helpers/users/get-one.js:27:17)
[server]     at wrapper (/com.docker.devenvironments.code/server/node_modules/@sailshq/lodash/lib/index.js:3282:19)
[server]     at Deferred.parley.retry [as _handleExec] (/com.docker.devenvironments.code/server/node_modules/machine/lib/private/help-build-machine.js:1014:29)
[server]     at Deferred.exec (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:286:10)
[server]     at Deferred.tryCatcher (/com.docker.devenvironments.code/server/node_modules/bluebird/js/release/util.js:11:23)
[server]     at ret (eval at makeNodePromisifiedEval (/com.docker.devenvironments.code/server/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:14:23)
[server]     at Deferred.toPromise (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:572:19)
[server]     at Deferred.then (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:431:22)
[server]     at processTicksAndRejections (node:internal/process/task_queues:96:5)`

Steps to reproduce the issue:

-create a new dev environement in docker pulling planka from github -open the container in the dev environement window and clic the "open in vscode" button -in vscode open a terminal and run docker-compose -f docker-compose-dev.yml up -open another terminal and run npm run server:db:init -open a third terminal and run npm start -open http://localhost:3000/ or http://localhost:1337

The second terminal will show the error (also reported in the 3rd terminal).

0x0fe avatar Jan 18 '22 16:01 0x0fe

Has there been any update on this? I have been unable to get Planka started, and it seems to just be unable to connect to the database.

mattague avatar Oct 20 '23 04:10 mattague

An update on what? You are posting into an 2year old issue

daniel-hiller avatar Oct 20 '23 14:10 daniel-hiller

An open two year old issue, with someone else experiencing the same unresolved issue 9 months ago, and no activity or advice since then.

I am just asking, on this open issue, if the original user, or anyone else who might have run into this issue, figured out what was causing it and possibly figured out how to resolve it. I would like to selfhost this project, but the docker-compose file provided seems to hang up.

mattague avatar Oct 20 '23 20:10 mattague

Hi! Are you trying to install using docker-compose.yml or just to develop with docker-compose-dev.yml? If there is any problem with the installation, please let us know all your steps and what error you are getting, that way it'll be easier to figure out.

meltyshev avatar Oct 20 '23 20:10 meltyshev

@mattague honnestly i dont recall, its pretty old, in the end we could run this planka on the hosting.

0x0fe avatar Oct 20 '23 20:10 0x0fe