Skip to content

Commit a02e21b

Browse files
jacobjurekclaude
authored andcommitted
fix(clickhouse): restore network listening hidden by config.d bind-mount
The clickhouse-server image ships config.d/docker_related_config.xml, which sets listen_host to 0.0.0.0/:: so the server is reachable over the network. Bind-mounting the host's config.d (to deliver quiet-logs.xml) replaces the image's config.d directory and hides that file, so on the next restart the server falls back to its localhost-only default: 8123/9000 stop answering externally while SSH and local clients still work. Re-supply the listen config as config.d/listen.xml so a bind-mounted config.d keeps the instance publicly reachable. Access stays gated by the security group (8123/9000 admin CIDRs) and admin.xml networks. Note: aws_instance has lifecycle.ignore_changes = [user_data], so this takes effect when the instance is rebuilt, not on apply. The live box was hotfixed with the same file; this makes it durable across instance replacement. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 51eb090 commit a02e21b

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

infra/modules/clickhouse-ec2/user-data.sh.tftpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,23 @@ EOF
8585
# admin.xml this stays world-readable rather than chmod 600).
8686
chown 101:101 /etc/clickhouse-server/config.d/quiet-logs.xml
8787

88+
# The image ships /etc/clickhouse-server/config.d/docker_related_config.xml,
89+
# which sets listen_host to 0.0.0.0/:: so the server is reachable over the
90+
# network. Bind-mounting this config.d directory (below) REPLACES the image's
91+
# directory and hides that file, so the server falls back to its localhost-only
92+
# default and 8123/9000 stop answering externally (local clients still work).
93+
# Re-supply the listen config here so a bind-mounted config.d keeps the box
94+
# publicly reachable. listen_try=1 lets it boot if one address family is absent.
95+
cat >/etc/clickhouse-server/config.d/listen.xml <<'EOF'
96+
<clickhouse>
97+
<listen_host>0.0.0.0</listen_host>
98+
<listen_host>::</listen_host>
99+
<listen_try>1</listen_try>
100+
</clickhouse>
101+
EOF
102+
103+
chown 101:101 /etc/clickhouse-server/config.d/listen.xml
104+
88105
# --network=host: nothing else on this box uses 8123 or 9000, so skip the
89106
# docker-proxy NAT layer. --restart=always: container survives reboots
90107
# (docker.service is enabled above). --ulimit nofile=262144: ClickHouse

0 commit comments

Comments
 (0)