You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add setup-env script and improve reset-data script
- Add setup-env.sh script to automate environment variable configuration
- Add confirmation prompt to reset-data.sh requiring 'RESET' input
- Add error handling with abort on critical operation failures
- Add dynamic OpenSearch mapping retrieval before index deletion
- Fix variable quoting throughout scripts (shellcheck compliant)
- Format scripts with shfmt for consistent style
- Update README with quick setup instructions and safety features
- Update README to reference new reset script capabilities
Signed-off-by: Asitha de Silva <asithade@gmail.com>
A Heimdall JWT secret is needed to use the `!jwt` macro in playbooks. If you
43
-
export it as an environmental variable, you can pass it to the mock data tool
44
-
as a command line argument. No `export` step is needed as this is used only
45
-
to populate arguments to the mock data tool shell invocation.
63
+
A Heimdall JWT secret is needed to use the `!jwt` macro in playbooks. Export it as an environmental variable so you can pass it to the mock data tool as a command line argument:
-**Order matters!** Playbook directories run in the order specified on the command line.
69
88
- Within each directory, playbooks execute in alphabetical order.
70
89
- Dependencies between playbooks should be considered when organizing execution order. Multiple passes are made to allow `!ref` calls to be resolved, but the right order will improve performance and help avoid max-retry errors.
71
90
- The `!jwt` macro will attempt to detect the JWKS key ID from the endpoint at `http://lfx-platform-heimdall.lfx.svc.cluster.local:4457/.well-known/jwks`. If this URL is not accessible from the execution environment, you must pass an explicit JWT key ID using the `--jwt-key-id` argument.
72
91
73
92
### Wiping Existing Data
74
93
75
-
If you need to start fresh, wipe the NATS KV buckets:
94
+
If you need to start fresh, use the reset script for a complete data wipe:
95
+
96
+
```bash
97
+
./scripts/reset-data.sh
98
+
```
99
+
100
+
This script will:
101
+
102
+
- Clear all NATS KV buckets (projects, committees, meetings, etc.)
103
+
- Clear and recreate OpenSearch indices (using current mapping)
104
+
- Restart the query service to clear cache
105
+
- Delete the project service pod to clear cache
106
+
107
+
**Safety Features:**
108
+
- Requires typing `RESET` to confirm before proceeding
109
+
- Validates all critical operations and exits on failure
110
+
- Preserves authentication data in `authelia-users` and `authelia-email-otp` buckets
111
+
- Automatically retrieves and uses current OpenSearch mapping before recreation
112
+
113
+
**Manual Alternative:** If you prefer to wipe only NATS KV buckets manually:
@@ -81,19 +119,23 @@ for bucket in projects project-settings committees committee-settings committee-
81
119
done
82
120
```
83
121
84
-
*Consider updating this documentation to also provide steps for recreating the OpenSearch index. Stale OpenFGA tuples may also be deleted, but unlike OpenSearch data, it won't impact the refreshed data to keep them.*
122
+
_Note: The reset script is the recommended approach as it handles OpenSearch indices and service caches comprehensively._
85
123
86
124
### Running After Data Wipe
87
125
88
-
When running after wiping data, you need to recreate the ROOT project first, with an extra playbook at the front. This `recreate_root_project` playbook bypasses the API and directly creates a new ROOT project in the NATS KV bucket.
126
+
After using the reset script, the ROOT project is automatically recreated by the project service pod restart. You can run the mock data tool normally:
**Note:** If you wiped data manually (without the reset script), you'll need to delete the project service pod to trigger ROOT project recreation, as it handles permissions correctly:
135
+
136
+
```bash
137
+
kubectl delete pod -n lfx $(kubectl get pods -n lfx --no-headers | grep project-service | awk '{print $1}')
0 commit comments