All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

Connecting the Elasticsearch service to a Rails application (Coolify in the cloud, server on Hetzner).

Post cover: Connecting the Elasticsearch service to a Rails application (Coolify in the cloud, server on Hetzner).
This content has been automatically translated from Ukrainian.
I had a problem connecting the Elasticsearch service to the Rails application (Coolify in the cloud, server on Hetzner).
I couldn't figure out what format should be used for the ELASTICSEARCH_URL environment variable in Rails. I tried different options - with a password, without a password, via local URL, via external domain - but I constantly received a TCP connection error.
In the end, I figured it out
The correct format for ELASTICSEARCH_URL (added in the Rails container) should be as follows*:
http://login:password@es-container-name:9200
*SSL is a separate conversation
The key point is to use the container name, not the external URL provided in the Coolify Web UI.
The container name can be easily found in the Coolify interface on the General tab.
So if you have something like:
http://<container-name>.server-ip.sslip.io:9200
then to connect within the Docker network, you need to take just the <container-name> part and use it in ELASTICSEARCH_URL (or whatever you are using).
After that, Rails successfully connected to Elasticsearch without any TCP errors.
Perhaps this will save someone time, as the documentation in Coolify is a bit abstract.

This post doesn't have any additions from the author yet.

What is a time-series database?
22 Nov 12:42

What is a time-series database?

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska
22 Nov 12:49

What is VACUUM in PostgreSQL?

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska
What is a B-Tree (Balanced Tree)?
22 Nov 12:58

What is a B-Tree (Balanced Tree)?

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska
Fix for the issue of installing Ruby 3.4.3 (and not only) via RVM on macOS (Apple Silicon)
30 Dec 14:05

Fix for the issue of installing Ruby 3.4.3 (and not only) via RVM on macOS (Apple Silicon)

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska
Thundering Herd Problem: what it is and why it breaks production
15 Jan 10:14

Thundering Herd Problem: what it is and why it breaks production

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska
What is Exponential Backoff and Random Jitter?
15 Jan 15:24

What is Exponential Backoff and Random Jitter?

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska
"No space left on device" - when Docker has consumed the entire disk
15 Feb 19:57

"No space left on device" - when Docker has consumed the entire disk

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska
15 Feb 20:03

Sidekiq 7.3.x and connection_pool 3.0 - incompatibility that breaks workers

Нотатки про Ruby та RoR
Нотатки про Ruby та RoR@kovbaska