From 1b696a1cc35afe17ccd0c216526ce6116e7cb824 Mon Sep 17 00:00:00 2001 From: muken Date: Sun, 28 Jun 2026 07:55:33 -0500 Subject: [PATCH] Update README with database initialization instructions --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 79bee9f..8497367 100644 --- a/README.md +++ b/README.md @@ -47,14 +47,52 @@ Kubernetes runtime uses: ### 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 curl -X POST http://localhost:3000/api/db/init ``` To reset everything (drops and recreates tables with seed data): - ```bash 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 -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. \ No newline at end of file