From d865a6c8996ed16ae6e19f2c7c77db73105f7613 Mon Sep 17 00:00:00 2001 From: Daniel Escribano Date: Wed, 3 Jul 2024 10:54:00 +0200 Subject: [PATCH 1/3] chore: update docker stack to run HouseWatch locally --- README.md | 10 ++++++++++ docker-compose.dev.yml | 25 +++++++++++++++++++++++-- frontend/Dockerfile.dev | 14 ++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 frontend/Dockerfile.dev diff --git a/README.md b/README.md index 7615c36..2a2fb20 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,16 @@ The following are the supported environment variables for configuring your House +## 🏡 Running locally + +To run HouseWatch locally along with a local ClickHouse instance, execute: + +```bash +docker compose -f docker-compose.dev.yml up +``` + +then go to http://localhost:8080 + ## 💡 Motivation At PostHog we manage a few large ClickHouse clusters and found ourselves in need of a tool to monitor and manage these more easily. diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index c635362..d277d4c 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -12,7 +12,7 @@ services: CLICKHOUSE_DATABASE: default CLICKHOUSE_USER: default CLICKHOUSE_PASSWORD: "" - CLICKHOUSE_CLUSTER: parallel_replicas + CLICKHOUSE_CLUSTER: housewatch CLICKHOUSE_SECURE: false CLICKHOUSE_VERIFY: false CLICKHOUSE_CA: "" @@ -35,6 +35,25 @@ services: - redis - rabbitmq + web: + build: + context: ./frontend + dockerfile: Dockerfile.dev + + caddy: + image: caddy:2.6.1 + restart: unless-stopped + ports: + - "8080:8080" + - "443:443" + environment: + SITE_ADDRESS: ":8080" + volumes: + - ./docker/Caddyfile:/etc/caddy/Caddyfile + depends_on: + - web + - app + db: image: postgres:14-alpine restart: on-failure @@ -68,12 +87,14 @@ services: - rabbitmq clickhouse: - image: ${CLICKHOUSE_SERVER_IMAGE:-clickhouse/clickhouse-server:23.4.2.11} + image: ${CLICKHOUSE_SERVER_IMAGE:-clickhouse/clickhouse-server:23.12.5} restart: on-failure depends_on: - zookeeper volumes: - ./docker/clickhouse-server/config.d:/etc/clickhouse-server/config.d + ports: + - "8123:8123" zookeeper: image: zookeeper:3.7.0 diff --git a/frontend/Dockerfile.dev b/frontend/Dockerfile.dev new file mode 100644 index 0000000..67c2dda --- /dev/null +++ b/frontend/Dockerfile.dev @@ -0,0 +1,14 @@ +FROM node:20.4.0-alpine + +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" + +RUN corepack enable + +WORKDIR /frontend + +COPY . . + +RUN pnpm i + +CMD ["pnpm", "vite", "--port", "3000"] From 6a036c0e3d7f447c306a74a7eccfe7de7798cb24 Mon Sep 17 00:00:00 2001 From: Daniel Escribano Date: Wed, 3 Jul 2024 10:56:36 +0200 Subject: [PATCH 2/3] fix: expose vite server --- README.md | 2 +- frontend/Dockerfile.dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a2fb20..953ecc3 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ The following are the supported environment variables for configuring your House To run HouseWatch locally along with a local ClickHouse instance, execute: ```bash -docker compose -f docker-compose.dev.yml up +docker compose -f docker-compose.dev.yml up -d ``` then go to http://localhost:8080 diff --git a/frontend/Dockerfile.dev b/frontend/Dockerfile.dev index 67c2dda..1b30d2d 100644 --- a/frontend/Dockerfile.dev +++ b/frontend/Dockerfile.dev @@ -11,4 +11,4 @@ COPY . . RUN pnpm i -CMD ["pnpm", "vite", "--port", "3000"] +CMD ["pnpm", "vite", "--port", "3000", "--host"] From 148317ac9c79db2d0fe62464215403fe7c40d60c Mon Sep 17 00:00:00 2001 From: Daniel Escribano Date: Wed, 3 Jul 2024 13:15:04 +0200 Subject: [PATCH 3/3] chore: open postgres port --- docker-compose.dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index d277d4c..eb68c66 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -66,6 +66,8 @@ services: test: ["CMD-SHELL", "pg_isready -U housewatch"] interval: 5s timeout: 5s + ports: + - "5432:5432" redis: image: redis:6.2.7-alpine