Deploy ClickHouse on Pethost in one click
A fast column-oriented database for analytics, with SQL over HTTP
What happens
- You sign in to Pethost or make an account, with a passkey, GitHub or Google.
- No machine yet? You pick a plan, and we prepare one for you. The link waits in your browser until it is ready.
- New project opens at the app. You fill in what it asks for and click Create project: Admin password.
- In a minute or two the app is live at its own address with HTTPS. Its secrets are made for it at random, and its data is in the nightly backup.
- It is a project like any other: its compose.yaml, its .env, its logs and a terminal are in the panel, and your agent can change it, roll it back or restore it.
First steps
Open https://clickhouse.sam.pethost.app/play and sign in as default with the admin password you gave. Clients that speak ClickHouse’s HTTP interface connect to https://clickhouse.sam.pethost.app on port 443; the native protocol on port 9000 is not reachable. Data is kept in /var/lib/clickhouse.
What it runs
The template is this compose.yaml and the variables it writes into the project’s .env. Pethost runs the file as it is written.
services:
clickhouse:
image: clickhouse/clickhouse-server:26.8.27.9
restart: unless-stopped
environment:
# The user default, with the password given: without one the image lets it in from the
# container's network only, and the HTTP interface would be closed to everyone.
CLICKHOUSE_USER: default
CLICKHOUSE_PASSWORD: ${ADMIN_PASSWORD}
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: "1"
# The stock config logs at trace level into ten files of 1000 MB and keeps its query, metric and
# trace tables for ever: on a small machine they would fill the disk over months. This keeps the
# server's log under 300 MB and those tables a week.
entrypoint:
- sh
- -c
- |
cat > /etc/clickhouse-server/config.d/small-machine.xml <<'XML'
<clickhouse>
<logger><level>information</level><size>100M</size><count>3</count></logger>
<query_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></query_log>
<metric_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></metric_log>
<asynchronous_metric_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></asynchronous_metric_log>
<trace_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></trace_log>
<text_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></text_log>
<part_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></part_log>
<error_log><ttl>event_date + INTERVAL 7 DAY DELETE</ttl></error_log>
</clickhouse>
XML
exec /entrypoint.sh
volumes:
- data:/var/lib/clickhouse
volumes:
data: