-
Notifications
You must be signed in to change notification settings - Fork 1
Add script to reset NATS and OpenSearch data #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This script resets all data in NATS KV buckets and OpenSearch, clearing projects, committees, meetings, and search indices. It also restarts the query service and deletes the project service pod to clear caches. Signed-off-by: Asitha de Silva <adesilva@linuxfoundation.org>
Added copyright and license information to the script. Signed-off-by: Asitha de Silva <adesilva@linuxfoundation.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new administrative script to reset all application data for development/testing purposes. The script provides a comprehensive cleanup mechanism by clearing NATS KV buckets, OpenSearch indices, and restarting relevant services.
Key changes:
- Adds
reset-data.shscript that clears all NATS KV buckets (excluding auth-related buckets) - Deletes and recreates OpenSearch indices with proper mapping for the resources index
- Restarts query service and deletes project service pod to clear application caches
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- 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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Make reset-data.sh executable to pass bash-exec linter - Update urllib3 from 2.5.0 to 2.6.2 to fix HIGH severity vulnerabilities: - CVE-2025-66418: Unbounded decompression chain - CVE-2025-66471 (GHSA-gm62-xv2j-4w53) - Add now_utc() Jinja2 helper function for datetime calculations in meeting templates Signed-off-by: Asitha de Silva <asithade@gmail.com>
- Quote NAMESPACE and OPENSEARCH_POD in all kubectl commands - Ensure full shellcheck compliance across both scripts - Address Copilot review comments about variable quoting consistency Signed-off-by: Asitha de Silva <asithade@gmail.com>
src/lfx_v2_mockdata/__init__.py
Outdated
| env.globals["environ"] = dict(os.environ) | ||
| env.globals["fake"] = fake | ||
| env.globals["timedelta"] = datetime.timedelta | ||
| env.globals["now_utc"] = lambda: datetime.datetime.now(datetime.UTC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something you were using for future stuff like mailing list? I don't see it used in this commit. Actually, since python Faker has date-time generation which can include "now", we don't really need "now_z" either ... I've just opened #15 to demonstrate replacing the single instance of now_z with faker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using this in my local for creating future meetings based on the current time -- we can switch to using faker instead.
Removed the now_utc global function from the environment. Signed-off-by: Asitha de Silva <adesilva@linuxfoundation.org>
|
These are great! I'd also suggest we add Andres will be adding a public copy of "current" OpenSearch indexer spec to our indexer repo. |
emsearcy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, maybe we can add TZ=UTC to setup-env on the next update. Thanks!
Summary
This PR introduces administrative scripts to simplify LFX v2 development environment setup and data management.
Changes
New Scripts
setup-env.sh - Automated environment configuration
reset-data.sh - Comprehensive data reset utility
Safety & Quality Improvements
reset-data.sh enhancements:
Documentation Updates
Benefits