Skip to content

Commit e940dec

Browse files
committed
Align deployment setup with org conventions
Rename compose.yml to docker-compose.yml, rename web health endpoint from /health to /healthz, add compose healthcheck for the web service, and add a Build CI workflow that validates the compose file and smoke-builds the web Docker image.
1 parent 26d60db commit e940dec

5 files changed

Lines changed: 59 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: build-${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 45
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Validate compose file
27+
run: docker compose config --quiet
28+
29+
- name: Smoke build web image
30+
run: docker build -f web/Dockerfile -t hos-api/web:ci .

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Fmt](https://github.com/HackHumanityOrg/hos-api/actions/workflows/fmt.yml/badge.svg?branch=main&event=push)](https://github.com/HackHumanityOrg/hos-api/actions/workflows/fmt.yml)
44
[![Clippy](https://github.com/HackHumanityOrg/hos-api/actions/workflows/clippy.yml/badge.svg?branch=main&event=push)](https://github.com/HackHumanityOrg/hos-api/actions/workflows/clippy.yml)
55
[![Tests](https://github.com/HackHumanityOrg/hos-api/actions/workflows/tests.yml/badge.svg?branch=main&event=push)](https://github.com/HackHumanityOrg/hos-api/actions/workflows/tests.yml)
6+
[![Build](https://github.com/HackHumanityOrg/hos-api/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/HackHumanityOrg/hos-api/actions/workflows/build.yml)
67

78
A high-performance Rust monorepo for data indexing and API services built with modern async architecture.
89

@@ -87,7 +88,7 @@ This monorepo ships as independently deployable services plus a shared PostgreSQ
8788

8889
### Docker
8990

90-
Use plain Docker when you want to run each container explicitly instead of relying on [`compose.yml`](compose.yml).
91+
Use plain Docker when you want to run each container explicitly instead of relying on [`docker-compose.yml`](docker-compose.yml).
9192
This workflow publishes the same host ports as Docker Compose, so stop one stack before starting the other.
9293

9394
Build the base images:
@@ -195,7 +196,7 @@ Useful checks:
195196
docker ps --filter name=hos-api
196197
docker logs -f hos-api-api
197198
curl http://127.0.0.1:3000/health
198-
curl http://127.0.0.1:3001/health
199+
curl http://127.0.0.1:3001/healthz
199200
```
200201

201202
Stop and clean up:
@@ -218,7 +219,7 @@ docker volume rm hos-api-postgres hos-api-telegram-session 2>/dev/null || true
218219

219220
### Docker Compose
220221

221-
The repo now includes [`compose.yml`](compose.yml) for a full local container stack:
222+
The repo now includes [`docker-compose.yml`](docker-compose.yml) for a full local container stack:
222223

223224
- `db` starts PostgreSQL 16 with a named data volume
224225
- `migrate` runs `migration up` before any schema-dependent service starts
@@ -261,7 +262,7 @@ Useful checks:
261262
docker compose ps
262263
docker compose logs -f migrate api web
263264
curl http://127.0.0.1:3000/health
264-
curl http://127.0.0.1:3001/health
265+
curl http://127.0.0.1:3001/healthz
265266
```
266267

267268
Stop the stack:
@@ -373,7 +374,7 @@ waiting so a session file or `TELEGRAM_SESSION_DATA` can be uploaded.
373374

374375
### Deployment artifacts in this repo
375376

376-
- `compose`: `/compose.yml`
377+
- `compose`: `/docker-compose.yml`
377378
- `api`: `/api/Dockerfile` and `/api/railway.toml`
378379
- `web`: `/web/Dockerfile` and `/web/railway.toml`
379380
- `migration`: `/migration/Dockerfile`

compose.yml renamed to docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ services:
7272
NEXT_PUBLIC_VENEAR_API_BASE_URL: ${COMPOSE_VENEAR_API_BASE_URL:-http://api:3000/api/v1/venear}
7373
ports:
7474
- "${WEB_PORT:-3001}:3000"
75+
healthcheck:
76+
test:
77+
[
78+
"CMD",
79+
"node",
80+
"-e",
81+
"fetch('http://127.0.0.1:3000/healthz').then(async (res) => { if (!res.ok) throw new Error(String(res.status)); const body = (await res.text()).trim(); if (body !== 'ok') throw new Error(body); }).catch(() => process.exit(1))",
82+
]
83+
interval: 15s
84+
timeout: 5s
85+
retries: 5
86+
start_period: 20s
7587

7688
discourse-indexer:
7789
<<: *rust-service

web/src/app/health/route.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

web/src/app/healthz/route.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { NextResponse } from "next/server";
2+
3+
export function GET() {
4+
return new NextResponse("ok", {
5+
status: 200,
6+
headers: {
7+
"cache-control": "no-store, max-age=0",
8+
"content-type": "text/plain; charset=utf-8",
9+
},
10+
});
11+
}

0 commit comments

Comments
 (0)