WolfDan

WolfDan

Hello all!

Actually I’m getting this error on my kubernetes log:

2017-06-02T02:02:49.13752428Z 02:02:49.137 [error] Postgrex.Protocol (pid<0.1578.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (...:5432): timeout

I already check the secrets on Kubernetes, this error is not from authentication, the connection is not refused, there is any way to solve it?

Thanks for all you help!

Greetings!

EDIT: When I make a request to the server I get this error:

2017-06-02T02:09:51.417407254Z Request: GET /anime/1
2017-06-02T02:09:51.417410146Z ** (exit) an exception was raised:
2017-06-02T02:09:51.417413126Z ** (DBConnection.ConnectionError) connection not available because of disconnection
2017-06-02T02:09:51.417416219Z (db_connection) lib/db_connection.ex:926: DBConnection.checkout/2
2017-06-02T02:09:51.417421994Z (db_connection) lib/db_connection.ex:742: DBConnection.run/3
2017-06-02T02:09:51.417425202Z (db_connection) lib/db_connection.ex:584: DBConnection.prepare_execute/4
2017-06-02T02:09:51.417429314Z (ecto) lib/ecto/adapters/postgres/connection.ex:80: Ecto.Adapters.Postgres.Connection.prepare_execute/5
2017-06-02T02:09:51.41743256Z (ecto) lib/ecto/adapters/sql.ex:243: Ecto.Adapters.SQL.sql_call/6
2017-06-02T02:09:51.417435814Z (ecto) lib/ecto/adapters/sql.ex:431: Ecto.Adapters.SQL.execute_and_cache/7
2017-06-02T02:09:51.417438957Z (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5
2017-06-02T02:09:51.417442142Z (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4

Showing Posts 10 to 1

NobbZ

NobbZ

Perhaps the Ecto.Repo.init/2-callback can help you?

A short example of how to use it, can be seen in this post:

sergio-ocon

sergio-ocon

I am getting the same error in Openshift (Kubernetes too).

As configuration in Kubernetes is done during deployment, it should be working using this configuration (and having the proper environment variables):

config :reservation_book, ReservationBook.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: {:system, "DB_USER"},
  password: {:system, "DB_PASSWORD"},
  database: {:system, "DB_NAME"},
  hostname: {:system, "DB_HOST"},
  pool_size: 15

However, Ecto doesn’t seem to recognize the format {:system, “VARIABLE”} for all values, and thus I am stuck.

odarriba

odarriba

Have you tried using an instance of Google Cloud SQL proxy inside your deployment? so you can connect locally and authenticating using a Service Account credentials.

I don’t know if you are running Kubernetes inside GKE, but that’s the recommended way in that case. More info can be found on: Connect from Google Kubernetes Engine  |  Cloud SQL for PostgreSQL  |  Google Cloud Documentation

Hope that helps!

kelvinst

kelvinst

I’d the same kind of issues some time ago with a node project. It really started happening randomly and what I did to fix it was an upgrade on gce-proxy image I use to access Cloud SQL form 1.05 to 1.09.

I really don’t know why it started to happen, and don’t know also what is the root cause of the error. I’ll investigate it soon.

WolfDan

WolfDan OP

jeroenvisser101

jeroenvisser101

You might need to add the server’s IP to the allowed IPs like here.

WolfDan

WolfDan OP

jeroenvisser101

jeroenvisser101

Hey, it’s not an authentication error indeed. Are you sure your Google Cloud SQL instance is Postgres, not MySQL? Also, make sure you’re using the right port.

WolfDan

WolfDan OP

Hey!

It’s connecting to a Google SQL instance, it already has access by ip and api, I don’t know why it don’t connect…

I already have check the secrets on the app, and its correctly too, also as mention isnt a authentication error :C

jeroenvisser101

jeroenvisser101

Hey, which hostname are you using to connect to it? The error you’ve received shows a timeout, so it’s unable to connect to the host. It’s probably unrelated to Ecto or Elixir.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews