clickhouse + ch-ui in same project
robksawyer
FREEOP

2 months ago

I cloned https://github.com/caioricciuti/ch-ui/blob/main/Dockerfile and trying to get ch-ui to connect to a clickhouse-server service that I have running in the same project and keep getting timeouts. Tried internal railway url, external and feels like everything. Any help appreciated.

Using

FROM clickhouse/clickhouse-server:24.10-alpine

I can get ch-ui running, and it forwards me to settings page, but when trying to access clickhouse via public domain keeps timing out.

Solved$10 Bounty

4 Replies

Railway
BOT

2 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


robksawyer
FREEOP

2 months ago

I can get to this (see screenshow) but it times out using the public domain.

Attachments


robksawyer
FREEOP

2 months ago

I've tried the following for VITE_CLICKHOUSE_URL (I am replacing user:pass with actual credentials in production) and I have VITE_CLICKHOUSE_USER and VITE_CLICKHOUSE_PASS set as env variables that match the Dockerfile config.

https://user:pass@clickhouse-production-XXXX.up.railway.app:8123/

http://user:pass@clickhouse-production-XXXX.up.railway.app:8123/

http://user:pass@clickhouse.railway.internal:8123/

http://user:pass@clickhouse.railway.internal:8123

http://clickhouse.railway.internal:8123


robksawyer
FREEOP

2 months ago

I ended up finally getting this working. The trick was letting Railway manage the SSL and not trying to override in the clickhouse server config.xml. Also, getting this config.xml along with the memory settings for the container was important. I used the following:

Locally I had a folder named clickhouse that I used to put all of the contents in. I used railway up locally to deploy.

  • Editor note: I tried sharing the final config.xml and Dockerfile, but the comment isn't allowing it for some reason?

clickhouse/docker-entrypoint-initdb.d/init.sql

CREATE DATABASE IF NOT EXISTS your_cool_db;

clickhouse/users.d/*.xml (replace * with username)

<?xml version="1.0"?>
<clickhouse>
  <users>
    <ch_ui_user>
      <password>REPLACE_ME_WITH_PASSWORD</password>
      <networks>
        <ip>0.0.0.0/0</ip>
        <ip>::/0</ip>
      </networks>
      <profile>ch_ui_profile</profile>
      <quota>default</quota>
      <access_management>0</access_management>
    </ch_ui_user>
  </users>

  <profiles>
    <ch_ui_profile>
      <!-- Read-only for analytics UI -->
      <readonly>1</readonly>
      <max_memory_usage>500000000</max_memory_usage>
    </ch_ui_profile>
  </profiles>
</clickhouse>

clickhouse/config.d/memory.xml

<?xml version="1.0"?>
<clickhouse>
   <merge_tree>
      <number_of_free_entries_in_pool_to_execute_mutation>16</number_of_free_entries_in_pool_to_execute_mutation>
      <number_of_free_entries_in_pool_to_execute_optimize_entire_partition>16</number_of_free_entries_in_pool_to_execute_optimize_entire_partition>
   </merge_tree>

   <max_thread_pool_size>128</max_thread_pool_size>
   <background_pool_size>8</background_pool_size>
   <background_move_pool_size>4</background_move_pool_size>
   <background_fetches_pool_size>4</background_fetches_pool_size>
   <background_schedule_pool_size>8</background_schedule_pool_size>
   <background_message_broker_schedule_pool_size>4</background_message_broker_schedule_pool_size>
</clickhouse>

Status changed to Solved brody about 2 months ago


Loading...