Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect: connection refused #21

Closed
Itsmesri opened this issue Oct 14, 2019 · 5 comments
Closed

connect: connection refused #21

Itsmesri opened this issue Oct 14, 2019 · 5 comments
Labels
question Further information is requested

Comments

@Itsmesri
Copy link

Sorry, first time I am running docker on windows to install and setup listmonk I am getting below error. Where to change the IP address which I can point to local?

I hope it is trying to connect local DB

docker-compose run --rm app ./listmonk --install to setup the DB.

PS C:\listmonk> docker-compose run --rm app ./listmonk --install
Starting listmonk_db_1 ... done
2019/10/14 04:26:31 main.go:107: reading config: config.toml
2019/10/14 04:26:34 main.go:189: error connecting to DB: dial tcp 23.217.138.110:5432: connect: connection refused
PS C:\listmonk>

@mukoshy
Copy link

mukoshy commented Oct 14, 2019

@Itsmesri instead of using your IP address in the config.toml file, consider using localhost assuming your local server runs on the localhost address.

You may also need to check your PostgreSQL configuration file pg_hba.conf for allowing connection to the Database. I hope this helps.

@knadh
Copy link
Owner

knadh commented Oct 14, 2019

@mr-karan maybe you can shed some light on the Docker setup.

@Itsmesri
Copy link
Author

even I am not able to connect demo-db from PGAdmin

image

@theo-stocchetti
Copy link

Can you try 9432 ? I think is the port forwarding in docker compose file

x-db-defaults: &db-defaults
    image: postgres:11
    ports:
      - "9432:5432"

@mr-karan
Copy link
Collaborator

mr-karan commented Oct 15, 2019

@Itsmesri demo-db container exposes the port on 9432 on the host machine (this is to avoid conflict in case someone is already running a postgres process on 5432).

Like @mukoshy mentioned, don't hardcode the container IP in the config. Docker containers are ephemeral so the IPs will get reused/deleted as and when the container state changes. For that purpose, Docker compose provides a simple abstraction to just use the service name (and it will do the dns lookup for you).

TL;DR use db (or whatever is your service name in your docker-compose) in your config.toml as illustrated here.

Also, the docker-compose.yml is just an example configuration file with sane defaults, you're free (and encouraged) to modify and use it with your config settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants