From 945f97d4e821fbed4076c4fc4e0204dd3e882d58 Mon Sep 17 00:00:00 2001 From: Daesgar Date: Wed, 3 Jul 2024 16:09:14 +0200 Subject: [PATCH] chore: update docker stack to run HouseWatch locally (#71) --- README.md | 10 ++++++++++ docker-compose.dev.yml | 27 +++++++++++++++++++++++++-- frontend/Dockerfile.dev | 14 ++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 frontend/Dockerfile.dev diff --git a/README.md b/README.md index 7615c36..953ecc3 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 -d +``` + +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..eb68c66 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 @@ -47,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 @@ -68,12 +89,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..1b30d2d --- /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", "--host"]