ContentSquare / chproxy

Open-Source ClickHouse http proxy and load balancer

Home Page:https://www.chproxy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Include -config parameter in Dockerfile's entrypoint

yohannjCS opened this issue · comments

Is your feature request related to a problem? Please describe.
Trying to use the docker image with docker-compose I did:

chproxy:
  image: contentsquareplatform/chproxy:v1.21.0
  ports:
    - 9090:9090
  restart: always
  volumes:
    - ./resources/chproxy/config.yml:/opt/config.yml
  depends_on:
    clickhouse:
      condition: service_healthy
  healthcheck:
    test: "curl http://localhost:9090/metrics"
    interval: 2s
    timeout: 5s
    retries: 10

In the logs I get:

Usage of /chproxy:
  -config string
    	Proxy configuration filename
  -enableTCP6
    	Whether to enable listening for IPv6 TCP ports. By default only IPv4 TCP ports are listened
  -version
    	Prints current version and exits

This is because launching chproxy requires the argument: -config /config.yml which is not provided by the docker image built here.

Describe the solution you'd like
Update the entrypoint in Dockerfile from ENTRYPOINT ["/chproxy"] to ENTRYPOINT ["/chproxy", "-config", "/config.yml"]

Describe alternatives you've considered
Creating my own Dockerfile on top of the one provided by chproxy, and instead of specifying an image in docker-compose, use:

build:
  context: ./chproxy
  dockerfile: Dockerfile

Another alternative is to use https://hub.docker.com/r/tacyuuhon/clickhouse-chproxy

Additional context
I'm ready to do the PR if this feature is wanted.

In the docker-compose.yml missing chproxy command line arguments, for example, the config flag.
I will prepare a docker-compose.yml example and add it to the repository examples.

Indeed.
I actually also stumbled upon https://github.com/ContentSquare/chproxy/blob/master/examples/quick_start/docker-compose.yml . Though chproxy starts unhealthy because:

{
    "Start": "2023-02-24T07:20:58.481587196-05:00",
    "End": "2023-02-24T07:20:58.615410196-05:00",
    "ExitCode": 127,
    "Output": "/bin/sh: 1: curl: not found\n"
}

You are right, curl should be installed in the docker image in this case. I'll take care of it

@sigua-cs @yohannj I will close this given that we merged the related changes.