Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set local clickhouse container's hostname to clickhouse.dev.local #77125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

onkar
Copy link
Member

@onkar onkar commented Sep 7, 2024

Currently, when a clickhouse container is running locally, its hostname is randomly picked up by docker runtime. This hostname which also happens to be the container-id is 12 characters long and composed solely of hexadecimal digits. This makes the hostname resolution a problem because the id is dynamically generated and can be only controlled by docker runtime. This PR sets clickhouse container's hostname to clickhouse.dev.local.

In Snuba developement environment, snuba admin is often not run as a docker container on Mac. To resolve the hostnmae from Snuba admin, you have an entry 127.0.0.1 clickhouse.dev.local in /etc/hosts and then clickhouse.dev.local can resolve to 127.0.0.1. On Mac, 127.0.0.1's port 9000 is forwarded to the clickhouse container, thus making it possible to connect to that container.

The corresponding changes in Snuba admin are in getsentry/snuba#6268.

Testing done

onkardeshpande@G260FHW6HW sentry % docker exec -it sentry_clickhouse /bin/bash
root@clickhouse:/# set | grep -i hostname
HOSTNAME=clickhouse.dev.local

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant