Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY migrations ./migrations
RUN cargo build --release -p waveflow-api

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/waveflow-api /usr/local/bin/waveflow-api
COPY migrations /app/migrations
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.gateway
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY migrations ./migrations
RUN cargo build --release -p waveflow-gateway

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/waveflow-gateway /usr/local/bin/waveflow-gateway
COPY migrations /app/migrations
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ GitHub PR merge → Gateway (webhook + HMAC) → Soroban Escrow → Contributor
```bash
cp .env.example .env
docker-compose up -d
curl http://localhost:8080/health
curl http://localhost:8081/health
```

The compose stack starts Postgres, the GitHub webhook gateway on port `8080`, and the REST API on port `8081`. Both Rust services run migrations during startup.

For host-based development, start only the database and run the services with Cargo:

```bash
docker-compose up -d postgres
cargo build --workspace
cargo test --workspace
```
Expand Down
44 changes: 44 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,49 @@ services:
timeout: 5s
retries: 5

waveflow-gateway:
build:
context: .
dockerfile: Dockerfile.gateway
container_name: waveflow-gateway
env_file:
- .env
environment:
DATABASE_URL: postgres://waveflow:waveflow@postgres:5432/waveflow
GATEWAY_PORT: "8080"
PORT: "8080"
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8080/health >/dev/null"]
interval: 10s
timeout: 5s
retries: 5

waveflow-api:
build:
context: .
dockerfile: Dockerfile.api
container_name: waveflow-api
env_file:
- .env
environment:
DATABASE_URL: postgres://waveflow:waveflow@postgres:5432/waveflow
API_PORT: "8081"
PORT: "8081"
ports:
- "8081:8081"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8081/health >/dev/null"]
interval: 10s
timeout: 5s
retries: 5

volumes:
postgres-data:
29 changes: 25 additions & 4 deletions docs/deployment/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ File: `docker-compose.yml`

## Purpose

Provides local Postgres for API and gateway development. Rust binaries run on the host via `cargo run`.
Provides a local WaveFlow stack with Postgres, the GitHub webhook gateway, and the REST API.

## Start

```bash
docker-compose up -d
```

The gateway is exposed at `http://localhost:8080`, and the API is exposed at `http://localhost:8081`.

Health checks:

```bash
curl http://localhost:8080/health
curl http://localhost:8081/health
```

## Connection string

From `.env.example`:
Expand All @@ -24,11 +33,23 @@ Host port `5433` avoids conflicts with other local Postgres instances on 5432.

## Services

Typically a single `postgres` service with volume for data persistence. Check `docker-compose.yml` for the current image tag and credentials.
| Service | Purpose | Host port |
|---------|---------|-----------|
| `postgres` | Local Postgres database with persisted volume | `5433` |
| `waveflow-gateway` | GitHub webhook gateway | `8080` |
| `waveflow-api` | REST API | `8081` |

## With Rust services
The Rust services load `.env`, override `DATABASE_URL` for the compose network, wait for a healthy Postgres container, and run SQLx migrations during startup.

Compose does not start gateway/API containers by default. Use Render Dockerfiles (`Dockerfile.gateway`, `Dockerfile.api`) as reference for production image builds.
## Host-based Rust services

For faster edit-compile cycles, start only Postgres and run the services on the host:

```bash
docker-compose up -d postgres
cargo run -p waveflow-gateway
cargo run -p waveflow-api
```

## Stop and reset

Expand Down
2 changes: 1 addition & 1 deletion migrations/001_init.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Initial Postgres schema for WaveFlow programs, contributors, payouts, and webhook audit.
-- Initial Postgres schema for WaveFlow programs, contributors, payouts, and webhook audit.
-- WaveFlow migration 001: core tables

CREATE TABLE IF NOT EXISTS programs (
Expand Down