Skip to content

Commit 449a6b8

Browse files
authored
Revise setup instructions and metadata section
Updated README.md to clarify setup instructions and environment variables.
1 parent cf22fb5 commit 449a6b8

1 file changed

Lines changed: 39 additions & 38 deletions

File tree

README.md

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,38 @@ Ensures funds are automatically released based on the terms of the agreement, wi
4747
### **One-command setup**
4848

4949
```bash
50-
# Prerequisites: Docker, Hasura CLI, curl
51-
cp .env.example .env
52-
./bin/dc_prep # full stack setup
53-
./bin/dc_console # open Hasura console (separate terminal)
50+
cp .env.example .env # fill in your values, then:
51+
bin/dc_prep # starts all containers, runs migrations, seeds, and metadata
52+
```
53+
54+
Once `bin/dc_prep` completes, open the Hasura console in a separate terminal:
55+
56+
```bash
57+
bin/dc_console
5458
```
5559

5660
`bin/dc_prep` performs the following steps automatically, in order:
5761

5862
| Step | Action |
5963
|------|--------|
60-
| 1 | Start `postgres`, `data-connector-agent`, and `graphql-engine` via Docker Compose |
61-
| 2 | Poll `GET /healthz` until Hasura is ready (up to 120 s) |
62-
| 3 | Build and deploy tenant metadata (`metadata/setup-tenant.sh safetrust`) |
64+
| 1 | Start `postgres`, `graphql-engine`, and `webhook` via Docker Compose (waits for healthy) |
65+
| 2 | Poll `GET /healthz` until Hasura is ready (up to 3 min) |
66+
| 3 | Build and deploy tenant metadata for all tenants (`metadata/setup-tenant.sh`) |
6367
| 4 | Apply all database migrations (`hasura migrate apply`) |
64-
| 5 | Reload Hasura metadata and verify consistency |
68+
| 5 | Reload Hasura metadata |
6569
| 6 | Apply seed data (`hasura seed apply`) |
6670

67-
**Options:**
71+
### **Environment variables**
72+
73+
Copy `.env.example` to `.env` and fill in the required values before running `bin/dc_prep`:
6874

69-
```text
70-
--tenant TENANT Tenant name to set up (default: safetrust)
71-
--endpoint URL Hasura GraphQL endpoint (default: http://localhost:8080)
72-
--secret SECRET Hasura admin secret (default: myadminsecretkey)
73-
--skip-seeds Skip Step 6 (seed application)
75+
```bash
76+
POSTGRES_PASSWORD=your_postgres_password
77+
78+
# Must be valid JSON with a minimum 32-character key for HS256
79+
HASURA_GRAPHQL_JWT_SECRET={"type":"HS256","key":"replace-with-min-32-char-secret-here"}
80+
81+
HASURA_EVENT_SECRET=your_event_secret
7482
```
7583

7684
> **Windows users:** Run `bin/dc_prep` and `bin/dc_console` inside WSL (Ubuntu) or Git Bash,
@@ -80,12 +88,12 @@ cp .env.example .env
8088

8189
## 🗂️ Metadata Architecture
8290

83-
The metadata folder contains the Hasura GraphQL Engine configuration per tenant.
91+
The `metadata/` folder contains the Hasura GraphQL Engine configuration per tenant.
8492

8593
```
8694
backend/
8795
└── metadata/
88-
── base/
96+
── base/
8997
│ ├── actions.graphql
9098
│ ├── actions.yaml
9199
│ ├── allow_list.yaml
@@ -101,22 +109,21 @@ backend/
101109
│ ├── remote_schemas.yaml
102110
│ ├── rest_endpoints.yaml
103111
│ └── version.yaml
104-
── build/
112+
── build/
105113
│ └── tenant_a/
106114
│ └── tenant_b/
107115
│ └── ...
108-
── tenants/
109-
── tenant_a/
116+
── tenants/
117+
── safetrust/
110118
│ │ ├── databases/
111119
│ │ ├── tables/
112120
│ │ ├── functions/
113121
│ │ └── databases.yaml
114-
│ └── tenant_b/
115-
│ │ ├── databases/
116-
│ │ ├── tables/
117-
│ │ ├── functions/
118-
│ │ └── databases.yaml
119-
│ └── ...
122+
│ └── hotel_industry/
123+
│ ├── databases/
124+
│ ├── tables/
125+
│ ├── functions/
126+
│ └── databases.yaml
120127
├── build-metadata.sh
121128
├── deploy-tenant.sh
122129
└── setup-tenant.sh
@@ -132,13 +139,14 @@ backend/
132139

133140
---
134141

135-
## 🚀 Steps to execute the metadata
142+
## 🚀 Steps to execute the metadata manually
136143

137-
### Option A — Single command (recommended)
144+
> **Tip:** `bin/dc_prep` handles metadata setup automatically. Use the steps below only for targeted tenant work.
138145
139-
Go to the `metadata/` directory and run:
146+
### Option A — Single command (recommended)
140147

141148
```shell
149+
cd metadata
142150
./setup-tenant.sh <tenant_name> [--admin-secret SECRET] [--endpoint URL]
143151
```
144152

@@ -148,15 +156,11 @@ Go to the `metadata/` directory and run:
148156
./setup-tenant.sh safetrust --endpoint http://localhost:8080
149157
```
150158

151-
This runs `build-metadata.sh` followed by `deploy-tenant.sh` automatically in the correct order.
152-
153159
Default values: `--admin-secret myadminsecretkey` · `--endpoint http://localhost:8080`
154160

155-
---
156-
157161
### Option B — Step by step (manual)
158162

159-
1. Go to the `metadata/` directory and build the tenant:
163+
1. Build the tenant:
160164

161165
```shell
162166
./build-metadata.sh <tenant_name> --admin-secret myadminsecretkey --endpoint <endpoint>
@@ -170,12 +174,9 @@ Default values: `--admin-secret myadminsecretkey` · `--endpoint http://localhos
170174
./deploy-tenant.sh <tenant_name> --admin-secret myadminsecretkey --endpoint <endpoint>
171175
```
172176

173-
- **`tenant_name`** — the name of the tenant you will work on (e.g. `safetrust`)
174-
- **`endpoint`** — the Hasura endpoint, commonly `http://localhost:8080`
175-
176177
---
177178

178-
## 🗃️ Steps to execute the migrations
179+
## 🗃️ Steps to execute the migrations manually
179180

180181
> **Tip:** `bin/dc_prep` handles migrations automatically. Use the manual steps below only for targeted work.
181182
@@ -199,7 +200,7 @@ hasura migrate apply \
199200

200201
---
201202

202-
## 🌱 Steps to execute the seeds
203+
## 🌱 Steps to execute the seeds manually
203204

204205
> **Tip:** `bin/dc_prep` applies seeds automatically. Use the manual step below when you need to re-seed.
205206

0 commit comments

Comments
 (0)