From 441cba735e9315dc1dca8fc6c81aa5f8e7782461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Thu, 11 Sep 2025 10:50:06 +0000 Subject: [PATCH 1/7] feat: adds docker compose definition with missing minio --- compose.yml | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 compose.yml diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..3d68bc7 --- /dev/null +++ b/compose.yml @@ -0,0 +1,77 @@ +services: + happy-server: + build: + context: . + ports: + - "3000:3000" + restart: unless-stopped + environment: + - NODE_ENV=production + - DATABASE_URL=postgresql://postgres:postgres@postgres:5432/happy-server + - REDIS_URL=redis://redis:6379 + - SEED=your-seed-for-token-generation + - PORT=3000 + - S3_HOST=minio + - S3_PORT=9000 + - S3_USE_SSL=false + - S3_ACCESS_KEY=minioadmin + - S3_SECRET_KEY=minioadmin + - S3_BUCKET=happy + - S3_PUBLIC_URL=http://minio:9000/happy + depends_on: + - postgres + - redis + - minio + + postgres: + image: postgres:15 + environment: + - POSTGRES_DB=happy-server + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + volumes: + - postgres_data:/var/lib/postgresql/data + ports: + - "5432" + + redis: + image: redis:7-alpine + ports: + - "6379" + volumes: + - redis_data:/data + + minio: + image: minio/minio + command: server /data --console-address ":9001" + ports: + - "9000:9000" + - "9001:9001" + environment: + - MINIO_ROOT_USER=minioadmin + - MINIO_ROOT_PASSWORD=minioadmin + volumes: + - minio_data:/data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + + minio-init: + image: minio/mc + depends_on: + minio: + condition: service_healthy + entrypoint: > + /bin/sh -c " + mc alias set myminio http://minio:9000 minioadmin minioadmin; + mc mb myminio/happy || true; + mc anonymous set download myminio/happy; + exit 0; + " + +volumes: + postgres_data: + redis_data: + minio_data: From 68b25f4a2c35c488e7afb59d1ca75d07ee7afd07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Thu, 11 Sep 2025 10:51:24 +0000 Subject: [PATCH 2/7] chore: renames compose template --- .gitignore | 3 +++ compose.yml => compose.yml.tmpl | 0 2 files changed, 3 insertions(+) rename compose.yml => compose.yml.tmpl (100%) diff --git a/.gitignore b/.gitignore index c75f985..fea97b1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ dist .logs/ .claude/ + +compose.yml + diff --git a/compose.yml b/compose.yml.tmpl similarity index 100% rename from compose.yml rename to compose.yml.tmpl From 4be21bfe813de54116e00b4b649887603dd8b799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Thu, 11 Sep 2025 10:53:23 +0000 Subject: [PATCH 3/7] chore: comment the minio admin console --- compose.yml.tmpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compose.yml.tmpl b/compose.yml.tmpl index 3d68bc7..7d5fef5 100644 --- a/compose.yml.tmpl +++ b/compose.yml.tmpl @@ -45,8 +45,9 @@ services: image: minio/minio command: server /data --console-address ":9001" ports: - - "9000:9000" - - "9001:9001" + - "9000" + # Include if you want to access the admin console + #- "9001:9001" environment: - MINIO_ROOT_USER=minioadmin - MINIO_ROOT_PASSWORD=minioadmin From 6ba0398998366e282a00fe60d8cdb17bece1cf7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Thu, 11 Sep 2025 11:08:06 +0000 Subject: [PATCH 4/7] feat: adds prisma migration step --- compose.yml.tmpl | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/compose.yml.tmpl b/compose.yml.tmpl index 7d5fef5..4725a10 100644 --- a/compose.yml.tmpl +++ b/compose.yml.tmpl @@ -1,7 +1,6 @@ services: happy-server: - build: - context: . + build: . ports: - "3000:3000" restart: unless-stopped @@ -9,7 +8,7 @@ services: - NODE_ENV=production - DATABASE_URL=postgresql://postgres:postgres@postgres:5432/happy-server - REDIS_URL=redis://redis:6379 - - SEED=your-seed-for-token-generation + - HANDY_MASTER_SECRET=your-seed-for-token-generation - PORT=3000 - S3_HOST=minio - S3_PORT=9000 @@ -19,9 +18,23 @@ services: - S3_BUCKET=happy - S3_PUBLIC_URL=http://minio:9000/happy depends_on: - - postgres - - redis - - minio + postgres: + condition: service_healthy + minio: + condition: service_healthy + migrate: + condition: service_completed_successfully + + migrate: + build: . + command: yarn prisma migrate deploy + environment: + DATABASE_URL: postgresql://postgres:password@postgres:5432/happy-server + depends_on: + postgres: + condition: service_healthy + volumes: + - ./prisma:/app/prisma postgres: image: postgres:15 From 268028d1ca138f411a753f0ebba554abe450effa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Thu, 11 Sep 2025 11:19:45 +0000 Subject: [PATCH 5/7] fix: default postgres password --- compose.yml.tmpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compose.yml.tmpl b/compose.yml.tmpl index 4725a10..a27d3ed 100644 --- a/compose.yml.tmpl +++ b/compose.yml.tmpl @@ -29,7 +29,7 @@ services: build: . command: yarn prisma migrate deploy environment: - DATABASE_URL: postgresql://postgres:password@postgres:5432/happy-server + DATABASE_URL: postgresql://postgres:postgres@postgres:5432/happy-server depends_on: postgres: condition: service_healthy @@ -46,6 +46,11 @@ services: - postgres_data:/var/lib/postgresql/data ports: - "5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 redis: image: redis:7-alpine From a872211902ac4ea3624fb5862ec6e8e1d4dc6004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Thu, 11 Sep 2025 11:30:06 +0000 Subject: [PATCH 6/7] fix: removes the ports from the compose template --- README.md | 2 ++ compose.yml.tmpl | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bef4da6..7613b37 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ Your Claude Code clients generate encryption keys locally and use Happy Server a That said, Happy Server is open source and self-hostable if you prefer running your own infrastructure. The security model is identical whether you use our servers or your own. +**If you still want to self-host:** An easy way to self-host `happy-server` is by copying the `compose.yml.tmpl` to `compose.yml` and add a random `HANDY_MASTER_SECRET`. A `docker compose up -d` afterwards and you have a running server greeting you on port `3000`. For a more sophisticated server with a reverse proxy and SSL, please check our docs. + ## License MIT - Use it, modify it, deploy it anywhere. \ No newline at end of file diff --git a/compose.yml.tmpl b/compose.yml.tmpl index a27d3ed..bf7f821 100644 --- a/compose.yml.tmpl +++ b/compose.yml.tmpl @@ -44,8 +44,6 @@ services: - POSTGRES_PASSWORD=postgres volumes: - postgres_data:/var/lib/postgresql/data - ports: - - "5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 10s @@ -54,8 +52,6 @@ services: redis: image: redis:7-alpine - ports: - - "6379" volumes: - redis_data:/data @@ -63,7 +59,6 @@ services: image: minio/minio command: server /data --console-address ":9001" ports: - - "9000" # Include if you want to access the admin console #- "9001:9001" environment: From 7f6ddfd673a8b2a199bea0d5b1251b70b0abc4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Thu, 11 Sep 2025 11:32:31 +0000 Subject: [PATCH 7/7] docs: adds note about self-hosting --- README.md | 2 +- compose.yml.tmpl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7613b37..4aaaf38 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Your Claude Code clients generate encryption keys locally and use Happy Server a That said, Happy Server is open source and self-hostable if you prefer running your own infrastructure. The security model is identical whether you use our servers or your own. -**If you still want to self-host:** An easy way to self-host `happy-server` is by copying the `compose.yml.tmpl` to `compose.yml` and add a random `HANDY_MASTER_SECRET`. A `docker compose up -d` afterwards and you have a running server greeting you on port `3000`. For a more sophisticated server with a reverse proxy and SSL, please check our docs. +**If you still want to self-host:** An easy way to self-host `happy-server` is by copying `compose.yml.tmpl` to `compose.yml` and adding a random `HANDY_MASTER_SECRET`. Run `docker compose up -d` afterward, and you'll have a running server accessible on port `3000`. For a more sophisticated setup with a reverse proxy and SSL, please refer to our [self-hosting guide](https://happy.engineering/docs/guides/self-hosting/). ## License diff --git a/compose.yml.tmpl b/compose.yml.tmpl index bf7f821..067adf9 100644 --- a/compose.yml.tmpl +++ b/compose.yml.tmpl @@ -58,9 +58,9 @@ services: minio: image: minio/minio command: server /data --console-address ":9001" - ports: - # Include if you want to access the admin console - #- "9001:9001" + # Include if you want to access the admin console + # ports: + # - "9001:9001" environment: - MINIO_ROOT_USER=minioadmin - MINIO_ROOT_PASSWORD=minioadmin