Update README with database initialization instructions

This commit is contained in:
2026-06-28 07:55:33 -05:00
parent c4ee3ef5f0
commit 1b696a1cc3
+41 -3
View File
@@ -47,14 +47,52 @@ Kubernetes runtime uses:
### Initialize the database schema and seed data ### Initialize the database schema and seed data
Once the database is reachable and `DATABASE_URL` is set, start the dev server and call: There are several ways to initialize the database depending on your environment:
#### Option 1: Using the init-db.sh script (for direct server access)
If you have direct access to the Kubernetes cluster, you can use the `init-db.sh` script:
```bash
./init-db.sh
```
This script will automatically detect the postgres pod and initialize the database with all required tables and seed data.
#### Option 2: Using the Kubernetes job (recommended for production)
To initialize the database using a Kubernetes job:
```bash
kubectl apply -f k8s/init-db-job.yaml
```
You can monitor the job status with:
```bash
kubectl get jobs -n lahuasca
kubectl get pods -n lahuasca | grep init-database
```
To view the job logs:
```bash
kubectl logs -n lahuasca -l job-name=init-database
```
Once the job completes successfully, you can remove it:
```bash
kubectl delete job init-database -n lahuasca
```
#### Option 3: Using the API endpoint (development only)
Note: This method only works in development mode and is disabled in production.
Start the dev server and call:
```bash ```bash
curl -X POST http://localhost:3000/api/db/init curl -X POST http://localhost:3000/api/db/init
``` ```
To reset everything (drops and recreates tables with seed data): To reset everything (drops and recreates tables with seed data):
```bash ```bash
curl -X POST "http://localhost:3000/api/db/init?reset=true" curl -X POST "http://localhost:3000/api/db/init?reset=true"
``` ```
@@ -76,4 +114,4 @@ Visit `/admin` after logging in as `admin` to upload images. Images are previewe
## User portal ## User portal
Visit `/user` after logging in as `user` to see a member portal with reservations, discount coupons, offers, the WiFi password, and a list of benefits. Visit `/user` after logging in as `user` to see a member portal with reservations, discount coupons, offers, the WiFi password, and a list of benefits.