ClickHouse Client & Server

Hey there,
The ClickHouse database has two docker packages to get it running: the actual server, and the CLI client.

It comes in two dockerfile images and the docker-compose syntax looks like this:

  clickhouse-server:
    image: yandex/clickhouse-server
    ports:
      - "8123:8123"
      - "9000:9000"
      - "9009:9009"
    ulimits:
      nproc: 65535
      nofile:
        soft: 262144
        hard: 262144
    volumes:
      - clickhouse-data:/var/lib/clickhouse
      - ./clickhouse/docker/clickhouse-config.xml:/etc/clickhouse-server/config.d/override.xml
  # run client with: docker-compose run clickhouse-client
  clickhouse-client:
    image: yandex/clickhouse-client
    entrypoint: ["clickhouse-client", "--host=clickhouse-server"]
    depends_on:
      - clickhouse-server

How should we run this in Fly.io?

My suggestion would be using 2 apps and rely on our internal DNS.

If you have app-client and app-server your client can use app-server.internal:8123 ports as pleased and you can control their scale separately. It’s also possible to expose the server ports if you want via fly.toml

Since both images are public you don’t even need a Dockerfile, just setting up a proper fly.toml and running fly launch should get you started.

Here’s an example fly.toml without Dockerfile: grafana/fly.toml at 7e3bbb407e3d65ad25332d4a29147f43e0863504 · fly-apps/grafana · GitHub