Skip to content

Instantly share code, notes, and snippets.

@MikeAmputer
Last active May 28, 2024 06:21
Show Gist options
  • Save MikeAmputer/59cd9d792ae619fe9e431a3811a297c9 to your computer and use it in GitHub Desktop.
Save MikeAmputer/59cd9d792ae619fe9e431a3811a297c9 to your computer and use it in GitHub Desktop.
ClickHouse + SchemaSpy + Nginx - docker compose example
version: "3.9"
name: clickhouse-schemaspy-nginx
services:
clickhouse:
image: clickhouse/clickhouse-server:latest
container_name: clickhouse-example
restart: unless-stopped
environment:
- CLICKHOUSE_USER=ch_user
- CLICKHOUSE_PASSWORD=ch_password
- CLICKHOUSE_DB=example_database
expose:
- "8123"
# to recreate schema visualization run this:
# docker start clickhouse-schemaspy-example
clickhouse-schemaspy:
image: schemaspy/schemaspy:snapshot
container_name: clickhouse-schemaspy-example
volumes:
- clickhouse-schema:/output
- ./schemaspy.properties:/config/schemaspy.properties
# download jdbc driver - https://github.com/ClickHouse/clickhouse-java/releases
- ./clickhouse-jdbc-0.6.0-patch5-http.jar:/drivers/clickhouse-jdbc.jar
command: [
"-configFile",
"/config/schemaspy.properties"
]
depends_on:
- clickhouse
# http://localhost:38080/
nginx:
image: nginx:latest
container_name: nginx-example
ports:
- "38080:80"
volumes:
- clickhouse-schema:/usr/share/nginx/html/clickhouse:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- clickhouse-schemaspy
volumes:
clickhouse-schema:
driver: local
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80;
location / {
root /usr/share/nginx/html/clickhouse;
index index.html;
}
}
}
schemaspy.t=clickhouse
schemaspy.host=clickhouse-example
schemaspy.port=8123
schemaspy.db=example_database
schemaspy.u=ch_user
schemaspy.p=ch_password
schemaspy.s=example_database
schemaspy.dp=./drivers/clickhouse-jdbc.jar
@MikeAmputer
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment