Last active
May 28, 2024 06:19
-
-
Save MikeAmputer/5674e12c3e10103afdfee79974d06429 to your computer and use it in GitHub Desktop.
ClickHouse + Postgres + SchemaSpy + Nginx - docker compose example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" | |
name: clickhouse-postgres-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" | |
postgres: | |
image: postgres:latest | |
container_name: postgres-example | |
restart: unless-stopped | |
environment: | |
- POSTGRES_USER=user_pg | |
- POSTGRES_PASSWORD=pg_password | |
- POSTGRES_DB=example_database | |
expose: | |
- "5432" | |
# http://localhost:38080/ | |
# or directly | |
# http://localhost:38080/clickhouse/index.html | |
# 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.clickhouse.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/ | |
# or directly | |
# http://localhost:38080/postgres/index.html | |
# to recreate schema visualization run this: | |
# docker start postgres-schemaspy-example | |
postgres-schemaspy: | |
image: schemaspy/schemaspy:snapshot | |
container_name: postgres-schemaspy-example | |
volumes: | |
- postgres-schema:/output | |
- ./schemaspy.postgres.properties:/config/schemaspy.properties | |
command: [ | |
"-configFile", | |
"/config/schemaspy.properties" | |
] | |
depends_on: | |
- postgres | |
# http://localhost:38080/ | |
nginx: | |
image: nginx:latest | |
container_name: nginx-example | |
ports: | |
- "38080:80" | |
volumes: | |
- postgres-schema:/usr/share/nginx/html/postgres:ro | |
- clickhouse-schema:/usr/share/nginx/html/clickhouse:ro | |
- ./nginx.html:/usr/share/nginx/html/index.html | |
- ./nginx.conf:/etc/nginx/nginx.conf:ro | |
depends_on: | |
- clickhouse-schemaspy | |
- postgres-schemaspy | |
volumes: | |
clickhouse-schema: | |
driver: local | |
postgres-schema: | |
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
index index.html; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Menu</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
margin: 20px; | |
} | |
table { | |
width: 35%; | |
border-collapse: collapse; | |
margin: 20px 0; | |
} | |
th, td { | |
padding: 10px; | |
border: 1px solid #ccc; | |
text-align: left; | |
} | |
th { | |
background-color: #f4f4f4; | |
} | |
a { | |
text-decoration: none; | |
color: #007BFF; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Databases</h1> | |
<table> | |
<thead> | |
<tr> | |
<th>Database</th> | |
<th>Schema</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td>Postgres</td> | |
<td><a href="/postgres/index.html">Link</a></td> | |
</tr> | |
<tr> | |
<td>Clickhouse</td> | |
<td><a href="/clickhouse/index.html">Link</a></td> | |
</tr> | |
</tbody> | |
</table> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schemaspy.t=pgsql11 | |
schemaspy.host=postgres-example | |
schemaspy.port=5432 | |
schemaspy.db=example_database | |
schemaspy.u=user_pg | |
schemaspy.p=pg_password | |
schemaspy.s=public |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This error means that your target database schema has no items. Create a table for your schema and start the
postgres-schemaspy-example
container again.