Can't connect to external DB inside a Docker container - timeouts - postgresql

All of a sudden I get connection timeouts to our external Postgres server and I am tearing my hairs out of my head to understand why:
hostname = db.ourcompany.com
port = 5432
I can connect via my DB management tool on my desktop, so the DB is working. None of my colleagues have the same issue.
I have upgraded Docker to the latest version.I have removed all containers and images and rebuilt them. I run a Mac M1 on OS 12.6.1. I have not had any recent updates. I can install dependencies within my container which go via Composer or NPM, so external connections go well.
What am I missing? It worked for months, nothing has changed. The docker-compose files are exactly the same as before.

Related

Connect PostgreSQL to rabbitMQ

I'm trying to get RabbitMQ to monitor a postgresql database to create a message queue when database rows are updated. The eventual plan is to feed this message queue into an AWS EKS (Elastic Kubernetes Service) cluster as a job.
I've read many many approaches to this but they are still confusing as a newcomer to RabbitMQ and many seemed to be written more than 5 years ago so I'm not sure if they'll still work with current versions of postgres and rabbitmq.
I've followed this guide about installing the area51/notify-rabbit docker container which can connect the two via a node app, but when I ran the docker container it immediately stopped and didn't seem to do anything.
There is also this guide, which uses a go app to connect the two, but I'd rather not use Go ouside of a docker container.
Additionally, there is also this method, to install the pg_amqp extension from a repository which hasn't been updated in years, which allows for a direct connection from PostgreSQL to RabbitMQ. However, when I followed this and attempted to install pg_amqp on my Postgres db (postgresql 12), I was unable to connect using psql to the database, getting the classic error:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
My current set-up, is I have a rabbitMQ server installed in a docker container in an AWS EC2 instance which I can access via the internet. I ran the following to install and run it:
docker pull rabbitmq:3-management
docker run --rm -p 15672:15672 -p 5672:5672 rabbitmq:3-management
The postgresql database is running on a separate EC2 instance and both instances have the required ports open for accessing data from each server.
I have also looked into using Amazon SQS as well for this, but it didn't seem to have any info on linking Postgresql up to it. I haven't really seen any guides or Stack Overflow questions on this since 2017/18 so I'm wondering if this is still the best way to create a message broker for a kubernetes system? Any help/pointers on this much appreciated.
In the end, I decided the best thing to do was create some simple Python scripts to do the LISTEN/NOTIFY steps and route traffic from PostgreSQL to RabbitMQ based off the following code https://gist.github.com/kissgyorgy/beccba1291de962702ea9c237a900c79
I set it up inside Docker containers and set them to run in my Kubernetes cluster so they are within the automatic restarts if they fail.

Anyone able to get prisma.io working on the new Apple Silicon M1 devices?

I read docker support was not ready yet, but docker recently published a preview of their new version that seems to be working. Next issue is that MySQL images are only available on x86_64 and not arm, but MariaDb has one. Unfortunately, I'm not versed enough in Docker to be able to get that working. Finally, I tried installing prisma with a postgres db but couldn't get that working either.
Has anyone had success getting prisma working on the new Apple MC M1 devices? If so, please advise how you got it working.
Edit: Here is the Error Message when I prisma init for a mysql db and run docker-compose up -d
"ERROR: no matching manifest for linux/arm64/v8 in the manifest list entries"
I've come to learn that this is because there isn't a mysql image for arm yet (but there is one for mariadb).
So when I changed the docker-compose file to load the mariadb image instead, docker-compose up -d runs successfully, but when I open http://localhost:4466 in my browser localhost refuses to connect.
The same "localhost refused to connect" result also occurs if I set up prisma for postgres or mongodb too.
Any help is appreciated

Connect a Mongodb Docker Container Running on Server to Robo 3t on my Computer

I'm trying to deploy my first web app and I decided that it would be a good training to be able to connect my empty Mongo DB (inside its own docker container) itself running in a Digital Ocean server to Robo3t on my computer.
I could find several guides explaining how to either do it for a DB running directly on the server or inside a container but not on a remote server.
To be honest I'm a bit lost right now because I'm still completely new to these things. So I don't even what's the strategy I need to use...
Your help will be greatly appreciated, many thanks in advance!
You have to bind ports when you build the image with -p 80:80 for example. Change 80 with your port. Next step is open port in the remote machine. So then you can connect Roboto 3T with your db.

Docker containers cannot bind to network

I usually use the default network for docker containers, and I had a mongo database running in one just fine and the port was exposed to the network successfully. Then, I tried to attach a new python container to that container using the --link option (yes, I now realize that that is deprecated). An error was thrown, and in my hubris, I didn't capture it, I just went on. Now, when I try to start my mongo database, it fails saying that it can't bind the network. "Failed to set up listener: SocketException: Permission denied"
I removed the container and tried to re-create it, but no luck. I've put this into a permanent state of bad. Any suggestions on how to fix this so I can get my database back?
Thanks.
Edit: Should have mentioned, Ubuntu 20.04, Docker 19.03.11
Also, this only seems to be a problem with any new mongo containers. I can start postgres, and web servers, etc without issues.
Turns out, whatever that error was when I tried to use --link, it had corrupted the mongo image on my machine, so all new instances of that image failed to connect to the network. That's why removing the container and recreating it didn't fix the problem. I needed to delete the local mongo image, and re-pull from the docker hub.

why are wekan calls to mongodb unable to connect?

I recently installed Manjaro and followed this tutorial: https://snapcraft.io/install/wekan/manjaro to install wekan. Everything went slicker than snot. I registered an account no issues, open the weken webgui at port 8080 without issue, create new lists and cards fine, but when I go to open the cards I create the connection to 127.0.0.1 is refused. Although it doesn't specify a port, I assume this is a call to the mongodb at the default port 27017, but I also opened up 28017 in the firewall.
Although mongo definitely seems to have been installed since I can see it is running, I can't find a mongod*.conf file on the system to verify the default ports.
This is the first time I used “snap” to install anything, and because it all went so seamlessly I have no clue where to start looking to find the issue. Is there a utility in snap where I can find out exactly what was installed to support wekan (webserver, database, etc.) that I can start checking into as potentials sources of issue. Thks.