mirror of
https://github.com/bigbeartechworld/big-bear-scripts.git
synced 2026-03-31 06:33:56 -04:00
31aaabc368c8b480c97821213e0f21e0b1186f15
* ✨ feat: Add Portainer password reset script This commit introduces a new script `run.sh` that allows users to easily reset the Portainer administrator password. The script performs the following key changes: - Checks if Docker is running and accessible - Finds the Portainer container and its associated data volume - Detects the deployment type (container, service, or stack) - Stops the Portainer instance based on the deployment type - Provides a user prompt to confirm the password reset - Resets the Portainer administrator password The script is designed to be user-friendly, providing clear instructions and error handling to ensure a smooth password reset process. This feature will help Portainer users who have lost or forgotten their administrator password, allowing them to regain access to their Portainer instance. * 🔧 feat(reset-portainer-password): Add support for Portainer stacks This commit adds support for resetting the Portainer administrator password when Portainer is deployed as a Docker stack. Previously, the script only supported Portainer containers and services. The key changes are: - Detect if Portainer is deployed as a stack and find the corresponding service name - Scale down the Portainer stack service to 0 replicas before resetting the password - Scale up the Portainer stack service to 1 replica after resetting the password - Improve the logic for finding the Portainer data volume or bind mount - Update the README with information about bind mounts * 🔧 refactor: Improve error handling in Portainer password reset script The changes in this commit focus on improving the error handling in the Portainer password reset script. The main changes are: - Replaced the `check_command` function with a more generic `handle_error` function that prints the error message and exits the script. - Simplified the error handling in various places by using the `|| handle_error` pattern instead of explicit error checking. - Temporarily disabled `set -e` when running the Portainer password reset helper to properly capture the exit code. - Improved the logic for finding the Portainer container and volume/mount by using the `||` operator instead of explicit error checking. These changes make the script more robust and easier to maintain by centralizing the error handling logic and reducing duplication. * ✨ refactor: improve error handling and rename error function Replace generic handle_error calls with handle_command_error for clearer command failure handling in Portainer service scaling and container operations. Introduce a detailed handle_error function to trap errors, providing line number, exit code, and failed command for better diagnostics. Enhance script robustness and maintainability by improving error reporting. * feat(reset-portainer-password): improve error handling and deployment detection Enhance error handling with detailed diagnostics on failure using ERR trap. Refine Docker and Portainer container checks for accuracy and robustness. Improve volume detection logic to handle mounts and fallback volume names. Add deployment type detection to distinguish container, service, or stack. Update script flow to confirm actions and handle different deployment types appropriately when stopping and restarting Portainer.
BigBearScripts
YouTube Link: https://www.youtube.com/@bigbeartechworld
BigBearCommunity
If you have a suggestion for a video, post in the BigBearCommunity.
Support My Work
Languages
Shell
99.2%
JavaScript
0.8%